I am using CakePHP on a WAMP stack. I have installed the CakePDF plugin and am trying to use WkHtmlToPdf as the rendering engine.
If I run WkHtmlToPdf from the CLI it works perfectly, however when trying to generate a PDF from the CakePHP application I get:
wkhtmltopdf binary is not found or not executable: C:wkhtmltopdf Error: An Internal Error Has Occurred.
The path is correct and I used the WkHtmlToPdf binary installer for Windows if that makes any difference. I’m not really sure what else to try? If I try a difference rendering engine like TcPdf it works fine (but isn’t as good as WkHtmlToPdf hence why I want to use it.)
Advertisement
Answer
I managed to solve this by including the full path to the wkhtmltopdf binary
Configure::write( 'CakePdf', array( 'engine' => 'CakePdf.WkHtmlToPdf', 'options' => array( 'print-media-type' => false, 'outline' => true, 'dpi' => 96 ), 'margin' => array( 'bottom' => 15, 'left' => 50, 'right' => 30, 'top' => 45 ), 'binary' => 'C:' . DS . 'wkhtmltopdf' . DS . 'wkhtmltopdf.exe', 'orientation' => 'landscape', 'download' => false )
);