Shrink PDF In Linux

Here is a great reference how to compress and reduce the size of PDF files with Ghost Scrip (gs) in Linux:…

Example: "gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -sOutputFile=output.pdf input.pdf"

Fill white: convert -density 70 input.pdf -channel rgba -alpha set -fill white -opaque 'rgb(255,200,195)' -opaque 'rgb(255,253,177)' -opaque '
rgb(255,155,240)' -opaque 'rgb(255,91,193)' -colorspace gray OUTPUT-convert.pdf

Fix error: convert-im6.q16: attempt to perform an operation not allowed by the security policy `PDF' @ error/constitute.c/IsCoderAuthorized/421.

Edit: /etc/ImageMagick-7/policy.xml or -6: <policy domain="coder" rights="read | write" pattern="PDF" /> (…)

Split PDF


Example: "pdftk myoldfile.pdf cat 1 2 4 5 output mynewfile.pdf"

Merge PDF

pdftk input-file-1.pdf input-file-2.pdf cat output output.pdf

images: convert * output.pdf (remember to set policy:  sudo nano /etc/ImageMagick-6/policy.xml)

Edit PDF

You can edit PDF files in libre office draw or in harder cases you might try Master PDF Editor (

Last modified