Skip to content

Instantly share code, notes, and snippets.

@PeterTheOne
Last active August 29, 2015 14:18
Show Gist options
  • Save PeterTheOne/0ce0d04d8d09c7535597 to your computer and use it in GitHub Desktop.
Save PeterTheOne/0ce0d04d8d09c7535597 to your computer and use it in GitHub Desktop.
split bawag-psk bank pdfs
#!/bin/bash
cd Kontoauszuege/
for directory in */ ; do
echo "$directory"
cd ${directory}
for file in *.pdf ; do
# echo "$file to ../../Kontoauszuege_single/$directory$file"
pdftk ${file} burst output ../../Kontoauszuege_1pagers/${directory}${file}_pg_%04d.pdf
done
cd ..
done
cd ..
cd Kontoauszuege_1pagers/
for directory in */ ; do
echo "$directory"
cd ${directory}
for file in ./*_pg_*.pdf ; do
echo "$file"
gs -o ../../Kontoauszuege_single/${directory}${file}C.pdf -sDEVICE=pdfwrite -g5950x2800 -c "<</PageOffset [0 0]>> setpagedevice" -f ${file}
gs -o ../../Kontoauszuege_single/${directory}${file}B.pdf -sDEVICE=pdfwrite -g5950x2800 -c "<</PageOffset [0 -281]>> setpagedevice" -f ${file}
gs -o ../../Kontoauszuege_single/${directory}${file}A.pdf -sDEVICE=pdfwrite -g5950x2800 -c "<</PageOffset [0 -561]>> setpagedevice" -f ${file}
done
cd ..
done
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment