zoom

Rescale entire pages

Usage

pdftl <input> zoom <spec>... output <file>

Details

The zoom operation rescales entire pages (including the MediaBox) to fit a specified target dimension. Unlike place, which only moves content within existing boundaries, zoom physically transforms the page size.

This is an in-place operation: unspecified pages are left unchanged.

Syntax: zoom "<pages>(<target>[,<options>])"

Target Formats:

  • Relative/Percentage: (50%) or (200%). Resizes the page relative to its current dimensions.

  • Single Value/Paper: (A4) or (100mm). Scales the page uniformly so that it fits inside a bounding box of that size (aspect ratio preserved).

  • Explicit Box: (100mm,200mm). Scales the page uniformly to fit inside the specified width and height.

  • Axis Specific: (width=A4) or (height=11in). Scales the page proportionally based only on the specified dimension.

Options:

  • shrink: Only scale pages down. If the page is already smaller than the target, it remains unchanged.

  • grow: Only scale pages up. If the page is already larger than the target, it remains unchanged.

Note: Scaling is always uniform. If a target rectangle is provided, the operation uses the limiting dimension to ensure the entire page fits inside the “envelope”.

Examples

Shrink only the first 3 pages to 50% of their size

pdftl in.pdf zoom '1-3(50%)' output out.pdf

Scale the whole document to A4 width

pdftl in.pdf zoom '(width=A4)' output out.pdf

Ensure all pages fit within a 10x10 inch box, but only if they are larger

pdftl in.pdf zoom '(10in,shrink)' output out.pdf

Mixed operation: First page to A4, others to 80%

pdftl in.pdf zoom '1(A4)' '2-end(80%)' output out.pdf

Tags: in_place, geometry

Source: pdftl.operations.zoom

Read online: https://pdftl.readthedocs.io/en/stable/operations/zoom.html

Type: Operation