So I'm creating a multiple page PDF with FPDI and I've encountered a problem when downloading and opening the PDF it creates. It displays and prints fine when viewing in Chrome or Firefox via their built in plug-ins. However in Adobe Reader or in IE it shows an error "There was a problem on this page" when I scroll down the pages.
I'm using FPDI to set a source file and the weird thing is that this displays fine. In this example I have 55 pages. It shows 55 pages with the source file I set but only the first page has the text I have set to PDF. The rest of the pages are just the source file. I'm guessing I am missing something that Adobe Reader doesn't like but I'm not sure what it is exactly!
require_once('/data/functions/pdfs/fpdf/fpdf.php');
require_once('/data/functions/pdfs/fpdi/fpdi.php');
require_once('rotate.php');
$pdf=new PDF();
$pagecount = $pdf->setSourceFile('EIBTM14_Exhibitor_Badge.pdf');
for($i = 0; $i < $num_badges; $i++)
{
//Create Page
$thePage = $pdf->importPage(1, '/MediaBox');
$pdf->addPage();
$pdf->useTemplate($thePage,0,0,0,false);
//Content of each page
$pdf->SetXY(141,197);
$pdf->Rotate(90);
$pdf->SetFont('Arial','',fontsize($company));
$pdf->Cell(-100,13,mb_strtoupper($company),$borders,1,"C");
}
I've not attached all my code because content I've added is pretty much the same block of code just outputting a different field each time. I think the problem lies in the Create Page section but I'm not quite sure! I did try setting the ImportPage(1 to ImportPage($+1 but this gives me a FPDF error that the PageNumber is wrong
Thanks for your time and any help in advance
Jack