LinuxCommandLibrary

pdfseparate

Extract individual pages from PDF documents

TLDR

Extract pages from PDF file and make a separate PDF file for each page

$ pdfseparate [path/to/source_filename.pdf] [path/to/destination_filename-%d.pdf]
copy

Specify the first/start page for extraction
$ pdfseparate -f [3] [path/to/source_filename.pdf] [path/to/destination_filename-%d.pdf]
copy

Specify the last page for extraction
$ pdfseparate -l [10] [path/to/source_filename.pdf] [path/to/destination_filename-%d.pdf]
copy

SYNOPSIS

pdfseparate [options] PDF-file output-file-pattern

PARAMETERS

PDF-file
    The input PDF file from which pages will be extracted.

output-file-pattern
    The naming pattern for the output PDF files. Typically includes %d which represents the page number to extract. For example, 'page-%d.pdf' will create files like page-1.pdf, page-2.pdf, etc.

-f number
    First page to extract (inclusive).

-l number
    Last page to extract (inclusive).

-opw password
    Specify the owner password for PDF file protection.

-upw password
    Specify the user password for PDF file protection.

DESCRIPTION

The pdfseparate command extracts single pages or page ranges from a Portable Document Format (PDF) file. It takes a PDF file as input and creates individual PDF files, each containing one or more pages from the original document. This is useful for splitting large PDF documents into smaller, more manageable parts, extracting specific pages of interest, or creating subsets of a PDF file for various purposes like printing, sharing, or further processing. The command creates a separate PDF for each selected page or page range. The format of the output files is determined by a pattern you specify in the command. It is a part of the poppler-utils package, which provides several command-line tools for manipulating PDF files.

CAVEATS

pdfseparate requires the input PDF file to be valid and properly formatted. It may not work correctly with corrupted or malformed PDF documents. Overlapping page ranges may cause unexpected behavior.
Beware of special chars in filename/pattern.

OUTPUT FILE PATTERN EXAMPLES

The output-file-pattern dictates how the generated PDF files are named.
page-%d.pdf: Creates files named page-1.pdf, page-2.pdf, and so on.
document_page_%03d.pdf: Creates files named document_page_001.pdf, document_page_002.pdf, and so on, using leading zeros.

HANDLING ENCRYPTED PDF FILES

For password-protected PDFs, you must provide the appropriate password using the -opw (owner password) or -upw (user password) options. Without the correct password, pdfseparate will fail to extract the pages.

HISTORY

pdfseparate is part of the poppler-utils package, which has been developed and maintained for many years. Poppler is a PDF rendering library, and poppler-utils provides command-line utilities based on the library. It is widely used in Linux distributions and other Unix-like systems for PDF manipulation. The command's development focuses on stability and conformance to PDF standards.

SEE ALSO

pdfunite(1), pdftk(1), pdfinfo(1), pdfimages(1), pdftops(1)

Copied to clipboard