Quick installation instructions
To quickly install pdfsizeopt on Windows, see InstallationInstructionWindows.
To quickly install pdfsizeopt on Linux or FreeBSD, see InstallationInstructionLinux.
Slow installation
The remaining part of this page applies to Unix systems (e.g. Linux and Mac OS X).
Please note that not all the software mentioned in the instructions below is free software (if we consider freedom). Details:
- pdfsizeopt: free
- Python: free
- Ghostscript: free version available
- Java: free version available (OpenJDK)
- sam2p: free
- jbig2: free (http://github.com/agl/jbig2enc/tree/master)
- png22pnm: free (http://sam2p.googlecode.com/files/tif22pnm-0.12.tar.gz)
- pngtopnm: free (this is an replacement if you can't install png22pnm)
- Multivalent.jar containing tool.pdf.Compress: not free software, don't use it if you don't have a license
- PNGOUT: not free software, but you don't have to pay for using it, and you can download it from the official web site without having to pay
Necessary:
- A Unix system is needed, Linux is recommended, but it is reported to work on the Mac OS X as well. The following instructions have been tested on Debian Etch, Ubuntu Hardy and Ubuntu Lucid. See also InstallationInstructionWindows for Windows (Win32).
- Install Python 2.4, Python 2.5, Python 2.6 or Python 2.7 from package. Earlier or later versions won't work.
- Install Ghostscript 8.61 or later (tested and found working with 8.61, 8.62, 8.63, 8.64, 8.71 and 9.06). Earlier versions won't work (You may try pdfsizeopt with Ghostscript 8.54 as well, but 8.54 has some known font conversion problems, so it will produce an error for some PDF files.) Make sure the command gs is on your $PATH.
- Create a directory named pdfsizeopt.
- Check out the source code at http://code.google.com/p/pdfsizeopt/source/checkout , or just download http://pdfsizeopt.googlecode.com/git/pdfsizeopt.py as pdfsizeopt/pdfsizeopt.py.
- Install a recent sam2p and copy the binary to pdfsizeopt/sam2p. For Linux, the recommended binary is http://pdfsizeopt.googlecode.com/files/sam2p . For Mac OS X, the recommended binary is http://pdfsizeopt.googlecode.com/files/sam2p-darwin . Rename the downloaded file to sam2p, and move it to pdfsizeopt/sam2p. Please note that the sam2p in Ubuntu Intrepid and Debian Etch is too old. Either compile it yourself, or use the recommended download above.
- Install png22pnm and copy the binary to pdfsizeopt/png22pnm. (As a replacement, you can install pngtopnm instead from package. But please try installing png22pnm first, because sam2p works better with it.) For Linux, the recommended binary is http://pdfsizeopt.googlecode.com/files/png22pnm . For Mac OS X, the recommended binary is http://pdfsizeopt.googlecode.com/files/png22pnm-darwin . Rename the downloaded file to png22pnm, and move it to pdfsizeopt/png22pnm.
Optional, but strongly recommended:
- Download the official pdfsizeopt jbig2 binary (works on x86 and amd64, Linux version: http://pdfsizeopt.googlecode.com/files/jbig2.linux , Mac OS X version: http://pdfsizeopt.googlecode.com/files/jbig2.darwin) to pdfsizeopt/jbig2, or compile jbig2 for yourself.
Optional for Multivalent.jar (if in doubt, don't use it):
- Install Java 1.5 or newer from package. javac is not necessary. Sun's Java and OpenJDK are OK, gcj and gij and avian won't work. Make sure that java -version works and prints something at least 1.5.
- If you have a copy of Multivalent*.jar (e.g. Multivalent20060102.jar), and you have a license to use it, then copy it to pdfsizeopt/Multivalent.jar.
Optional, but recommended:
- Download the PNGOUT binary for your system. Recommended for Linux: the http://static.jonof.id.au/dl/kenutils/pngout-20070430-linux-static.tar.gz archive on http://www.jonof.id.au/kenutils . For other PNGOUT downloads, visit http://advsys.net/ken/utils.htm . Copy the file pngout-*-linux-static to pdfsizeopt/pngout.
Try it:
- Create a file test.pdf, and run pdfsizeopt.py --use-pngout=true --use-jbig2=true --use-multivalent=false test.pdf. The output file will be test.pso.pdf.
- If you haven't installed some of the tools above, try changing =true to =false in the command line.
> Multivalent.jar: not free software, but you don't have to pay for using it, and you can download it from the official web site without having to pay
Hi - it looks like Multivalent is GPL to me: http://multivalent.sourceforge.net/license.html
I have a question: why does Multivalent20060102.jar work but Multivalent20091027.jar does not?
Also: from http://www.jonof.id.au/kenutils one can download the OSX version of PNGOUT as well, and it seems to work nicely (under Mountain Lion) - you may want to update your installation instructions to reflect this.
I generate scores of very complex TiKz? graphics directly as pdf using a separate Xe(La)TeX or pdfLaTeX file, and use a script to extract the figures, crop them, and then include these individual files in a longer book with \includegraphics. By means of this compilation time decreases immensely. But of course I get duplicate fonts, like these:
DFLHBQ+Georgia CID TrueType? Identity-H yes yes yes 346 0 CXYKIL+XITSMath-Identity-H CID Type 0C Identity-H yes yes yes 347 0 DFLHBQ+Georgia CID TrueType? Identity-H yes yes yes 380 0 CXYKIL+XITSMath-Identity-H CID Type 0C Identity-H yes yes yes 381 0 DFLHBQ+Georgia CID TrueType? Identity-H yes yes yes 412 0 CXYKIL+XITSMath-Identity-H CID Type 0C Identity-H yes yes yes 413 0 DFLHBQ+Georgia CID TrueType? Identity-H yes yes yes 439 0 CXYKIL+XITSMath-Identity-H CID Type 0C Identity-H yes yes yes 440 0
DOZENS of times - of course. pdfsizeopt does an amazing job of merging them and the size of the file decreases immensely: these two fonts (i.e. the fonts with exactly these names, including the "mangled" prefix) appear only once in the reduced file. KUDOS!
However, since the name of the font is different in the master file, an entry like
WMZZVT+Georgia CID TrueType? Identity-H yes yes yes 3 0
remains. So Georgia is now included twice (instead of twentyone times). Would it possible to ad an option to merge fonts that have the same "six uppercase letters and a plus" prefix Of course only if the encoding is the same and a t the user's risk.
Roberto
@roberto.avanzi: Please report this in the bug tracker.