2014-09-10 22 views
1

我使用html2pdf(基於TCPDF)在CakePhp中呈現ViewsPDF。 但是,有時這代人掛起,我的意思是瀏覽器凍結,從不接收數據。Html轉換爲CakePhp中的PDF使用html2pdf掛起

有一種方法可以調試這種行爲嗎?在apache日誌我沒有看到任何類型的錯誤...

$this->set(compact('quotation','company','user')); 
$view = new View(null, false); 
$view->set(compact('quotation','company','user')); 
$view->viewPath = 'Quotations'; 
$view->layout = 'preventivo'; 
if ($quotation['Quotation']['quotation_type'] == SERVICE) 
{ 
    $content = $view->render('print_s_template'); 
    $this->set(compact('content')); 
    $this->response->type('pdf'); 
    $this->render('print'); 

print.ctp具有

App::import('Vendor', 'HTML2PDF', array('file' => 'html2pdf'.DS.'html2pdf.class.php')); 

$html2pdf = new HTML2PDF('P','A4','it'); 
$html2pdf->WriteHTML($content); 
$html2pdf->Output('exemple.pdf'); 

htmlprint_s_template.ctp

+0

檢查應用程序日誌文件。猜猜這是用完了內存的php。 – burzum 2014-09-10 12:38:19

回答

2

我自己找到了解決方案。問題是我忘了將一些變量傳遞給View $view。我想蛋糕會拋出一個錯誤,接下來,html2pdf不能「渲染」。 因此:仔細檢查視圖中的所有變量是否存在!