Skip to main content
  1. Posts/

How to Extract PDF file on macOS

·147 words·1 min·
Table of Contents

To extract pdf pages from several files, we can use the open source tool qpdf.

First we can install qpdf using homebrew:

brew install qpdf

Suppose you want to extract page 1-2 from A.pdf, page 1 from B.pdf and page 3-4 from C.pdf, you can run the following command:

qpdf --empty --pages A.pdf 1-2 B.pdf 1 C.pdf 3-4 -- output.pdf

--empty means there is no input pdf, we are trying to produce a new PDF from existing ones. Between --page and final --, we can specify multiple PDF files with range, password info in this format:

filename [--password=password] [page-range]

Both password and page-range is optional. If you don’t specify the page range, it will take the whole pdf. For more details, run the following command on command line:

qpdf --help=page-selection

References
#

Related

PATH Variable Changed inside Tmux on macOS?
·424 words·2 mins
Find Which Font is Used in A PDF
·222 words·2 mins
macOS Operation Not Permitted?
·200 words·1 min