Last active
October 6, 2021 03:22
-
-
Save eplt/3046dd9b64ad8fa134e502bd8939e23f to your computer and use it in GitHub Desktop.
Extract and Combine First Page of each PDF in folder - OS X, requires GS or PDFTK
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 | |
# | |
echo "Start Script" | |
rm combined.pdf | |
for file in *.pdf ; do pdftk "$file" cat 1 output "${file%.pdf}-page1.pdf" ; done | |
pdftk *-page1.pdf cat output combined.pdf | |
#for file in *.pdf ; do gs -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile="${file%.pdf}-page1.pdf" -dFirstPage=1 -dLastPage=1 "$file" ; done | |
#gs -dSAFER -dNOPAUSE -dBATCH -sDEVICE#pdfwrite -sOutputFile#"combined.pdf" *-page1.pdf | |
rm *-page1.pdf | |
echo "End Script" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You might need to install Ghostscript or PDFTK
Check out http://stackoverflow.com/questions/32505951/pdftk-server-on-os-x-10-11