I use phpwkhtmltopdf as described here How do I get WKHTMLTOPDF to execute via PHP?
to convert html to pdf
set_time_limit (0);
require_once __DIR__.'/vendor/autoload.php';
use mikehaertl\wkhtmlto\Pdf;
$pdf = new Pdf;
$pdf->addPage('<html><h1>PDF creation successfull</h1></html>');
$pdf->send('test.pdf');
if (!$pdf->send('test.pdf')) {
throw new Exception('Could not create PDF: '.$pdf->getError());
}
when i run this i get the following error
Fatal error: Uncaught exception 'Exception' with message 'Could not create PDF: Loading pages (1/6) [> ] 0% [======> ] 10% ' in /home/kpninfotech/public_html/pdfbin/convert.php:30 Stack trace: #0 {main} thrown in /home/kpninfotech/public_html/pdfbin/convert.php on line 30
I also tried to run exec command from php
error_reporting(E_ALL);
ini_set('display_errors', '1');
$cmd = "/usr/bin/wkhtmltopdf http://www.kpninfotech.com test.pdf 2>&1";
echo $t = exec($cmd);
exit();
Here also i get the same error
[> ] 0% [======> ] 10%
But the pdf conversion runs successfully when executed via ssh
But i couldn't execute via PHP, How can i execute it via PHP?
I have VPS server running centos 6.5, wkhtmltopdf version 0.12.1 (with patched qt)