Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Pdfsizeopt: PDF file size optimizer (code.google.com)
2 points by imurray on June 26, 2011 | hide | past | favorite | 2 comments


I just found pdfsizeopt.py, which doesn't seem to be that well known(?). It's reduced the size of most of my PDFs.

    pdfsizeopt.py --do-unify-fonts=false --do-unify-pages=false infile.pdf
The first option is important: several of my PDFs were horribly corrupted without it. The second option prevents a (benign?) error message with some PDFs in xpdf/poppler.

Small files dominated by complicated fonts can be reduced several times. Very large PDFs with raster images can also be made much smaller, unless you obsessively squished the graphics before including them: http://homepages.inf.ed.ac.uk/imurray2/compnotes/squish_imag...


An unrelated tip for people that use TeX and want good PDFs. If you have an old .ps file with bitmap fonts from dvips, and can't recompile the .tex source, it's still possible to get a nice PDF with Type 1 fonts:

    pkfix-helper input.ps tmp.ps
    pkfix tmp.ps output.ps
output.ps will now have Type 1 fonts, and can be converted to a good PDF with ps2pdf. The pkfix-helper man page says how to check and tweak the font substitutions.




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

Search: