0
votes

I have a web page and I want to convert it to the PDF format. This page is PHP, so its output is dynamic. I used tcpdf, but it throws errors. It contains a large amount of data.

3
How did you attempt to use “tcpdf”, and what errors, specifically, did it throw? - user1479055
Hi, me used tcpdf it works fine for small amount of data (eg: one div with 10 or more paragraphs) but it didn't work for large amount of data my page contains data which is the result of php execution, it contains tables divs and high charts , it throws the error large amount of data, first argument to be array etc - Nishil Athikkal
Your comment answered neither of the questions asked. - user1479055

3 Answers

3
votes

I recommend wkhtmlpdf, which uses WebKit to render PDFs. Here's a PHP wrapper (can't vouch for this one specifically): http://mikehaertl.github.com/phpwkhtmltopdf/ . I've used exec to generate them in the past.

0
votes

If you are using fixed width in html with large amount of data then it will not generate pdf. I would suggest you try few things .This is not a permanent solutions but Hopefully it works for you.

1) Use LANDSCAPE orientation if large amount of data in your page .
2) Change default page format A4 to A3

You can change both arrangement by using below line .

$pdf->AddPage('L', 'A3');

instead of $pdf->AddPage();

and

3) increase set_time_limit value, default it is 30. 

  for e.g set_time_limit(60);
-1
votes

Prince converts HTML to PDF and also has a PHP wrapper.