I use the PdfBundle (PHPPdf) in Symfony2 and create the PDF using twig like this:
<pdf>
<dynamic-page>
<placeholders>
<footer>
<div height="50px" width="100%">
<page-info font-size="9" font-type="helvetica" format="Page %s of %s" />
</div>
</footer>
</placeholders>
<div>
Some written text in the first page
</div>
<!-- Here I want to start always a second page -->
<div>
Some written text on the second page
</div>
</dynamic-page>
</pdf>
I want that the second text is always on a new page, but the numbering in the footer must continue. When I start a new dynamic-page, there is a new page, but the numbering of the sites is gone.
I found out the solution. I misunderstood the information and thought page-break
is a attribute, but it is a tag. So I must only set <page-break />
at the position I want to break the page.
<pdf>
<dynamic-page>
<placeholders>
<footer>
<div height="50px" width="100%">
<page-info font-size="9" font-type="helvetica" format="Page %s of %s" />
</div>
</footer>
</placeholders>
<div>
Some written text in the first page
</div>
<page-break />
<div>
Some written text on the second page
</div>
</dynamic-page>
</pdf>
It is also important that the <page-break />
is a direct children of the <dynamic-page>
. It can't be in a div or table. They must be closed to set a page break.