smalot / pdfparser

PdfParser, a standalone PHP library, provides various tools to extract data from a PDF file.
GNU Lesser General Public License v3.0
2.3k stars 534 forks source link

(Question) Replace an Image inside a PDF #689

Closed juanborras closed 3 months ago

juanborras commented 3 months ago

Hey there!

What I'm trying to achieve is the reduction of the size of the embedded images inside a PDF. Iterate on them and for each, get the image, compress/reduce quality and "put it back". Is this possible?

Thanks!

k00ni commented 3 months ago

Not to my knowledge. PDFParser only handles "parsing" jobs, it can't manipulate a PDF.

GreyWyvern commented 3 months ago

You can do this online with Adobe's Compress PDF tool: https://www.adobe.com/acrobat/online/compress-pdf.html

juanborras commented 3 months ago

You can do this online with Adobe's Compress PDF tool: https://www.adobe.com/acrobat/online/compress-pdf.html

I would like to do it inside PHP in order to automatice it

k00ni commented 3 months ago

This is out of scope of this library. You could try https://github.com/tecnickcom/TCPDF or https://manuals.setasign.com/.