q0re
q0re

Reputation: 1359

html2pdf issue with page break (new page)

i have a problem with creating a page break in a loop using html2pdf v4.03.

I have tried:

$pdf = new HTML2PDF('P', 'A4', 'de', true, 'UTF-8');
$output = "";     
for (...) {
$output = '<div style="page-break-after: always;">' . $i . '</div>';
}
$pdf->WriteHTML($output);
$pdf->Output('file.pdf', "D");

And also:

$pdf = new HTML2PDF('P', 'A4', 'de', true, 'UTF-8');
$output = "";     
for (...) {
$output = '<div>' . $i . '</div><!--NewPage-->';
}
$pdf->WriteHTML($output);
$pdf->Output('file.pdf', "D");

I also tried:

<pagebreak/>
<?page-break>

(i found this here: here)


No solution is working. Has anyone a idea how it can be done?

Upvotes: 1

Views: 7520

Answers (1)

David C
David C

Reputation: 132

You can create an unlimited number of new pages.

In this instance:

for (...) {
$output = '<page>' . $i . '</page>';
}

That should do the trick.

Upvotes: 3

Related Questions