Last active
November 18, 2021 17:10
-
-
Save viezel/073ffce9f643287a66c19a7f4f6e4e5f to your computer and use it in GitHub Desktop.
ghostscript - pdf conversion
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
## using Ghostscript, poppler-utils & qpdf | |
# gs docs: https://ghostscript.com/doc/9.18/Use.htm#Other_parameters | |
# poppler: https://freedesktop.org/wiki/Software/poppler/ | |
# qpdf docs: http://qpdf.sourceforge.net/files/qpdf-manual.html | |
# optimize pdf to use use CropBox, remove dublicate image refs, compress | |
gs -sDEVICE=pdfwrite -dUseCropBox -dPDFSETTINGS=/ebook -dNOPAUSE -dBATCH -dDetectDuplicateImages=true -sOutputFile=test-out.pdf test.pdf | |
## could use "-dFastWebView=true" but it seems to break some PDFs | |
# qpdf: linearize the PDF (Fast Web View) | |
qpdf --linearize test-out.pdf test-out-linearized.pdf | |
# review converted result | |
pdfinfo test-out.pdf | |
# review all images in pdf | |
pdfimages -list test-out.pdf | |
# validate | |
qpdf --check test-linearized.pdf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment