diff options
author | ache <ache@ache.one> | 2023-01-27 02:21:34 +0100 |
---|---|---|
committer | ache <ache@ache.one> | 2023-01-27 02:21:34 +0100 |
commit | 925c49cc5a5628069bc03f0e19e29b5a43fa2005 (patch) | |
tree | af7d229a0b3db29f1b73de5486bf0c9d1df2a502 /functions | |
parent | Add reCo command (diff) |
Shortcut to extract PDF pages
Diffstat (limited to 'functions')
-rw-r--r-- | functions/pdfpextr.fish | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/functions/pdfpextr.fish b/functions/pdfpextr.fish new file mode 100644 index 0000000..8e4116f --- /dev/null +++ b/functions/pdfpextr.fish @@ -0,0 +1,15 @@ +function pdfpextr -a pStart pEnd filename + # this function uses 3 arguments: + # $1 is the first page of the range to extract + # $2 is the last page of the range to extract + # $3 is the input file + # output file will be named "inputfile_pXX-pYY.pdf" + set -x fileOut (string split -r -m1 . $filename)[1]_p{$pStart}-p{$pEnd}.pdf + printf $fileOut + + gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER \ + -dFirstPage=$pStart \ + -dLastPage=$pEnd \ + -sOutputFile=$fileOut \ + "$filename" +end |