Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reduce PDF filesize

I got alot of PDF files and some of them are quite large..

I got two alternatives

  1. remove images and remove embedded fonts
  2. compress images

Is it possible to remove all objects like images/fonts in a PDF (PHP lib or command-line tool)?

Or if I want to compress images in the PDF, which PHP library do you recommend (or command-line tool)?

Debian/PHP

like image 707
clarkk Avatar asked Nov 13 '22 06:11

clarkk


1 Answers

pdftk is the way to go IMO.

It can uncompress and compress the textual part of the PDF. Further you can use it in a script to extract all the images, compress them with some other tool and then put them back into your original document.

I'm not sure whether it can remove embedded fonts.

HTH

like image 148
Daniele Avatar answered Nov 16 '22 03:11

Daniele