KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Headless Chrome with node - footerTemplate #1463

Open EGROW SOLUTIONS, LLC opened this topic on on May 29, 2020 - 3 comments

EGROW SOLUTIONS, LLC commented on May 29, 2020

Hello,

I am using the following to generate the pdf - it generates an error Failed to generate PDFNULL Fatal error: Uncaught Error: Call to a member function toBrowser() on null

pageMargins = array("top"=>"0.25in","bottom"=>"0.35in","left"=>"0.45in","right"=>"0.45in");
          $options = array(
            'nodeBinary'=>'C:\Program Files\nodejs\node.exe'
            //'chromeBinary' => 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'
            ,'format'=>'Letter'
            ,'orientation'=>'portrait'
            ,'landscape'=> $landscape
            ,'headerTemplate'=>''
            ,'footerTemplate'=>'<span class=pageNumber></span><span class=totalPages></span>'
            //,'noRepeatTableFooter' => true
            ,'displayHeaderFooter'=>true
            ,'margin'=>$pageMargins
          );

However if I remove the code without the footerTemplate - it works fine. footerTemplate is a valid html - is there another way?

pageMargins = array("top"=>"0.25in","bottom"=>"0.35in","left"=>"0.45in","right"=>"0.45in");
          $options = array(
            'nodeBinary'=>'C:\Program Files\nodejs\node.exe'
            //'chromeBinary' => 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'
            ,'format'=>'Letter'
            ,'orientation'=>'portrait'
            ,'landscape'=> $landscape
            ,'headerTemplate'=>''
            ,'footerTemplate'=>''
            //,'noRepeatTableFooter' => true
            ,'displayHeaderFooter'=>true
            ,'margin'=>$pageMargins
          );
KoolReport commented on May 31, 2020

I will get you an engineer to answer your question on Monday. Thank you for your patience.

David Winterburn commented on Jun 1, 2020

Hi,

The Chrome headless feature in the Export package is pretty outdated by now as we moved it to the CloudExport package for more than a year ago. I think 'footerTemplate' works fine in CloudExport. Please try it and let us how if you have any problem.

EGROW SOLUTIONS, LLC commented on Jun 1, 2020

Not the answer I was looking for, understand you have moved to CloudExport - we still want to have a fallback option. Don't quite understand why the argument is not passed correctly - it is just like any other, does the html need to be escaped or something? node and puppeteer are current using latest Chromium.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
None yet

None