DOMpdf, adding a new page to PDF

你说的曾经没有我的故事 提交于 2019-12-03 22:30:08

dompdf takes care of paging automagically. If you want to force a page break you can do so by styling an element with page-break-before: always; or page-break-after: always;.

cottton

Just an example for BrianS's answer:

CSS

.page_break { page-break-before: always; }

HTML

<div class="page_break"></div>

If the other answer doesn't work for you (as it is for me), you can add a CSS class :

.page { width: 100%; height: 100%; }

and encapsulate every "page" in an element with this class. Not the prettiest way, but it does the job.

All answers presented here will make DomPDF to add a blank page to the end of the PDF file. Here is how to fix that:

CSS:

div.page_break + div.page_break{
    page-break-before: always;
}

HTML:

<div class="page_break"></div>
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!