phpwordpresspdffpdf

FPDF error: The document is closed in


I am generating pdf file using below code but it give me error in log file that

FPDF error: The document is closed

$pdf = new FPDF('P', 'pt', 'Letter');
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$filename=$upload_dir["basedir"].'/borrowers/borrower'.$page->id.'.pdf';
$pdf->Cell(40,10,'fdfd');
$pdf->Output('F',$filename);

However file is being generated in the destination path but script execution stopped further.


Solution

  • $this->state value need to be increased in fpdf.php as by default it is 3 which seems to be low in case document contains more than 2 pages.