Reputation: 11
I had develop an intranet on CakePHP which in one part generates a custom PDF using DOMPDF. The problem is that I have a memo field (mysql text) which I print after getting the result from PHP nl2br function.
The problems is that in some occasions, this text is too long (even on font-size: 6px) and I need some way to make a page break (get again de header, and footer etc)... or maybe a nice way to get a second column to continue with the text inside.
any ideas?
Upvotes: 1
Views: 4508
Reputation: 4116
You can do it in two ways
One of them is using a section, on pagebreaks, dompdf will repeat the header. You can force a pagebreak using CSS attribute page-break-before:always
The second option is using PHP to draw the header/footer using $pdf->page_text() function like this http://www.digitaljunkies.ca/dompdf/faq.php#footers
Upvotes: 0
Reputation: 13914
Is your header just around the memo field? If so you can put your memo field in a table and use a thead/tfoot section for the header/footer. When the table moves to the second page it should be displayed again (though I believe there are problems with tfoot handling).
If these are document-wide headers and footers you could use inline PHP (see also the FAQ). Or, if you're using the latest release (0.6.0 alpha 2) and are up to patching you could add fixed positioning support and use that to create a header/footer.
See the DOMPDF developer site for more information.
If you have a sample document it might be easier to visualize the problem.
Upvotes: 0
Reputation: 1821
Got this from Google, http://www.digitaljunkies.ca/dompdf/faq.php#page_break . It doesn't solve the secondary question regarding the repeated header and footer, however. Something like http://www.xefteri.com/articles/show.cfm?id=26 might help with that (not recommended).
Upvotes: 1