Function: PDF Pages

This is a function to make it easier to extract pages from a PDF using qpdf.

The Function Declaration

function pdfpages --argument-names source_pdf target_pdf pages -d "Extract pages from a pdf"

The Command Call

This uses qpdf (GitHub Repsitory) to extract pages from a PDF. It's a function not an abbreviation because you intersperse your arguments within their syntax, rather than just pasting it all after the call.

qpdf --empty --pages $source_pdf $pages -- $target_pdf

Error Handling

if test $status -ne 0
    echo "source_pdf = $source_pdf"
    echo "target_pdf = $target_pdf"
    echo "pages = $pages"
end