Friends, whenever I'm trying to export a PDF using Headless chrome and Node, paths specified in the chromeBinary and nodeBinary parameters, it causes PHP-Puppetteer to emulate a browser screen ( `
emulateScreenMedia=true `
) .
I commented out the line await page.emulateMedia('screen');
(php-puppeteer/src/js/puppetteer-api.js, line 29) and it renders like printed paper, which is what I need.
It would be nice to add a parameter to determine whether PDFs should print as paper or screen.
My code:
`
$report->pdf([
"format"=>"A4",
"orientation"=>"portrait",
'chromeBinary'=>realpath(dirname(__FILE__)) . "/../../../node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome",
'nodeBinary'=>'/usr/bin/nodejs',
])->saveAs($file);
`
Result, stock - page breaks anywhere, no repetition of headers afterwards:
After commenting this line:
It shows as expected: page breaks don't split up cells and the headers show with every page start:
I can, of course, just comment and leave as is, but then every update to the Koolreport code would be a nightmare.
A configurable option to set params.emulateScreenMedia
would be a neater path.
Thanks, Daniel