Last active
April 6, 2019 19:53
-
-
Save AnonymerNiklasistanonym/4cf87f2101d01fe87b459f010b07d280 to your computer and use it in GitHub Desktop.
Convert a multi page PDF file to many single page PDF files (and optionally run a command for every PDF file that will be created)
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
#!/usr/bin/env bash | |
# Description: | |
# Seperate a PDF document into many single page PDF documents | |
# Arguments: | |
# 1) The path of the PDF file | |
# 2) The output directory | |
# 3) The output file name NAME_%d.pdf | |
# Get page number | |
PAGE_NUMBER=$(pdfinfo "$1" | grep Pages | awk '{print $2}') | |
# Create single page PDF files out of the multipage PDF file | |
pdfseparate "$1" "$2/$3_%d.pdf" | |
# Optional, do something for every page | |
for (( c=1; c<=$PAGE_NUMBER; c++ )) | |
do | |
#inkscape "$2/$3_$c.pdf" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment