gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dQUIET -sOutputFile=output.pdf input.pdf

Category: Media & Conversion

gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dQUIET -sOutputFile=output.pdf input.pdf

Reprocess and compress a PDF

Parses the PDF and writes a new one, cleaning internal structure and often shrinking the file. -dNOPAUSE -dBATCH make it run unattended, since without them gs pauses for input and hangs in scripts. -dQUIET silences progress, and -sOutputFile names the result.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.