Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Anyway to optimize pdf programmatically?

I would like to programmatically optimize (i.e. "Save As Reduced Size PDF" in Acrobat Pro 10) a series of PDF files. I would prefer to do this from python 2.7.5 if possible, if not from python then perhaps VBA Word, and my last preference would be to do this from another programming mechanism.

Ideas?

like image 898
user12059 Avatar asked Feb 15 '26 08:02

user12059


1 Answers

A suggestion would be to look at pdfsizeopt.

The Python program is meant to act as a PDF file size optimizer. It can be used to convert larger pdfs to smaller ones and supports a commandline interface that you could call.

Details:

pdfsizeopt is a program for converting large PDF files to small ones. More specifically, pdfsizeopt is a free, cross-platform command-line application (for Linux, Mac OS X, Windows and Unix) and a collection of best practices to optimize the size of PDF files, with focus on PDFs created from TeX and LaTeX documents. pdfsizeopt is written in Python, so it is a bit slow, but it offloads some of the heavy work to its faster (C, C++ and Java) dependencies. pdfsizeopt was developed on a Linux system, and it depends on existing tools such as Python 2.4, Ghostscript 8.50, jbig2enc (optional), sam2p, pngtopnm, pngout (optional), and the Multivalent PDF compressor (optional) written in Java.

Reference:

http://code.google.com/p/pdfsizeopt/

like image 100
DanGar Avatar answered Feb 19 '26 01:02

DanGar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!