eZpdf pdf下载失败2次3次,相同的数据,相同的pdf,但下载时停止

时间:2012-08-09 08:51:43

标签: php pdf pdf-generation

我有运行eZpdf的康乃馨,它会生成pdf证书,然后推送到浏览器下载。这些工作大约有1到3次,但每次都会构建pdf,向我显示保存文件的下载框,出现在我的下载管理器中,然后在最终失败之前停止。

我认为它可能是一个php内存问题或超时问题,但很奇怪,它会对完全相同的数据集合工作一次然后失败。

这基本上就是我所拥有的

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();

当下载最终超时时,我收到以下错误消息

/Users/matt/Downloads/saz3CwFa.pdf.part could not be saved, because the source file could not be read.

1 个答案:

答案 0 :(得分:0)

我有一个巨大的错误日志,只是清空重启服务器,似乎没问题。将通过

进行监控