theJohn
theJohn

Reputation: 89

ANy way to remove blank pages generated by MPDF

How do we get the blank page(s) generated by MPDF. I use the following codes to delete an extra blank page at the end of the document. But this code will not work if the MPDF generates two or more blank pages at the end.

$blankpage = $mpdf->page + 1;
$mpdf->DeletePages($blankpage);
$mpdf->Output("file.pdf", 'I');

The code isn't a solution if the generated pdf is one page only. So the best approach would be to get the number of blank pages. I don't know how to get the blank page even after googling and looking through the pages of the documentation in Github. Please help.

Note: The method DeletePages() method is also undocumented. I found it on someone's comment. Using the pagebreak produces blank page. But I need to use pagebreak in my document.

Upvotes: 3

Views: 5824

Answers (2)

Denis Matafonov
Denis Matafonov

Reputation: 2802

I don't know how to get the blank page even after googling and looking through the pages of the documentation in Github.

You can easily add as many blankpages as you want by adding tag <pagebreak> to your source html

Upvotes: 0

GavinBrelstaff
GavinBrelstaff

Reputation: 3069

This is a documented behaviour of mPDF. The suggested solution is to increase the value of pcre.backtrack_limit at runtime.

Upvotes: 1

Related Questions