How to set orientation = landscape using KnpSnappyBundle?

I am using Snappy Bundle with Symfony 2.1.

I have a question that I did not find in the documentation of this package:

  • How to set the orientation?
  • Is there a way to display page numbers?

Here is my config.yml for the package:

knp_snappy: pdf: enabled: true binary: /home/wkhtmltopdf-i386 options: [] 

Here is one of my controllers for creating 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"')); } 

Many thanks for your help!

+7
source share
1 answer
 $pdf = $this->get('knp_snappy.pdf')->getOutputFromHtml($html, array('orientation'=>'Landscape', 'default-header'=>true)); 
+15
source

All Articles