Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
I have a View of nodes. I want to print each node in a separate page. I'm using TCPDF. I have not been able to figure out how to add a page break of the type #5 above mentioned. I added a Global: Custom Text field as the last field in the View Fields list, but this is not working. Any help will be appreciated. Thanks!
EDIT: I found a solution - Rather than using an inline style definition inside the html tag (which gets filtered out by Views' Global: Custom Text field), I used the option "Create a CSS class" in "Style Setting" for the Custom Text field. I created a new CSS class that included 'page-break-before: always;' in the print.css file. NB: use the print.css file inside /sites/all/modules/print/css/ folder.
Comments
Comment #1
cstachris commentedAdding paragraph elements makes room, but it's a hit and miss way of doing it. Is there a better way?
Comment #2
jcnventuraIf you're using dompdf, it's possible to add inline PHP (http://www.digitaljunkies.ca/dompdf/usage.php#inline).
If you're using TCPDF, it's not possible, sorry.
João
Comment #3
jcnventuraNo further info in two weeks. Closing the issue.
Comment #4
feedbackloop commentedWith wkhtmltopdf, you can apply the CSS
page-break-after: always;to any block-level element. So for example:And then, in css/print.css in the print/ module directory:
At least, this worked for me.
Comment #5
lavino commentedI just tried with tcpdf and I added a line:
p style="page-break-before: always" (wrap them in bigger smaller signs of course..)
I got the page break in the pdf output. So I don't why everyone said it is not possible in tcpdf?
Comment #6
jcnventuraBecause you're using a version of TCPDF that evolved a lot since 18 months ago.
Comment #7
eme commentedstyle="page-break-before: always" works as well with dompdf (no need for inline PHP).
Comment #8
argiepiano commentedI have a View of nodes. I want to print each node in a separate page. I'm using TCPDF. I have not been able to figure out how to add a page break of the type #5 above mentioned. I added a Global: Custom Text field as the last field in the View Fields list, but this is not working. Any help will be appreciated. Thanks!
EDIT: I found a solution - Rather than using an inline style definition inside the html tag (which gets filtered out by Views' Global: Custom Text field), I used the option "Create a CSS class" in "Style Setting" for the Custom Text field. I created a new CSS class that included 'page-break-before: always;' in the print.css file. NB: use the print.css file inside /sites/all/modules/print/css/ folder.