-
-
Save jhamfler/fb750cc3a8ce4e757145bc078aa46483 to your computer and use it in GitHub Desktop.
PDF commands
This file contains hidden or 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
# split all A3 pages into A4 except first and last | |
a=($(ls -d *.pdf)) | |
for f in ${a[@]} ;do | |
[ "${a[1]} " != "$f " ] && [ "${a[-1]} " != "$f " ] && pdfposter -m a4 -p 2x1a4 "$f" "$f.cut" | |
done | |
# rotate +90° (mathematical) and split all pages | |
b=($(ls -d *.cut)) | |
for f in ${b[@]} ;do | |
pdftk $f cat 1-endwest output "$f.pdf" | |
done | |
# concatenate all well oriented pages | |
pdftk "${a[1]}" *.cut.pdf "${a[-1]}" cat output 1.pdf | |
################################## | |
# do all this without the last pdf | |
a=($(ls -d *.pdf)) | |
for f in ${a[@]} ;do | |
[ "${a[1]} " != "$f " ] && pdfposter -m a4 -p 2x1a4 "$f" "$f.cut" | |
done | |
b=($(ls -d *.cut)) | |
for f in ${b[@]} ;do | |
pdftk $f cat 1-endwest output "$f.pdf" | |
done | |
pdftk "${a[1]}" *.cut.pdf cat output 1.pdf | |
################################### | |
# optionally cut out pages 9 and 10 | |
pdftk 1.pdf cat 1-8 11-end output a.pdf | |
# concatenate all files in directory alphabetically | |
pdftk $(ls -1|sort -h) cat output o.pdf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment