Tuesday, February 5, 2008

gs saved the day again !

Some time ago, I was delighted at the power of Ghostscript. Well, it saved the day again, with an article that didn't want to get printed. Quite naively, I always thought that doing first pdf2ps (or pdftops, based on Xpdf, that often produces smaller and nicer postscript) and then ps2pdf was a good way to deal with unfriendly PDF files. But, in real, nothing is better than working without intermediates. The following produces a pretty neat PDF file:

gs -sOutputFile=output.pdf -sDEVICE=pdfwrite \
  -dCompatibilityLevel=1.4 input.pdf < /dev/null

As side benefits, as this command also embeds postscript fonts, the output looks better in xpdf, and it is decently smaller !

1 comment:

choffee said...

Thanks for that, now I have a simple script for reading my phone bill!

Adding a -dNOPAUSE stops it promoting at the end of each page too.