Last active
September 17, 2019 09:13
-
-
Save grimmo/e9656d13a1ede5f39a456b2c76b75080 to your computer and use it in GitHub Desktop.
Split PDF every nth page and convert output to PDF/A
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
#!/bin/bash | |
COUNTER=1 | |
NUMBEROFPAGES=<LAST_PAGENUMBER_IN_INPUT_PDF> | |
while [ $COUNTER -lt $NUMBEROFPAGES ]; do | |
pdftk input.pdf cat $COUNTER-$((COUNTER+1)) output OUTPUT${COUNTER}.pdf | |
gs -dPDFA -dBATCH -dNOPAUSE -sProcessColorModel=DeviceCMYK -sDEVICE=pdfwrite -sPDFACompatibilityPolicy=1 -sOutputFile=OUTPUT${COUNTER}_A.pdf OUTPUT${COUNTER}.pdf | |
let COUNTER=COUNTER+2 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment