marcbachmann / node-html-pdf

This repo isn't maintained anymore as phantomjs got dreprecated a long time ago. Please migrate to headless chrome/puppeteer.
MIT License
3.56k stars 545 forks source link

Unable to create pdf #646

Open ghost opened 2 years ago

ghost commented 2 years ago

I am using Docker base image mhart/alpine-node. PDF creation fails with below exception

Error: spawn ./node_modules/phantomjs-prebuilt/bin/phantomjs ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
    at onErrorNT (node:internal/child_process:477:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
Prasundas99 commented 2 years ago

Seems like you need to install phantonjs

sudo apt-get install phantomjs

ghost commented 2 years ago

@Prasundas99 i found multiple issue whan i install phantomjs manually.

It is working as expected in my windows 10 OS.

Prasundas99 commented 2 years ago

I had used the previous version I worked perfectly fine. Maybe something has broken with the update

inthegarage commented 2 years ago

@Prasundas99 i found multiple issue whan i install phantomjs manually.

* Text is not  rendering

* Table size increased a lot

It is working as expected in my windows 10 OS.

That is almost certainly FONT_CONFIG path and the related libraries. Take a look at this post, which hopefully covers the topic for you: https://github.com/marcbachmann/node-html-pdf/issues/547

xxdannilinxx commented 2 years ago

The pdf generator packages are deprecated and don't work on aws lambdas, just this new package I found.

https://www.npmjs.com/package/html-pdf-lambda