views:

373

answers:

3

Hi! I had develop an intranet on CakePHP witch in one part generates a custom PDF using DOMPDF. The problem is that i have a memo field (mysql text) witch i print after getting the result from PHP nl2br function.

The problems is that in some ocasions, 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? thanks so much

+1  A: 

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

michaelc
A: 

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.

BrianS
A: 

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

ferdy182