我正在将Snappy Bundle和Symfony 2.1一起使用。
我有一些问题未在此捆绑包的文档中找到:
这是我的捆绑包的config.yml:
knp_snappy:
pdf:
enabled: true
binary: /home/wkhtmltopdf-i386
options: []
这是我的 Controller 之一,用于生成pdf:
public function exampleAction() {
$html = $this->renderView('MyBundle:Example:test.pdf.twig', $this->param);
return new Response($this->get('knp_snappy.pdf')->getOutputFromHtml($html),200, array(
'Content-Type' => 'application/pdf',
'Content-Disposition' => 'attachment; filename="Test.pdf"'));
}
非常感谢你的帮助!
最佳答案
$pdf = $this->get('knp_snappy.pdf')->getOutputFromHtml($html,
array('orientation'=>'Landscape',
'default-header'=>true));
关于symfony - 如何使用KnpSnappyBundle设置方向=横向?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13294053/