How can I resize an image from an existing PDF file in Node.js?

1.1k Views Asked by At

I have a PDF file that has an image and some text. I want to read that file and then resize the image, and delete the text.

I tried taking a screenshot of the whole PDF with pdf-poppler and then do some image processing with Jimp, it worked but the program is taking too long to finish executing because the images are quite big.

2

There are 2 best solutions below

1
KR1470R On

Adnane, you can try to use pdf-lib.

0
jsfan On

I don't use Node.js but the Poppler library comes with a binary pdftoimages which extracts all images from a PDF and there is a Node.js wrapper for Poppler.