Linux: PDF: How to control pdf file size

PHOTO EMBED

Mon Aug 29 2022 14:17:33 GMT+0000 (Coordinated Universal Time)

Saved by @marcopinero #bash

#Using a single line of GhostScript command on my Ubuntu’s terminal, I was able to reduce the size of a  PDF file from 6 MB to approximately 1 MB:

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

# You can use the following parameters for -dPDFSETTINGS instead of /screen:

# /screen – Lowest quality, lowest size (ugly)
# /ebook – Moderate quality
# /printer – Good quality
# /prepress – Best quality, highest size
content_copyCOPY

This is the tool I use when reducing size of pdf files is needed.