我在CakePhp中使用基于TCPDF的html2pdf来在PDF中呈现Views。然而,有时生成挂起,我的意思是浏览器冻结,永远不会接收数据。
有一种方法可以调试这种行为吗?在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');html在print_s_template.ctp中。
发布于 2014-09-10 21:04:25
我自己找到了一个解决方案。问题是我忘了把一些变量传递给视图$view。我认为cake抛出了一个错误,接下来,html2pdf不能“呈现”。所以:仔细检查视图中的所有变量是否都存在!
https://stackoverflow.com/questions/25765467
复制相似问题