Tuesday, March 22, 2022

QuickTip: Extracting pages from PDF on Linux

On a Mac OSX system, the default app Preview allows you to cut and paste pages from a PDF.

On Linux you can use PDFChain to manipulate PDFs. If you simply want to extract a certain range, then qpdf is quite handy.

A CLI solution is to use ghostscript as described here:

gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER \

       -dFirstPage=1 -dLastPage=15 -sOutputFile=outfile.pdf inpfile.pdf

You can make the interface friendlier by saving a function in your bashrc as described in the article.


No comments:

Post a Comment