Need a Java-based solution or, at the worst, command-line for Linux.
I tried to use Ghostscript:
gs -sDEVICE=pdfwrite -dPDFA -dBATCH -dNOPAUSE -dUseCIEColor \ -sProcessColorModel=DeviceCMYK -sPDFACompatibilityPolicy=1 \ -sOutputFile=downgraded.pdf leon_range_my12_w22_brochure.pdf
but I got a lot of errors...
1 Correct answerGo to File> Save as other> Optimized PDF> Go to Discard Objects, Discard User Data and Clean Up, open each section and check everything on. If your PDF is still too big, you can increase downsampling until you get the desired final size.
Here's an example of how you can downsample all (color, gray and mono) images to 72dpi with a Ghostscript commandline:
gs \ -o downsampled.pdf \ -sDEVICE=pdfwrite \ -dDownsampleColorImages=true \ -dDownsampleGrayImages=true \ -dDownsampleMonoImages=true \ -dColorImageResolution=72 \ -dGrayImageResolution=72 \ -dMonoImageResolution=72 \ -dColorImageDownsampleThreshold=1.0 \ -dGrayImageDownsampleThreshold=1.0 \ -dMonoImageDownsampleThreshold=1.0 \ input.pdf
Update:
The *ImageDownsampleThreshold=1.0
parameters enforce that all Images with a resolution higher than the target resolution of 72 dpi will be downsampled. If this parameter is not given (or set to a different value), the default values will be used: *ImageDownsampleThreshold=1.5
. This default value will only downsample images with a value of 108 dpi (or higher) and leave the other ones untouched.
This is what I am using:
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=OUTPUT.pdf INPUT.pdf
For your reference:
-dPDFSETTINGS=/screen (screen-view-only quality, 72 dpi images)
-dPDFSETTINGS=/ebook (low quality, 150 dpi images)
-dPDFSETTINGS=/printer (high quality, 300 dpi images)
-dPDFSETTINGS=/prepress (high quality, color preserving, 300 dpi imgs)
-dPDFSETTINGS=/default (almost identical to /screen)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With