我使用Symfony2生成带有IoTcpdfBundle的pdf文件,但有一个奇怪的行为,我不明白。生成PDF Symfony2 IoTcpdfBundle
当我在控制器上,我生成的PDF文件是这样的:
$html = $this->renderView('MyBundle:Docs:solicituddevacaciones.pdf.twig', array());
return $this->get('io_tcpdf')->quick_pdf($html);
那些行生成的PDF文件。一切正常,我可以右键点击该文件来保存它,它是一个.pdf文件。
但是,当我收到使用表单的一些数据,我把行内:
if ($request->getMethod() == 'POST') {
$year = $this->get('request')->request->get('year');
$date= $this->get('request')->request->get('date');
$html = $this->renderView('SoflaSoflaBundle:Documentales:solicituddevacaciones.pdf.twig', array());
return $this->get('io_tcpdf')->quick_pdf($html);
}
当我用鼠标右键单击该文件保存它,它不是一个.pdf文件时,浏览器提示我应该将文件保存为.htm
为什么会发生这种情况?我需要用户能够将文件保存为.pdf文件。
需要此帮助。
这是有史以来最奇怪的问题,我一直没能解决这个问题尚未... – 2012-04-03 14:44:00