Rev*_*air 7 wkhtmltopdf symfony
我正在使用Snappy Bundle和Symfony 2.1.
我有一些问题,我在这个包的文档中没有找到:
这是我的bundle的config.yml:
knp_snappy:
pdf:
enabled: true
binary: /home/wkhtmltopdf-i386
options: []
Run Code Online (Sandbox Code Playgroud)
这是我的一个生成pdf的Controller:
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"'));
}
Run Code Online (Sandbox Code Playgroud)
非常感谢你的帮助!
jam*_*s_t 20
$pdf = $this->get('knp_snappy.pdf')->getOutputFromHtml($html,
array('orientation'=>'Landscape',
'default-header'=>true));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8951 次 |
| 最近记录: |