Last active
February 19, 2022 21:50
-
-
Save LordAmit/3dbb7fc9caad09b3fa71d9e2d21ab794 to your computer and use it in GitHub Desktop.
Using GhostScript to optimize PDF file size while maintaining full texts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# /screen can be changed to the following: | |
# /screen selects low-resolution output similar to the Acrobat Distiller (up to version X) "Screen Optimized" setting. | |
# /ebook selects medium-resolution output similar to the Acrobat Distiller (up to version X) "eBook" setting. | |
# /printer selects output similar to the Acrobat Distiller "Print Optimized" (up to version X) setting. | |
# /prepress selects output similar to Acrobat Distiller "Prepress Optimized" (up to version X) setting. | |
# /default selects output intended to be useful across a wide variety of uses, possibly at the expense of a larger output file. | |
# from https://www.ghostscript.com/doc/9.54.0/VectorDevices.htm | |
# Script copied and modified from https://stackoverflow.com/questions/10450120/optimize-pdf-files-with-ghostscript-or-other | |
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -sOutputFile=output.pdf $1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment