mvlabs/MvlabsSnappy

Options

Closed this issue · 1 comments

Hello,

I have not understand how to add options?
For example:

<?php
return array(
    'mvlabs-snappy' => array(
        'pdf' => array(
           'binary'  => '/home/root/bin/wkhtmltopdf',
           'options' => array('--no-stop-slow-scripts'),
        ),   
        'image' => array(
            'binary'  => '/home/root/bin/wkhtmltoimage',
            'options' => array(),
         )
     )   
);

Don't work...

Thanks

Hi @aurelien-w , the correct way to set options is:

<?php
return array(
    'mvlabs-snappy' => array(
        'pdf' => array(
            'binary'  => '/home/root/bin/wkhtmltopdf',
            'options' => array(
                'javascript-delay'    => 2000,
                'no-stop-slow-scripts'=> true,
                'header-line'         => true,
                'footer-right'        => 'Pag. [page]/[topage]'
            ),
        ),
        'image' => array(
            'binary'  => '/home/root/bin/wkhtmltoimage',
            'options' => array(),
        )
    )
);

Or eventually:

   public function testPdfAction() {
      // ....
       $I_mvlabssnappyPdfService = $this->serviceLocator->get('mvlabssnappy.pdf.service');
       $I_mvlabssnappyPdfService->setOption('footer-right', 'Pag. [page]/[topage]');
      // ....
   }

Hope this helps.
Cheers,
Diego