Bonjours, j'ai une erreur qui apparais lorsque je veux créer un pdf sur symfony avec : wkhtmltopdf.

Le problème est le suivant :


Code : Sélectionner tout - Visualiser dans une fenêtre à part
CRITICAL - Uncaught PHP Exception RuntimeException: "The exit status code '1' says something went wrong: stderr: "Le chemin d'acc�s sp�cifi� est introuvable. " stdout: "" command: "C:/Program Files (x86)/wkhtmltopdf/wkhtmltopdf.exe" --lowquality "C:\WINDOWS\TEMP\knp_snappy568d3ce30697c9.73376159.html" "c:\page.pdf"." at C:\wamp\www\symfony\symfony_demo\vendor\knplabs\knp-snappy\src\Knp\Snappy\AbstractGenerator.php line 336

Avec comme Stack Trace :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
Stack Trace
in vendor\knplabs\knp-snappy\src\Knp\Snappy\AbstractGenerator.php at line 336   -
    protected function checkProcessStatus($status, $stdout, $stderr, $command)
    {
        if (0 !== $status and '' !== $stderr) {
            throw new \RuntimeException(sprintf(
                'The exit status code \'%s\' says something went wrong:'."\n"
                .'stderr: "%s"'."\n"
                .'stdout: "%s"'."\n"
at AbstractGenerator ->checkProcessStatus ('1', null, '', '"C:/Program Files (x86)/wkhtmltopdf/wkhtmltopdf.exe" --lowquality "C:\WINDOWS\TEMP\knp_snappy568d3b80d7d753.62253652.html" "c:\page.pdf"') 
in vendor\knplabs\knp-snappy\src\Knp\Snappy\AbstractGenerator.php at line 151   -
        $command = $this->getCommand($input, $output, $options);
        list($status, $stdout, $stderr) = $this->executeCommand($command);
        $this->checkProcessStatus($status, $stdout, $stderr, $command);
        $this->checkOutput($output, $command);
    }
at AbstractGenerator ->generate (array('C:\WINDOWS\TEMP\knp_snappy568d3b80d7d753.62253652.html'), 'c:\page.pdf', array('lowquality' => true), false) 
in vendor\knplabs\knp-snappy\src\Knp\Snappy\Pdf.php at line 62   -
    {
        $options = $this->handleOptions($this->mergeOptions($options));
        parent::generate($input, $output, $options, $overwrite);
    }
    /**
at Pdf ->generate (array('C:\WINDOWS\TEMP\knp_snappy568d3b80d7d753.62253652.html'), 'c:\page.pdf', array(), false) 
in vendor\knplabs\knp-snappy\src\Knp\Snappy\AbstractGenerator.php at line 170   -
            $fileNames[] = $this->createTemporaryFile($html, 'html');
        }
        $this->generate($fileNames, $output, $options, $overwrite);
    }
    /**
at AbstractGenerator ->generateFromHtml ('<!doctype html> <html> <head> <meta charset="utf-8"> <title>BIENVENUE DANS LE CLUB DE DESTRUCTION DES RESEAUX</title> </head> <body> <img src="/symfony/symfony_demo/web/bundles/siohelloworld/images/sio.jpg"</img> </body> </html>', 'c:\page.pdf', array(), false) 
in vendor\knplabs\knp-snappy-bundle\Snappy\LoggableGenerator.php at line 63   -
        $this->logDebug(sprintf('Generate from HTML (%s) to file (%s).', substr($debugHtml, 0, 100), $output));
        $this->generator->generateFromHtml($html, $output, $options, $overwrite);
    }
    /**
at LoggableGenerator ->generateFromHtml ('<!doctype html> <html> <head> <meta charset="utf-8"> <title>BIENVENUE DANS LE CLUB DE DESTRUCTION DES RESEAUX</title> </head> <body> <img src="/symfony/symfony_demo/web/bundles/siohelloworld/images/sio.jpg"</img> </body> </html>', 'c:\page.pdf') 
in src\sio\helloworldBundle\Controller\DefaultController.php at line 15   -
    }
     public function index2Action()
    {
    $this->get('knp_snappy.pdf')->generateFromHtml($this->renderView('siohelloworldBundle:Default:index2.html.twig'),'c:\page.pdf');
    return $this->render('siohelloworldBundle:Default:index2.html.twig');
    }
}
at DefaultController ->index2Action () 
at call_user_func_array (array(object(DefaultController), 'index2Action'), array()) 
in app\bootstrap.php.cache at line 3192   -
$this->dispatcher->dispatch(KernelEvents::CONTROLLER, $event);
$controller = $event->getController();
$arguments = $this->resolver->getArguments($request, $controller);
$response = call_user_func_array($controller, $arguments);
if (!$response instanceof Response) {
$event = new GetResponseForControllerResultEvent($this, $request, $type, $response);
$this->dispatcher->dispatch(KernelEvents::VIEW, $event);
at HttpKernel ->handleRaw (object(Request), '1') 
in app\bootstrap.php.cache at line 3154   -
{
$request->headers->set('X-Php-Ob-Level', ob_get_level());
try {
return $this->handleRaw($request, $type);
} catch (\Exception $e) {
if (false === $catch) {
$this->finishRequest($request, $type);
at HttpKernel ->handle (object(Request), '1', true) 
in app\bootstrap.php.cache at line 3305   -
$this->container->enterScope('request');
$this->container->set('request', $request,'request');
try {
$response = parent::handle($request, $type, $catch);
} catch (\Exception $e) {
$this->container->set('request', null,'request');
$this->container->leaveScope('request');
at ContainerAwareHttpKernel ->handle (object(Request), '1', true) 
in app\bootstrap.php.cache at line 2498   -
if (false === $this->booted) {
$this->boot();
}
return $this->getHttpKernel()->handle($request, $type, $catch);
}
protected function getHttpKernel()
{
at Kernel ->handle (object(Request)) 
in web\app_dev.php at line 36   -
$kernel = new AppKernel('dev', true);
$kernel->loadClassCache();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
Mon config.yml est configué de la sorte pour wkhtmltopdf

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Knp_snappy Configuration		
knp_snappy:
    pdf:
        enabled:    true
        binary:     "\"C:/Program Files (x86)/wkhtmltopdf/wkhtmltopdf.exe\""
        options:    []
    image:
        enabled:    true
        binary:     "\"C:/Program Files (x86)/wkhtmltopdf/wkhtmltopdf.exe\""
        options:    []		
#Twig Configuration
twig:
    debug:            "%kernel.debug%"
    strict_variables: "%kernel.debug%"
Merci de votre Attention ainsi que de votre aide. Je vous remercie les Helper de developpez.net