LinuxCommandLibrary

pdfunite

Merge multiple PDF files into one

TLDR

Merge 2 PDFs into a single PDF

$ pdfunite [path/to/fileA.pdf] [path/to/fileB.pdf] [path/to/merged_output.pdf]
copy

Merge a directory of PDFs into a single PDF
$ pdfunite [path/to/directory/*.pdf] [path/to/merged_output.pdf]
copy

SYNOPSIS

pdfunite [options] <input_pdf1> [<input_pdf2> ...] <output_pdf>

PARAMETERS

-v
    Prints the copyright and version information for pdfunite.

--version
    Prints the copyright and version information for pdfunite.

-h
    Displays a brief usage message and exits.

--help
    Displays a brief usage message and exits.

DESCRIPTION

pdfunite is a straightforward command-line utility designed for the simple task of merging multiple Portable Document Format (PDF) files into a single, consolidated PDF document. It is typically part of the Poppler utilities suite, which provides various tools for working with PDF files. The command takes a list of input PDF files and combines them sequentially into a new output file. Its simplicity makes it an efficient tool for combining numerous PDF documents without requiring complex configurations or graphical interfaces. It's particularly useful for batch processing or scripting tasks where automated PDF merging is needed, providing a quick and easy way to concatenate PDF documents.

CAVEATS

Order of Merging: The input PDF files are merged strictly in the order they are listed on the command line.
Limited Functionality: pdfunite is a basic tool for concatenation only. It does not support advanced PDF manipulation features such as selecting specific page ranges, reordering pages, adding encryption, or modifying metadata. For such complex tasks, more robust tools like qpdf or Ghostscript (gs) are often required.
Dependency: It relies on the Poppler PDF rendering library, so it must be installed as part of the Poppler utilities package.

INPUT AND OUTPUT ARGUMENTS

The command requires at least one input PDF file path followed by a single output PDF file path. Multiple input files are read sequentially and combined into the specified output file.
Example: pdfunite document1.pdf document2.pdf output.pdf

RETURN STATUS

pdfunite typically returns 0 on success. A non-zero return value indicates an error (e.g., input file not found, permission issues, or invalid PDF format).

HISTORY

pdfunite is part of the Poppler PDF rendering library utilities, which originated as a fork of the Xpdf project in 2005. It was developed to provide a simple, dedicated command-line tool for combining PDF files, leveraging Poppler's robust PDF handling capabilities. Its design emphasizes ease of use and direct functionality, making it a staple for basic PDF merging tasks within the Linux command-line environment.

SEE ALSO

pdftoppm(1), pdftotext(1), pdfinfo(1), qpdf(1), gs(1)

Copied to clipboard