A PDF processor written in Go.

View the Project on GitHub pdfcpu/pdfcpu



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.


pdfcpu resize [-p(ages) selectedPages] -- [description] inFile [outFile]


name description required
p(ages) selected pages no

Common Flags

name description values
v(erbose) turn on logging  
vv verbose logging  
q(uiet) quiet mode  
u(nit) display unit po(ints),in(ches),cm,mm
c(onf) config dir $path, disable
upw user password  
opw owner password  


name description required
description configuration string yes
inFile PDF input file yes
outFile PDF output file no


A configuration string with input parameters for the resize command.

parameter values  
scalefactor 0.0 < s < 1.0 or s > 1.0  
dimensions (width, height) in user units eg. ‘400 200’  
enforce new aspect ratio: on/off true/false  
formsize, papersize paper size to be used. Append L or P to enforce landscape/portrait mode f: A4
bgcolor color none


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 -pages 1-3 -- "sc:.5" in.pdf out.pdf

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