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
-
1How did you attempt to use “tcpdf”, and what errors, specifically, did it throw?– user1479055Commented Jan 21, 2013 at 3:43
-
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 AthikkalCommented Jan 21, 2013 at 3:46
-
2Your comment answered neither of the questions asked.– user1479055Commented Jan 21, 2013 at 3:46
Add a comment
|
3 Answers
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.
-
i got error proc_open() [<a href='function.proc-open'>function.proc-open</a>]: CreateProcess failed, error code - 2 in C:\wamp\www\Temple Connection\htmlpdf\WkHtmlToPdf.php on line 300 . pls help Commented Jan 21, 2013 at 4:54
-
hi N Rohler pls help me , when i used wkhtmlpdf i got error proccess not start. i used a page with extension .php , will it proccess an error ? Commented Jan 21, 2013 at 5:08
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);