Working with PDF files

Ghostscript

Reduce the size of a scanned PDF, the value for "quality" option can be: screen,ebook,printer,prepress

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

Merge multiple PDF files:

gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE={output.pdf} -dBATCH {input1.pdf} {input2.pdf}

Remove password:

gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile={output.pdf}-f {input.pdf}

pdfseparate

Extract pages from a PDF file:

pdfseparate -f {first page} -l {last page} {input.pdf} {output.pdf}

pdftoppm

Convert a PDF file to images; define horizontal and vertical DPI to generate the images, 150 is a common value.

pdftoppm {input.pdf} {output prefix} -png -rx {horizontal dpi} -ry {vertical dpi}

Tags pdf linux

Back