pdfcpu

Logo

A PDF processor written in Go.

View the Project on GitHub pdfcpu/pdfcpu


Changelog

Resize

Resize selected pages of inFile either by scale factor, to standard form or specific page dimensions and optional enforce orientation. Have a look at some examples.

Usage

pdfcpu resize description inFile [ outFile ] [flags]

Flags

namedescriptionrequired
p(ages)selected pagesno

Common Flags


Arguments

namedescriptionrequired
descriptionconfiguration stringyes
inFilePDF input fileyes
outFilePDF output fileno

Description

A configuration string with input parameters for the resize command.

parametervalues
scalefactor0.0 < s < 1.0 or s > 1.0
dimensions(width, height) in user units eg. ‘400 200’
enforcenew aspect ratio: on/off true/false
formsize, papersizepaper size to be used. Append L or P to enforce landscape/portrait mode
bgcolorcolor

Examples

Enlarge pages by doubling the page dimensions, keep orientation.

$ pdfcpu resize "scale:2" in.pdf out.pdf

Shrink first 3 pages by cutting in half the page dimensions, keep orientation.

$ pdfcpu resize in.pdf out.pdf --pages 1-3

Resize pages to width of 40 cm, keep orientation.

$ pdfcpu resize -u cm -- "dim:40 0" in.pdf out.pdf

Resize pages to A4, keep orientation.

$ pdfcpu resize "form:A4" in.pdf out.pdf

Resize pages to A4 and enforce orientation(here: portrait mode), apply background color.

$ pdfcpu resize "f:A4P, bgcol:#d0d0d0" in.pdf out.pdf

Resize pages to 400 x 200 points, keep orientation.

$ pdfcpu resize "dim:400 200" in.pdf out.pdf

Resize pages to 400 x 200 points, enforce orientation.

$ pdfcpu resize "dim:400 200, enforce:true" in.pdf out.pdf