I am using FPDF (1.7) to convert a TXT file into PDF. I would like to force a page break in the PDF product. The text file is created using php, and successfully uses carr
Here's an idea: Edit: complete code
<?php
require('fpdf.php');
$pdf = new FPDF('P','mm','A5');
$pdf->AddPage('P');
$pdf->SetDisplayMode(real,'default');
$pdf->SetFont('Arial','',10);
$txt = file_get_contents('comments.txt', true);
$pages = explode('~', $txt);
foreach ($pages as $page) {
$pdf->Write(8, $page);
$pdf->AddPage();
}
$pdf->Output();
?>
Brief explanation in case not clear: Splits the text up into 'pages' and writes each of them with a page break in between.
Possible bugs: adding extra page at the end. Solution: iterate with for loop instead of foreach and stop one page short.
Another possible bug: won't be able to ever use tilde again. (Bad) solution: use a more complex string to signify a page break.