Pdfselect is a simple command-line tool to extract pages from a PDF file. It follows the psselect options.
Pdfselect exists for three reasons: First, the otherwise good pdftk has not ben packaged for Fedora since 2014 due to licensing issues. Alternatives like pdfsplit and pdfunite (part of poppler-utils in poppler) are too low level. Pdf-stapler is another alternative, but with a challenging API.
Download and installation
Sorry, currently (2023-09-22) there is no proper installation support.
Just download the one file and make it executable. It requires the PyPDF2 library (Fedora package python3-PyPDF2; I use version 1.26.0).
Download pdfselect-1.0.py (releaesd 2023-08-12).
The Pdfselect Manual
usage:
pdfselect [-h] [--pages PAGES] [--debug] [--verbose] [--even] [--odd]
[--reverse] [--version]
input_path output_path
select PDF pages from a document
positional arguments:
input_path
output_path
Select pages from a PDF file (first argument), writing to an output file (second argument), like psselect, but for pdf. (For people who are sad they can no longer install pdftk.)
Defaults to writing to stdout and reading from stdin if arguments are omittted.
OPTIONS
-
-p PAGES, –pages=PAGES list the pages to extract, like begin-2,5-7,10-end (Unlike psselect, we do not support -R as a synonym.)
-
-r reverse order
-
-e even pages only
-
-o odd pages only
-
-h, –help show help
-
–version show version
-
-v more verbose output (different than psselect)
(Unlike psselect, we don’t output anything ever. Nor do we have a -q –quiet option to suppress output.)
EXAMPLE
pdfselect -p 2-3 source.pdf dest.pdf
THANKS
Thanks to the PyPDF2 library that does the actual work, and to psselect for a reasonable UI.