Closed. This question does not meet Stack Overflow guidelines。它当前不接受答案。
想改善这个问题吗?更新问题,以使为on-topic。
3年前关闭。
Improve this question
我正在寻找一个易于使用且不需要
我已经尝试过
我还查看了
我也尝试过
尽管
任何建议(或关于如何使任何提到的捆绑包工作的建议)将不胜感激。
它为我工作!
想改善这个问题吗?更新问题,以使为on-topic。
3年前关闭。
Improve this question
我正在寻找一个易于使用且不需要
wkhtmltopdf
的PDF生成器包,因为我的共享托管服务器不支持此功能。我已经尝试过
https://github.com/psliwa/PdfBundle
,但是如果遵循文档,我只会在屏幕上得到一个响应(不生成PDF)。尽管对此in this question有解决方案,但此解决方案似乎过于复杂。我还查看了
ioalessio/IoTcpdfBundle
,它似乎可以直接使用,但是没有安装composer,并且我的Web服务器不支持供应商安装。我也尝试过
stedekay/SpraedPDFGeneratorBundle
,但这只是抱怨找不到Java的普通错误。尽管
whiteoctober/WhiteOctoberTCPDFBundle
可能可以工作,但这只是创建了一个TCPDF对象,您必须进一步使用它,并且文档内容也不是很全面。任何建议(或关于如何使任何提到的捆绑包工作的建议)将不胜感激。
最佳答案
我使用SpraedPDFGeneratorBundle,并使用Composer从https://github.com/stedekay/SpraedPDFGeneratorBundle进行安装以激活它。我在AppKernel new Spraed\PDFGeneratorBundle\SpraedPDFGeneratorBundle()
中激活了。
最后,我执行了命令php composer.phar update
,并在控制器中输入了以下代码:
$html = $this->renderView('MyappJournalBundle:Default:index1.html.twig');
$pdfGenerator = $this->get('spraed.pdf.generator');
return new Response($pdfGenerator->generatePDF($html),
200,
array(
'Content-Type' => 'application/pdf',
'Content-Disposition' => 'inline; filename="out.pdf"'
)
);
它为我工作!
07-26 01:08