Scanned PDF document too big - simple fix

tmccormi wrote on Wednesday, March 06, 2013:

IF you or your customer has been scanning PDF documents and they are producing files that are very large compared to generated  PDFs then this script may be of assistance.

Example: XSANE scan using PDF mode at 200 DPI save this 38 page document:
   49M 2013-03-06 10:21 original-20130305-MI2-signed.pdf

After compression
   2.7M 2013-03-06 10:31 new-20130305-MI2-signed.pdf

Here follows a simple shell script, would be easy to make a window cmd file or a small php script…  maybe even add a option for compress on upload to the document manager?  Not sure if ghostscript is available for windows as a native binary thoough.

#!/bin/sh
# Compress a PDF file
echo Enter Original File Name
read INPUT
echo Enter New File Name
read OUTPUT
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=${OUTPUT} ${INPUT}
ls -lh ${OUTPUT} ${INPUT}
echo HIT ENTER to rename new file back to original name
read X
rm ${INPUT}
mv ${OUTPUT} ${INPUT}
ls -lh ${INPUT}

doggmd wrote on Sunday, March 10, 2013:

Another option for saving space is to use Adobe  Acrobat and save the files as reduce size  .pdf.

I have been using 300 dpi for scanned files because it is supposedly better for OCR and searching. There has been mention of a requirement for searchable notes, etc.  It does not seem to take a lot more space and documents are a little more readable.  They also print a little better.

tmccormi wrote on Monday, March 11, 2013:

That is the correct model, for sure, but sometimes that lesson is not learned for a while.  The method above can reduce existing files by huge amounts sometimes 80% I’ve seen…   However, it can also corrupt some files that are already compressed, so care need to be taken to review the results before dropping the original.
-Tony