How to set page sizing of pdf with Knp Snappy bundle

  knp-snappy, pdf, php, symfony, symfony-2.8

I have a code which use to work to generate PDF with the KNP Snappy bundlde with Symfony2. This is what it looks like:

     $this->container->get('knp_snappy.pdf')->generateFromHtml(
          $this->templating->render(
             $twigInclude,
             array( ,
                 'htmlFiles' => $htmlFiles,
                 'headlines' => $headlines,
             )
         ),
         $folderHistory . '/reports/' . $filename . '.pdf'
     );

My issue is that, I want to set margins and change page size from A4 to A1. I have found so many examples but everytime I try, it seems like the pdf does not generate anymore. How can I solve this issue and make that work.

Thanks in advance for your help.

Source: Ask PHP

LEAVE A COMMENT