pdfcpu

Logo

A PDF processor written in Go.

View the Project on GitHub pdfcpu/pdfcpu


Changelog

N-up


Usage

pdfcpu nup [ description ] outFile n inFile | imageFiles... [flags]

Flags

namedescriptionrequired
p(ages)selected pagesno

Common Flags


Arguments

namedescriptionrequireddefault
descriptionconfiguration stringno
outFilePDF output fileyes
nthe N-up valueyes
inFilePDF input fileinFile or imageFile(s)
imageFile…one or more imagesinFile or imageFile(s)

N-up Value

The following table lists all supported values for n and the resulting grid layout with respect to the orientation of the chosen output paper size. See here for a thorough explanation of N-up.

valueportraitlandscape
21x22x1
31x33x1
42x22x2
82x44x2
93x33x3
123x44x3
164x44x4

Description

A configuration string to specify the details of the n-up layout.

parametervaluesdefault
dimensions(width, height) in user units eg. ‘400 200’595 842
formsize, paper sizepaper size to be used. Append L or P to enforce landscape/portrait modeA4
orientationone of rd, dr, ld, dl for PDF input filesrd
enforceon/off true/falseon
borderon/off true/falseon
marginfloat >= 00
backgroundcolor, bgcolcolornone

Orientation

This is usually associated with the writing direction used in the document to be processed. For PDF input files only

valuedescription
rdright down, default
drdown right
ldleft down
dldown left

Enforce

true enforces best-fit orientation of individual content artifacts during rendering on destination page content.

false keeps original orientation of individual content artifacts during rendering on destination page content.


Default description

'formsize:A4, dimensions:595 842, orientation:rd, border:on, margin:3, enforce:on'

Examples

Create out.pdf by applying 4-up to in.pdf. Each page fits 4 original pages of in.pdf into a 2x2 grid:

$ pdfcpu nup out.pdf 4 in.pdf


The output file will use the page size of the input file unless explicitly declared by a description string like so:

$ pdfcpu nup 'form:A4' out.pdf 9 in.pdf


nup also accepts a list of image files with the result of rendering all images in N-up fashion into a PDF file using the specified paper size (default=A4). Generate out.pdf using A4L landscape mode where each page fits 4 images onto a 2x2 grid. The grid element border lines are rendered by default, and the default margin of 3 points is applied:

$ pdfcpu nup 'form:A4L' out.pdf 4 *.jpg *.png *.tif


A single image input file supplied will produce a single page PDF output file.
In the following example logo.jpg will be 16-up’ed onto out.pdf. Both grid borders and margins are suppressed and the output format is Ledger:

$ pdfcpu nup 'form:Ledger, bo:off, ma:0' out.pdf 16 logo.jpg