Manual Page Break in TCPDF

Viewed 82731

I am using TCPDF to generate the PDF in one of my projects. I simply create a HTML file and give it to the TCPDF to handle the PDF generation. But now I have some HTML where multiple certificates are added one after the other and I want to have a page break in it. Page Break should be decided by HTML i.e. I want to know if there is any identifier in HTML which TCPDF understands and then accordingly adds a page break into the generated PDF.

How could I do this?

9 Answers

For someone who still has the same problem with page-break TCPDF library

You can use <div style="page-break-before:always"></div> OR <br pagebreak="true"/> to break page manually in your HTML content.

Use $tcpdf->AddPage() to break page manually in your code.

When you set SetAutoPageBreak(TRUE, 10); that means: when the height of document reach to (bottom - 10) then move the cursor to new page. So if you want to have more space, just reduce the number into 0. It will draw until the end of the document without any margin from bottom.

Remember that TCPDF only accept the double quote (") for attributes of tags. Don't use single quote (') for your tag.

<div style='page-break-before:always' => WRONG

<div style="page-break-before:always" => RIGHT

It takes 8 hours from me because this issue :(

Related