Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
227 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...