> > Are you using tables to format the document? This can have a
> > significant affect on the memory footprint and the speed of rendering.
>
> > One possible work-around (which I have used successfully) ... if you
> > know where each page break needs to occur you can render each page
> > separately then use pdftk to combine them all.
>
> I am using tables, no large textareas, how does pdftk work?
I would guess your tables are causing the problem, particularly if
you're using nested table and/or tables that span multiple pages. If
you can simplify your document in any way that may be easier than
inserting pdftk into your workflow. One way you might simplify things
for DOMPDF is to start a new table with each record rather than just a
new row.
However, if you think pdftk may be worth investigating here's a little
info ...
pdftk (PDF toolkit) is a program that can modify PDF files in a
variety of ways. You can find it at:
http://www.accesspdf.com/pdftk/
Typically when I use it I have a document that uses a very structured
format, so I know where each page will break. In this instance I
render each page separately through a loop and save the results to a
file. When all the pages have been rendered I pass the results to
pdftk to make a single PDF file out of the individual pages. Here's
some simplified code that's along the lines of what my script does:
// $document is an array of pages for the document being rendered
$exec_cmd = 'pdftk';
foreach ($document as $index => $page) {
$dompdf = new DOMPDF();
$dompdf->load_html($page);
$dompdf->render();
file_put_contents('tempfile' . $index . '.pdf', $dompdf->output());
unset($dompdf);
$exec_cmd .= ' tempfile' . $index . '.pdf';
}
$exec_cmd .= ' cat output final.pdf';
exec($exec_cmd, $pdftk_output, $pdftk_return_code);
You can find a sample of my script here:
http://eclecticgeek.com/code/dompdf.txt