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: http://blog.virtualzone.de/2012/11/how-to-reduce-pdf-file-size-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" /> (https://stackoverflow.com/questions/52998331/imagemagick-security-polic…)

Split PDF

(http://linuxcommando.blogspot.com/2013/02/splitting-up-is-easy-for-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 (https://code-industry.net/free-pdf-editor/).

Last modified
2021-12-23
Tags
Attachment