Question

I am having problems adding multiple pages to a PDF document using the great PHP wkHTMLToPdf wrapper.

The following code just gives me a blank page

require_once('phpwkhtmltopdf/WkHtmlToPdf.php');
$pdf = new WkHtmlToPdf;

$pdf->addPage('http://www.google.co.uk');
$pdf->addPage('http://www.google.co.uk');

$pdf->send('test.pdf');
exit();

but this works fine.

require_once('phpwkhtmltopdf/WkHtmlToPdf.php');
$pdf = new WkHtmlToPdf;

$pdf->addPage('http://www.google.co.uk');

$pdf->send('test.pdf');
exit();
Was it helpful?

Solution

The problem was because I had used apt-get install to install wkhtmltopdf but doing this provides a very limited solution i.e. a number of options are omitted including adding more than one page. By downloading and installing manually everything worked.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top