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 description inFile [outFile] [flags]

Flags

namedescriptionrequired
p(ages)selected pagesno

Common Flags


Arguments

namedescriptionrequired
descriptionconfiguration stringyes
inFilePDF input fileyes
outFilePDF output fileno

factor, hmargin, vmargin, border, bgcolor


Description

A configuration string with input parameters for the zoom command.

parametervalues
factor0.0 < x < 1.0 or x > 1.0
hmarginx < 0 for zooming in, x > 0 for zooming out
vmarginx < 0 for zooming in, x > 0 for zooming out
bordertrue/false, t/f
bgcolorcolor

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 'vmargin: 1, border:true, bgcolor:lightgray' in.pdf out.pdf --unit inch