pdfcpu

A PDF processor written in Go.

View the Project on GitHub hhrutter/pdfcpu


Changelog

N-up


Usage

pdfcpu nup|n-up [-v(erbose)|vv] [-pages pageSelection] [description] outFile n inFile|imageFile...


Flags

flag description required
verbose turn on logging no
vv verbose logging no
pages page selection no


Arguments

name description required default
description configuration string no  
outFile PDF output file yes  
n the N-up value yes  
inFile PDF input file inFile or imageFile(s)  
imageFile… one or more images inFile 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.

value portrait landscape
2 1x2 2x1
3 1x3 3x1
4 2x2 2x2
8 2x4 4x2
9 3x3 3x3
12 3x4 4x3
16 4x4 4x4


Description

A configuration string to specify the details of the grid layout.

parameter description values default
d dimensions (width, height) in user units eg. ‘400 200’ d: 595 842
f form/paper size paper size to be used. Append L or P to enforce landscape/portrait mode f: A4
o orientation one of rd, dr, ld, dl for PDF input files o: rd
b element border on/off true/false b: on
m element margin integer >= 0 m: 0


Orientation

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

value description
rd right down, default
dr down right
ld left down
dl down left


Default description

'f:A4, d:595 842, o:rd, b:on, m:3'

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 'f: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 A4 Landscape mode where each page fits 4 images onto a 2x2 grid. The grid element border lines are rendered by default as well is the default margin of 3 points applied:

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


A single image input file supplied will produce a single page PDF ouput 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 'f:Ledger, b:off, m:0' out.pdf 16 logo.jpg