Extract pages from a PDF

And another reminder for me – now on how to extract pages from a pdf:

If we want to extract, say page 5 to page 9 from book.pdf to extract.pdf we can do this:

gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER -dFirstPage=5 -dLastPage=9 -sOutputFile=extract.pdf book.pdf

This uses ghostscript which is not uncommon to see installed on computers.