Skip to main content
GrN.dk

Main navigation

  • Contact
  • Your Digital Project Manager
  • About Greg Nowak
  • Services
  • Portfolio
  • Container
    • Excel Freelancer
    • Kubuntu - tips and tricks
    • Linux Apache MySQL and PHP
    • News
    • Image Gallery
User account menu
  • Log in

Breadcrumb

  1. Home

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"

Example 2: "mkdir output; pdftk * output/output.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
2023-12-26

Tags

  • Linux
  • Data
  • Log in to post comments
Attachment
shrinkpdf_0.txt (3.09 KB)

Review Greg on Google

Greg Nowak Google Reviews

 

  • Portfolio
  • About Greg Nowak
  • Gregs IT and Logistics Optimization
  • Shrink PDF In Linux
  • Running Linux on T450s T495s T14, Thinkpads and Others
RSS feed

GrN.dk web platforms, web optimization, data analysis, data handling and logistics.