Symfony 2.1 と共に Snappy Bundle を使用しています。
このバンドルのドキュメントで見つけられなかった質問があります:
- 向きを設定するには?
- ページ番号を表示する方法はありますか?
バンドルの config.yml は次のとおりです。
knp_snappy:
pdf:
enabled: true
binary: /home/wkhtmltopdf-i386
options: []
これは、pdfを生成するための私のコントローラの1つです:
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"'));
}
助けてくれてどうもありがとう!