From 925c49cc5a5628069bc03f0e19e29b5a43fa2005 Mon Sep 17 00:00:00 2001 From: ache Date: Fri, 27 Jan 2023 02:21:34 +0100 Subject: Shortcut to extract PDF pages --- functions/pdfpextr.fish | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 functions/pdfpextr.fish (limited to 'functions') 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 -- cgit v1.2.3