n-up
Combine PDF pages onto one sheet
Place several pages on each sheet, for handouts and proof prints.
- Reads
- a PDF — application/pdf
- Writes
- one file — PDFs
- Tool page
- /pdf-multiple-pages-per-sheet
Example
Print a four-page handout four to a sheet.
Given
- handout.pdf — an ordinary PDF of 4 pages
From code
import { loadDocument, runOperation } from '@pagecraft/core';
const handout = await loadDocument({ bytes, name: 'handout.pdf' });
const [output] = await runOperation('n-up', [handout], {
columns: 2,
rows: 2,
});
From a shell
pagecraft n-up handout.pdf --columns 2 --rows 2
What comes back
One PDF of 1 page.
This example is run by the test suite. If it stopped being true, the build would fail.
Options
columns--columns
integer
Columns
Default: 2
rows--rows
integer
Rows
Default: 2
order--order
string, one of
Order
Default: 'row'
row— Across, then downcolumn— Down, then across
size--size
string, one of
Sheet size
Default: 'a4'
a3— A3a4— A4a5— A5a6— A6b5— B5letter— Letterlegal— Legaltabloid— Tabloidexecutive— Executive
orientation--orientation
string, one of
Sheet orientation
Default: 'auto'
auto— To suit the gridportrait— Portraitlandscape— Landscape
margin--margin
number
Margin
Default: 0
unit--unit
string, one of
Measured in
Default: 'mm'
mm— Millimetrescm— Centimetresin— Inchespt— Points
pages--pages
string, a page selection: '1-3, 7, 9-', 'even', 'last'
Pages
Which pages to place, and in what order.
Default: 'all'
What it cannot do
- A bookmark follows its page to the sheet it landed on. Links and form fields do not: several pages now share a sheet, and there is nowhere correct to put them.