I have a carnation of eZpdf running that generates pdf certificates which then get pushed to the browser to download. These work around 1 in 3 times but every other time it builds the pdf, shows me the download box to save the file, appears in my download manager then just stalls before eventually failing.
I'm thinking it may be a php memory issue or timeout issue but very odd that it would work once for the exact same set of data then fail.
this is basically what I have
set_time_limit(1800);
$pdfPassword = 'asdasda';
//choose bg image based on choice
switch($_POST['certificateType']){
case 1:
$pdf = new backgroundPDF('a4', 'portrait', 'image', array('img' => BASEURL.'/common/pdf/images/uno.png'));
break;
case 2:
$pdf = new backgroundPDF('a4', 'portrait', 'image', array('img' => BASEURL.'/common/pdf/images/dos.png'));
break;
case 3:
$pdf = new backgroundPDF('a4', 'portrait', 'image', array('img' => BASEURL.'/common/pdf/images/tres.png'));
break;
}
$pdf->ezSetMargins(50,70,50,50);
$pdf->selectFont(BASEURL.'/common/pdf/fonts/Helvetica.afm');
$pdf->setColor(0/255,0/255,0/255);
//build strings
$commDate = friendlyDateOnly($info['Commisioned_Date_DT']);
//get logo
if($supplier['logo'] != ''){
$logo = BASEURL.'/uploads/logos/'.$supplier['logo'];
}else{
$logo = BASEURL.'/uploads/logos/SSAIB.png';
}
/* THIS IS FOR CERTIFICATE 1 */
//certificate info
$pdf->addText(144,692,14,$info['Scope_CH']);
$pdf->addText(144,663,14,$info['Certificate_Number']);
//customer info
$pdf->addText(225,591,9,$info['Customer_Name']);
$pdf->addText(225,571,9,$info['Address_1_VC']);
$pdf->addText(225,559,9,$info['Address_2_VC']);
$pdf->addText(225,547,9,$info['Address_2a_VC']);
$pdf->addText(225,535,9,$info['Address_3_VC']);
$pdf->addText(225,516,9,$info['Telephone_Number_VC']);
$pdf->addText(225,493,9,$info['Installers_Reference_VC']);
$pdf->addText(225,472,9,$commDate);
//$pdf->ezText($address, 9, 225,527);
//system info
$pdf->addText(225,404,9,$info['Extended_Grade']);
$pdf->addText(225,383,9,$info['Extended_Notification_Option']);
if($info['Extended_ARC'] != ''){
$pdf->addText(225,362,9,$info['Extended_ARC']);
}
$pdf->addText(225,339,9,$info['Installed_To_Standards_VC']);
//Installers info
$pdf->addText(215,300,10,$_SESSION['user']['Trading_Name_VC']);
$pdf->addText(215,285,9,$supplier['Address_1']);
$pdf->addText(215,273,9,$supplier['Address_2']);
$pdf->addText(215,261,9,$supplier['Town']);
$pdf->addText(215,249,9,$supplier['County']);
$pdf->addText(215,237,9,$supplier['Post_Code']);
$pdf->addText(215,223,9,"Tel: ".$supplier['Telephone']);
$pdf->addText(120,176,9,friendlyDateOnly($info['Issue_Date']));
//add logo
if(strstr($logo, '.png')){
$pdf->addPngFromFile($logo,430,740,90,90);
}else{
$pdf->addJpegFromFile($logo,430,740,90,90);
}
$pdf->setEncryption('',$pdfPassword,array('print'));
#create the pdf and stream it to the page
$pdf->ezStream();
When the download eventually times out I get the following error message
/Users/matt/Downloads/saz3CwFa.pdf.part could not be saved, because the source file could not be read.