hyzyla / pdfium

Node.js wrapper for the PDFium library
https://pdfium.js.org
MIT License
22 stars 3 forks source link

50% slower than pdf2cairo. Anything tweakable? #4

Open msageryd opened 9 months ago

msageryd commented 9 months ago

Thank you soo much for your work with this. I'm regularly rendering PDF pages to jpg/png and I'm always on the hunt for better/faster/nicer tools.

The only OSS tool I have found to render consistent and nice JPG files from PDFs with vector graphics (CAD drawings) is pdf2cairo from poppler-utils.

I'm already using sharp for other tasks, so I was thrilled to find your wrapper for pdfium and that you sugges sharp as well.

Your library seems to work very well after some testing, but it is about 50% slower than pdf2cairo. Do you think that this speed difference is due to pdfium being slower than pdf2cairo or maybe pdfium does a better job with some PDFs?

hyzyla commented 9 months ago

Under the hood this library uses pdfium (developed by Chrome team) compiled to wasm. And wasm version definetly can be slower than native version. In theory pdfium should faster than poppler. Also keep in mind that this library uses blocking calls, so if you are trying concurrently test peformance, it can lead to wrong results