Nishil Athikkal
Nishil Athikkal

Reputation: 79

Conversion of HTML to PDF: tcpdf throws errors on large data

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.

Upvotes: 0

Views: 2660

Answers (3)

Michael Day
Michael Day

Reputation: 1015

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

Upvotes: -1

Roopendra
Roopendra

Reputation: 7762

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);

Upvotes: 0

N Rohler
N Rohler

Reputation: 4615

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.

Upvotes: 3

Related Questions