Reputation: 67
I'm using MPDF to generate PDF from HTML. It works perfectly fine while I made the HTML string and pass it to the PDF generator. But I find out it's not enough. How could I change the current page to the next page. I mean in HTML string. For example, if you're making some PDF for the delivery forms on your website. You want to make every form start with a fresh new page. But the MPDF will auto paginate the HTML content which might cannot fit your need. How can I deal with this part? I'm getting confused. I try to read the source code,but the code is too much. And there's not enough comment inside. I hope there's some one who familiar with the MPDF lib. The version of MPDF which I'm using is v5.4 by the way.
Upvotes: 0
Views: 1608
Reputation: 11987
Even i had the problem of breaking the page in mpdf. For that you should use addPage()
of mpdf or <pagebreak />
$mpdf->AddPage();
or
<pagebreak />
using either of the above, you can force page breaks in mpdf, check this for more reference
Upvotes: 1
Reputation: 5598
Unclear exactly what you need, but this might get you going.
If you have a multiple forms and you want those forms to be on their own pages, you have a couple possible solutions:
You could iterate over the forms
and use $mpdf->AddPage();
at the end of each form
If you have an entire string and the forms
are all together, you could use the html tag <pagebreak />
to signal a break where you'd like.
Reference the docs for further information, if needed. Hope it helps.
Upvotes: 0