I'm using Snappy Bundle along with Symfony 2.1.
I have some question I did not find in the documentation of this bundle :
Here is my config.yml for the bundle :
knp_snappy:
pdf:
enabled: true
binary: /home/wkhtmltopdf-i386
options: []
Here is one of my Controller to generate a 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"'));
}
Thanks a lot for your help!
$pdf = $this->get('knp_snappy.pdf')->getOutputFromHtml($html,
array('orientation'=>'Landscape',
'default-header'=>true));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With