Skip to content

Instantly share code, notes, and snippets.

@macleginn
Created March 14, 2020 12:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save macleginn/ebbf800af9e808ee680ac568e4685b7b to your computer and use it in GitHub Desktop.
Save macleginn/ebbf800af9e808ee680ac568e4685b7b to your computer and use it in GitHub Desktop.
A bash/zsh function to easily extract pages from .pdf files using qpdf
# params:
# $1 input-file path,
# $2 page range (e.g., "1-1", "10-39", "5,9-12"),
# $3 output-file path
# ex.: pages_from_pdf input.pdf "1,3,8-9" test.pdf
# qpdf should be installed
function pages_from_pdf() {
qpdf $1 --pages $1 $2 -- $3
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment