Using ImageMagick or Ghostscript (or something) to scale PDF to fit page?

ceejayoz picture ceejayoz · Feb 13, 2009 · Viewed 23.6k times · Source

I've been bashing my head against this to no avail.

I need to shrink some large PDFs to print on an 8.5x11 inch (standard letter) page. Can ImageMagick/Ghostscript handle this sort of thing, or am I having so much trouble because I'm using the wrong tool for the job?

Just relying on the 'shrink to page' option in client-side print dialogs is not an option, as we'd like for this to be easy-to-use for the end users.

Answer

Kurt Pfeifle picture Kurt Pfeifle · Aug 9, 2010

I would not use convert. It uses Ghostscript in the background, but is much slower. I'd use Ghostscript directly, since it gives me much more direct control (and also some control over settings which are much more difficult to achieve with convert). And for convert to work for PDF-to-PDF conversion you'll have Ghostscript installed anyway:

  gs \
    -o /path/to/resized.pdf \
    -sDEVICE=pdfwrite \
    -dPDFFitPage \
    -r300x300 \
    -g2550x3300 \
    /path/to/original.pdf