Friday, February 12, 2021

reduce the size of a pdf file compressing its figures


To reduce the size of a PDF file in linux of mac you'll need ghostscript (which in mac can be installed  with: brew install ghostscript). The following command line will generate a smaller file:  

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen \
   -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf   input.pdf


    Different levels of compression can be obtained changing the option -dPDFSETTINGS:
  • -dPDFSETTINGS=/screen lower quality, smaller size. (72 dpi)
  • -dPDFSETTINGS=/ebook for better quality, but slightly larger pdfs. (150 dpi)
  • -dPDFSETTINGS=/prepress output similar to Acrobat Distiller "Prepress Optimized" setting (300 dpi)
  • -dPDFSETTINGS=/printer selects output similar to the Acrobat Distiller "Print Optimized" setting (300 dpi)
  • -dPDFSETTINGS=/default selects output intended to be useful across a wide variety of uses, possibly at the expense of a larger output file

source: https://askubuntu.com/questions/113544/how-can-i-reduce-the-file-size-of-a-scanned-pdf-file

No comments:

Post a Comment