19 lines
448 B
Plaintext
19 lines
448 B
Plaintext
|
#!/bin/zsh
|
||
|
# Split up a PDF pagewise
|
||
|
source ~/.local/lib/pdf_tools.sh
|
||
|
|
||
|
typeset -r numpages=$(pdf_num_pages $1)
|
||
|
|
||
|
((numpages == 1)) && echo "PDF file has only one page. No action taken." && exit
|
||
|
|
||
|
echo Processing ${numpages} pages...
|
||
|
|
||
|
typeset -r digits=$#numpages
|
||
|
typeset -Z${digits} page=1
|
||
|
|
||
|
while ((page <= numpages)); do
|
||
|
pdf_extract_range "$1" ${page} ${page} "${1%.pdf}_${page}.pdf" > /dev/null
|
||
|
((page = page + 1))
|
||
|
done
|
||
|
echo Done.
|