basic structure; zsh default; no desktop assumed

This commit is contained in:
2021-11-14 11:40:27 +01:00
commit 1280d2360d
21 changed files with 1157 additions and 0 deletions

19
_custom/.local/bin/pdfsplit Executable file
View File

@ -0,0 +1,19 @@
#!/bin/zsh
# Split a PDF file in two at a specified page
# 1 original PDF file path
# 2 last page of first section (second section will start with the one after that)
source ~/.local/lib/pdf_tools.sh
typeset -r numpages=$(pdf_num_pages $1)
typeset -r digits=$#numpages
typeset -r -Z${digits} m=$2
(( $2 > ${numpages} )) && echo "The document is only ${numpages} pages long, which is less than $2!" && exit 1
(( $2 == ${numpages} )) && echo "The document is exactly ${numpages} pages long!\nNo action taken." && exit
typeset -r stem=${1%.pdf}
typeset -r -Z${digits} one=1
typeset -r -Z${digits} n=$(( m + 1 ))
pdf_extract_range "$1" 1 ${m} "${stem}_${one}-${m}.pdf" > /dev/null
pdf_extract_range "$1" ${n} ${numpages} "${stem}_${n}-${numpages}.pdf" > /dev/null