How to scale down PDF file (in pixels and in cm)?
1
vote
1
answer
2096
views
I need to automatically convert my pupils' solutions which are photos and scans of various orientations, resolution, quality and file format into a single PDF with fitting dimensions.
The dimensions in cm should be approximately A4 such that Xournal++, which I use for annotating the PDFs, uses a suiting pen thickness, see https://github.com/xournalpp/xournalpp/issues/2424
The dimensions in pixels should be such that the content is not blurry on one hand but Xournal++ is not hanging because of too large file size on the other hand.
Currently, I scale down PDF files with ps2pdf if they are larger than 5MB and individual image files (which later are merged into a PDF) if they are larger than 1,5MB. Also I set the size in cm to A4 (see link above).
However, some of the files are still too large in terms of pixels, though the file size and the dimensions in cm are fine, so Xournal++ hangs a lot on them.
I tried to set the DPI to 120 (155 would be A4 width on 1280px) but still get pages with 3000x4000 px. Here is my complete script: https://pastebin.com/jHxhUJvN
What did I mess up? Thanks for any input!
Asked by Photon
(119 rep)
Feb 28, 2021, 11:25 AM
Last activity: Feb 28, 2021, 07:03 PM
Last activity: Feb 28, 2021, 07:03 PM