pdfcpu

Logo

A PDF processor written in Go.

View the Project on GitHub pdfcpu/pdfcpu


Changelog

Zoom

Zoom in/out of selected pages either by magnification factor or corresponding margin.
Optionally when zooming out draw a border around content and/or fill unused page space with some background color.

Have a look at some examples.

Usage

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


Flags

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  
-o(ffline) disable http traffic  
c(onf) config dir $path, disable
opw owner password  
upw user password  
u(nit) display unit po(ints),in(ches),cm,mm


Arguments

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

factor, hmargin, vmargin, border, bgcolor


Description

A configuration string with input parameters for the zoom command.

parameter values
factor 0.0 < x < 1.0 or x > 1.0
hmargin x < 0 for zooming in, x > 0 for zooming out
vmargin x < 0 for zooming in, x > 0 for zooming out
border true/false, t/f
bgcolor color

Zoom in and out of page content by some factor.

Zooming out results in some horizontal and vertical margins implied by unused page content space. Usually these will not be equal.

Another way to look at zooming is eg. I’d like to zoom out a little in order to create some desired horizontal or vertical margin.


Examples

Given in.pdf:

Zoom in by factor.

$ pdfcpu zoom -- "factor: 2"  in.pdf out.pdf


Zoom out by factor.

$ pdfcpu zoom -- "factor: .5"  in.pdf out.pdf


Zoom out by horizontal margin of 10 points.

$ pdfcpu zoom -- "hmargin: -10" in.pdf out.pdf


Zoom out by vertical margin of 1 inch. Draw border around content and fill background light gray.

$ pdfcpu zoom -unit inch -- "vmargin: 1, border:true, bgcolor:lightgray" in.pdf out.pdf