I have an input PDF file (usually, but not always generated by pdfTeX), which I want to convert to an output PDF, which is visually equivalent (no matter the resolution), it has the same metadata (Unicode text info, hyperlinks, outlines etc.), but the file size is as small as possible.
I know about the following methods:
java -cp Multivalent.jar tool.pdf.Compress input.pdf
(from http://multivalent.sourceforge.net/). This recompresses all streams, removes unused objects, unifies equivalent objects, compresses whitespace, removes default values, compresses the cross-reference table.- Recompressing suitable images with jbig2 and PNGOUT.
- Re-encoding Type1 fonts as CFF fonts.
- Unifying equivalent images.
- Unifying subsets of the same font to a bigger subset.
- Remove fillable forms.
- When distilling or otherwise converting (e.g.
gs -sDEVICE=pdfwrite
), make sure it doesn't degrade image quality, and doesn't increase (!) the image sizes.
I know about the following techniques, but they don't apply in my case, since I already have a PDF:
- Use smaller and/or less fonts.
- Use vector images instead bitmap images.
Do you have any other ideas how to optimize PDF?