Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Any recommendations for a desktop/cli PDF optimization tool that will reduce the size of a pdf? I've tried few and the best one so far is the one that is included in the subscription version of Adobe Acrobat. But I only need it occasionally and is not worth paying $20/month sub.


I recently found out Mac's built in Preview app can do this. Go to export then change the Quartz Filter to "Reduce File Size"



If you're on a Mac, (my) PdfCompress is fairly smart about doing a good job.

Haven't updated it in while though... :-/


Did you already give ghostscript a try?


Ghostscript maybe? Depends on what you’re doing but it can downsample images etc.


Yes, its mainly to reduce image size for scanned documents. I'll give Ghostscript a try.


Something like this is probably a good starting point:

    ghostscript -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
From this gist https://gist.github.com/guifromrio/6390547#


Very helpful tip. Thank you! - Ran it through GS and I got 30% reduction in a 50mb pdf file. I think if I play around with some options - such as converting images to grayscale, I might be able to reduce it by another 10-20%.


I guess it depends on your document, but I'm surprised you only get that much compression. For scanned to pdf documents I often get orders of magnitude.

I'm not at my computer, but try messing with the `/printer` in the above command, there are other options, (possibly `/ebook`?) that control the compression ratio from memory.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: