pdfjam
Manipulate and combine PDF files
TLDR
Merge two (or more) PDFs
Merge the first page of each file together
Merge subranges from two PDFs
Sign an A4 page (adjust delta to height for other formats) with a scanned signature by overlaying them
Arrange the pages from the input file into a fancy 2x2 grid
Reverse the order of pages within each given file and concatenate them
SYNOPSIS
pdfjam [OPTIONS] [OUTPUT OPTIONS]
PARAMETERS
--outfile
Specifies the name of the output PDF file. If not provided, a default name will be generated.
--nup
Arranges multiple logical pages onto a single physical page, creating an N-rows by M-columns grid (e.g., '2x2' for four pages per sheet).
--papersize
Sets the paper size for the output document (e.g., 'A4', 'letter', 'legal').
--no-landscape
Prevents automatic rotation to landscape orientation, even if the content suggests it.
--frame
Draws a thin frame around each logical page displayed on the output sheet.
--trim
Trims the specified margins (Left, Bottom, Right, Top) from each page, given in LaTeX units (e.g., '10mm').
--keepinfo
Attempts to retain metadata (like title, author) from the first input PDF file in the generated output.
--booklet
Arranges pages in the output PDF specifically for printing as a booklet, suitable for folding and binding.
--rotate
Rotates the content of each page by the specified angle (e.g., '90', '180', '270' degrees clockwise).
--batch
Processes multiple input files individually, typically creating a separate output file for each input.
--quiet
Suppresses most of the verbose output messages, showing only critical errors.
DESCRIPTION
pdfjam is a command-line utility designed for versatile manipulation of PDF files. It serves as a user-friendly wrapper around the powerful pdfpages LaTeX package and Ghostscript, abstracting away the complexity of these underlying tools. Its core functionalities include merging multiple PDF files into a single document, arranging multiple logical pages onto a single physical sheet (N-up layout), and creating print-ready booklets. Additionally, pdfjam supports selecting specific pages, rotating content, scaling pages, and adjusting margins. It is highly beneficial for preparing documents for printing, consolidating various reports, or producing handouts from presentations, offering a streamlined interface for common PDF tasks without requiring direct interaction with LaTeX code or intricate Ghostscript commands.
CAVEATS
pdfjam relies on a working TeX distribution (specifically pdflatex and the pdfpages package) and Ghostscript (gs) to function. These dependencies must be installed and accessible in the system's PATH. Processing very large or numerous files can be slow due to the overhead of LaTeX compilation. Error messages may sometimes be cryptic, originating from the underlying LaTeX or Ghostscript processes.
DEPENDENCIES
For pdfjam to operate correctly, a full TeX distribution (like TeX Live or MiKTeX) must be installed, including the pdflatex command and the pdfpages LaTeX package. Additionally, Ghostscript (gs) is a crucial dependency for various PDF manipulation tasks, and it must also be present and executable on the system.
COMMON USE CASES
Beyond simple merging, pdfjam excels at creating handouts by arranging multiple presentation slides per page (e.g., '2x2' or '3x1' layouts). It is also invaluable for preparing large documents for professional printing as booklets, combining reports, or precisely adjusting page layouts and margins for specific print requirements.
HISTORY
pdfjam is part of the pdfjam-extras suite of scripts, developed by David J. R. King. It significantly simplifies common PDF manipulations by leveraging the robust capabilities of the pdfpages LaTeX package, created by Martin Scharrer, and Ghostscript. Its development was driven by the goal of providing a convenient command-line interface to these powerful PDF processing tools, making them accessible to users without requiring deep knowledge of LaTeX or PostScript programming. pdfjam is widely distributed as a component of major TeX distributions, such as TeX Live.