Created
December 3, 2022 00:19
-
-
Save TiloGit/588a4bf3a0c5d2dbf6691604eafe838c to your computer and use it in GitHub Desktop.
compress and rename shaw PDFs
This file contains 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
##for PDF invoices with filename like ShawInvoice_01412345678_01Apr2022.pdf | |
for file in Shaw*.pdf | |
do | |
echo "$(date +"%F_%s") Start $file" | |
filedate=$(basename "$file" .pdf | tail -c 10) | |
outFdate=$(date -d $filedate +"%F") | |
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dPDFSETTINGS=/ebook -sOutputFile=${outFdate}_${file} $file | |
echo "$(date +"%F_%s") Done $file" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The downloaded PDF from shaw are very large (1.5 to 4 MB) I guess as the same files would be use for print out invoices.
Anyhow here a linux script I used to reduce the size (compress images in invoice) and rename the output file might be useful for someone else.
requires to install gs (ghostscript) on your linux system. I use this on WSL (Windows Linux Subsystem)