Skip to content

PDF MANIPULATION

Here are some simple CLI methods for manipulating PDF documents.

MERGING

    pdfunite input1.pdf input2.pdf input3.pdf output.pdf

RECOMPRESSING

There are 3 good ways to recompress

  1. Ghostscript (my personal choice, hence why its #1)

    Here is a list of the PDFSETTINGS/ parameter options. I prefer ebook for text only documents.

    • screen -- lowest quality, smallest size
    • ebook -- better quality, average size
    • prepress -- similar to Adobe Acrobat Distiller "Prepress Optimized" setting
    • printer -- similar to Adobe Acrobat Distiller "Print Optimized" setting
    • default -- a very generic setting. Try first and see how the quality and size are.

      gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

  2. ps2pdf

    ps2pdf input.pdf output.pdf
    
  3. convert

    convert -density 200x200 -quality 60 -compress jpeg input.pdf output.pdf