HTML2PDF在yii中不能正常工作

时间:2012-08-27 11:41:11

标签: php yii html2pdf

我在我的网站中使用了HTML2PDF,这是在YII框架中开发的。它工作正常我们的服务器。当我在客户端服务器中移动这些代码时,它将无法工作。页面花了很长时间加载,最后显示为超时错误。

我检查了fwrite函数,也可以正常工作。但PDF不会。问题是什么?。

$fp = fopen('media/files/test1.txt', 'w');
        fwrite($fp, 'BINGO COUPON');
        fwrite($fp, '123456789');
        fclose($fp);

test1.file在指定路径中成功创建。

$pdffile = 'media/files/bingo_rr.pdf';

try
    {   
                    $html2pdf = Yii::app()->ePdf->HTML2PDF('L', 'A4', 'en', true, 'UTF-8', 0);      
            $html2pdf->pdf->IncludeJS("print(true);");
            $html2pdf->WriteHTML($this->renderPartial('printcouponpdf', array( 'couponlist' => @$couponlist, 'coupon_details' => $coupon_model_details), true));
            $html2pdf->Output($pdffile, 'F');
    }    
                        catch(HTML2PDF_exception $e) {
        echo $e;
        exit;
    }

html2pdf库包含在main.php中

'ePdf' => array(
        'class'         => 'ext.yii-pdf.EYiiPdf',
        'params'        => array(              
            'HTML2PDF' => array(
                'librarySourcePath' => 'application.vendor.html2pdf.*',
                'classFile'         => 'html2pdf.class.php', // For adding to Yii::$classMap                
            )
        ),
    )

但未创建PDF文件。

0 个答案:

没有答案
相关问题