I have a PDF file that I want to compress to less than 100 kB. It has a scan of two pages that I scanned from my mobile scanner. Post scan it is 338 kB (with minimum quality to view the pages). Basically I want to upload this file to a government portal which only allows upload of a maximum 100 kB in just one file. This is my primary purpose. The below are the methods that I have tried now and it did not do the needed task:
using a simple wrapper around Ghostscript to shrink PDF files "
./shrinkpdf.sh in.pdf out.pdf xx". I set xx to 90 and it gives me 282 kB. Below the 90 value, the text in PDF document is not visible clearly and I am sure my application will be rejected then.
I also tried "
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=setting -sOutputFile=output.pdf input.pdf" with setting value as /screen which I think is minimum setting and it gives me 232 kB and the text is fairly visible.
I also tried converting it to JPEG using "pdftoppm" method like - "
pdftoppm compressed.pdf jpeg -r 75 -jpeg" which gives me 141 kB for 1 page and 128 kB for page 2. I am not sure how I will get these two JPEG files to upload as one file, but I guess my primary aim should be now to get it less than 100 kB first?
I use Ubuntu 20.04.2.