问题
In Acrobat 11 Pro, I can do File > Save As Other > Reduced Size PDF (setting as Acrobat 10 viewer or later), which cut a PDF to about 40% and looks exactly the same.
I am wondering how I can achieve the same result with an open source tool like ghost script, image magick, or some adobe tools on a linux server via CL or PHP.
回答1:
gswin64c -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
This works pretty well to reduce the pdf file size. When getting used to ghostscript inside a batch script be wary of special characters. For example "%" is a special character for postscript so when using variable in cmd you have escape the character so % -> %% and %% -> %%%% This can cause a headache depending on what you are trying to do. Also paths are a pain, use CD and relative file paths.
Source
来源:https://stackoverflow.com/questions/18318628/acrobat-reduced-size-pdf-with-gs-im-other