spiritix/php-chrome-html2pdf

Binary error: (node:8497) UnhandledPromiseRejectionWarning

ankushkatiyar opened this issue · 1 comments

Hi , i used this demo code in our php after installation of vendor directory and i face some issue for generating pdf file of demo url

use Spiritix\Html2Pdf\Converter;
use Spiritix\Html2Pdf\Input\UrlInput;
use Spiritix\Html2Pdf\Output\DownloadOutput;

require_once 'vendor/autoload.php';

$input = new UrlInput();
$input->setUrl('https://www.google.com');

$converter = new Converter($input, new DownloadOutput());

$converter->setOption('landscape', true);

$converter->setOptions([
'printBackground' => true,
'displayHeaderFooter' => true,
'headerTemplate' => '

I am a header

',
]);

$output = $converter->convert();
$output->download('google.pdf');

error :

Spiritix\Html2Pdf\ConverterException: Binary error: (node:8497) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process! /opt/lampp/htdocs/php-puppeteer/vendor/spiritix/php-chrome-html2pdf/node_modules/puppeteer/.local-chromium/linux-756035/chrome-linux/chrome: symbol lookup error: /usr/lib/x86_64-linux-gnu/libcairo.so.2: undefined symbol: FT_Get_Var_Design_Coordinates TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md at onClose (/opt/lampp/htdocs/php-puppeteer/vendor/spiritix/php-chrome-html2pdf/node_modules/puppeteer/lib/launcher/BrowserRunner.js:159:20) at Interface. (/opt/lampp/htdocs/php-puppeteer/vendor/spiritix/php-chrome-html2pdf/node_modules/puppeteer/lib/launcher/BrowserRunner.js:149:65) at Interface.emit (events.js:327:22) at Interface.close (readline.js:424:8) at Socket.onend (readline.js:202:10) at Socket.emit (events.js:327:22) at endReadableNT (internal/streams/readable.js:1327:12) at processTicksAndRejections (internal/process/task_queues.js:80:21) (Use node --trace-warnings ... to show where the warning was created) (node:8497) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:8497) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. in /opt/lampp/htdocs/php-puppeteer/vendor/spiritix/php-chrome-html2pdf/src/Spiritix/Html2Pdf/Converter.php:188 Stack trace: #0 /opt/lampp/htdocs/php-puppeteer/app.php(23): Spiritix\Html2Pdf\Converter->convert() #1 {main}

How did you solve this ?