LinuxCommandLibrary

pdfxup

Rearrange pages within PDF documents

TLDR

Create a 2-up PDF

$ pdfxup [[-o|--output]] [path/to/output.pdf] [path/to/input.pdf]
copy

Create a PDF with 3 columns and 2 lines per page
$ pdfxup [[-x|--columns]] [3] [[-y|--rows]] [2] [[-o|--output]] [path/to/output.pdf] [path/to/input.pdf]
copy

Create a PDF in booklet mode (2-up, and pages are sorted to form a book when folded)
$ pdfxup [[-b|--booklet]] [[-o|--output]] [path/to/output.pdf] [path/to/input.pdf]
copy

SYNOPSIS

pdfxup [OPTIONS] [PDF_FILE...]
pdfxup [OPTIONS] --nup [PDF_FILE...]

PARAMETERS

or --nup
    Specifies the N-up layout, where N is the number of columns and M is the number of rows (e.g., 2x2 for 4 pages per sheet, 1x4 for 4 pages in a single column).

-o or --outfile
    Specifies the name of the output PDF file. If not provided, a default name is generated.

--papersize
    Sets the output paper size (e.g., A4, letter, A3). Overrides the default paper size.

--frame
    Draws a thin frame around each logical input page on the output sheet, improving readability.

--column-gap
    Sets the horizontal gap (margin) between columns of pages. Specify with units like '1cm' or '0.5in'.

--row-gap
    Sets the vertical gap (margin) between rows of pages. Specify with units like '1cm' or '0.5in'.

--delta
    Shifts all pages by dx horizontally and dy vertically. Useful for fine-tuning page placement.

--angle
    Rotates each input page by the specified degrees (e.g., 90, 180, 270) before imposition.

--batch
    Processes multiple input PDF files separately, creating a distinct N-up output file for each input.

--no-landscape
    Prevents pdfxup from automatically setting the output page to landscape orientation, even if it fits better.

--fitpaper
    Scales the imposed content to fit the selected or default paper size, potentially overriding other scaling options.

DESCRIPTION

pdfxup is a powerful Linux command-line utility designed to arrange multiple PDF pages onto a single output sheet, commonly known as 'N-up' or 'X-up' imposition. Part of the pdfjam suite, it acts as a convenient wrapper script that simplifies the process of creating handouts, booklets, or compact print versions of documents. Users can specify layouts like 2x2, 1x4, or any custom grid, effectively consolidating several logical pages onto one physical page. It supports various formatting options, including framing individual pages, adjusting margins, rotating pages, and selecting output paper sizes. This command is invaluable for saving paper and ink, making documents easier to review in print, and preparing materials for presentations or academic use by reducing the number of physical pages required. It's built upon the robust pdfpages LaTeX package and pdflatex, providing high-quality output.

CAVEATS

pdfxup relies heavily on a functioning LaTeX installation, specifically pdflatex and the pdfpages package, to perform its page imposition. Without these dependencies, the command will not execute. Users may encounter issues with extremely large, malformed, or highly complex PDF input files. Features like interactive elements, specific transparencies, or certain font embeddings might not always be perfectly preserved in the final N-up output.

COMMON USAGE EXAMPLES

pdfxup can be used in several common ways to achieve different N-up layouts:

Basic 2x2 N-up:
pdfxup 2x2 mydocument.pdf -o output.pdf
This command takes `mydocument.pdf` and arranges its pages into a 2x2 grid (4 logical pages per physical sheet) saving the result to `output.pdf`.

1x4 Handout with Frames:
pdfxup --nup 1x4 --frame presentation.pdf -o handout.pdf
This creates a handout from `presentation.pdf` with 4 pages per sheet arranged in a single column, with each original page clearly outlined by a frame.

Batch Processing for Multiple Chapters:
pdfxup --nup 2x1 --batch chapter*.pdf
This processes all files matching `chapter*.pdf` (e.g., chapter1.pdf, chapter2.pdf), arranging them 2 pages per sheet (side-by-side) and creating separate output files like `chapter1-2x1.pdf`, `chapter2-2x1.pdf`, etc.

HISTORY

pdfxup is part of the widely-used pdfjam suite, which evolved from simpler LaTeX-based scripting solutions for PDF manipulation. The suite, primarily maintained by David J. R. Robinson, provides a collection of command-line utilities that leverage the pdfpages LaTeX package and pdflatex. Its development has focused on creating user-friendly wrappers around powerful LaTeX functionalities, making complex PDF operations accessible from the command line without requiring direct LaTeX knowledge. pdfxup specifically emerged to streamline the common task of N-up imposition, building upon the established reliability of the pdfpages package.

SEE ALSO

pdfjam(1), pdftk(1), qpdf(1), gs(1)

Copied to clipboard