Resize a PDF using qPDF, PS, Ghostscript, and ImageMagick(v6) to get it down in size (even up to 75% of original). The tool will output the smallest of the pdfs created. This is very useful after an export of of M$ Power-Point with 4K embedded image captures.
The tools are similarly configured to use ebook pdf output settings.
Put the input.pdf into your ./data directory and run something similar to..
docker run -v $PWD/data:/data shadowbq/shrink-pdf:latest /data/sample.pdf
There are too many things you may need to manipulate a pdf, so interactive is available to utilize all the suites of pdf tools included.
./interactive
You may need to fetch a pdf, so curl is also included:
pdfuser@:/ curl -sL http://sample.com/my.pdf
pdftk (the one that uses JAVA unfortunately) is the best at merging, and is incredible fast.
pdfuser@:/ pdftk Cover.pdf Content.pdf cat output Final.pdf
Note: Although other application can merge pdfs, convert(Imagemagick), and gs are quite slow and do not have efficacy in the creation of merged very large PDF files.
Merge + Strip + Linearize (https://bl.ocks.org/hubgit/6078384)
pdfuser@:/data$ pdftk Cover.pdf Data.pdf cat output Complete.pdf
pdfuser@:/data$ exiftool -all:all Complete.pdf
ExifTool Version Number : 11.88
File Name : Complete.pdf
Directory : .
File Size : 11 MB
File Modification Date/Time : 2022:02:04 20:41:52+00:00
File Access Date/Time : 2022:02:04 20:41:52+00:00
File Inode Change Date/Time : 2022:02:04 20:41:52+00:00
File Permissions : rw-r--r--
File Type : PDF
File Type Extension : pdf
MIME Type : application/pdf
PDF Version : 1.4
Linearized : No
Modify Date : 2022:02:04 20:41:43Z
Creator : pdftk-java 3.0.9
Create Date : 2022:02:04 20:41:43Z
Producer : itext-paulo-155 (itextpdf.sf.net-lowagie.com)
Page Count : 792
pdfuser@:/data$ exiftool -all:all= -overwrite_original Complete.pdf
Warning: [minor] ExifTool PDF edits are reversible. Deleted tags may be recovered! - Complete.pdf
1 image files updated
pdfuser@:/data$ qpdf --linearize Complete.pdf Complete-stripped.pdf
pdfuser@:/data$ exiftool -all:all Complete-stripped.pdf
ExifTool Version Number : 11.88
File Name : Complete-stripped.pdf
Directory : .
File Size : 11 MB
File Modification Date/Time : 2022:02:04 20:43:29+00:00
File Access Date/Time : 2022:02:04 20:43:29+00:00
File Inode Change Date/Time : 2022:02:04 20:43:29+00:00
File Permissions : rw-r--r--
File Type : PDF
File Type Extension : pdf
MIME Type : application/pdf
PDF Version : 1.4
Linearized : Yes
Page Count : 792
MIT. All upstream licenses are GPL or Apache, and all Downstream are required also to be ..(see pdftk: PDFtk Server Redistribution License)
Content type
Image
Digest
Size
169 MB
Last updated
over 4 years ago
docker pull shadowbq/shrink-pdf