pdfcpu

Logo

PDF tooling for Go and the command line.

View the Project on GitHub pdfcpu/pdfcpu


Changelog
Future Directions

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 file, use - to read from stdinyes
outFilePDF output file, use - to write to stdoutno

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


Zoom a streamed PDF and upload the result:

$ aws s3 cp s3://acme-presentations/deck.pdf - \
   | pdfcpu zoom 'hmargin: 10' - - \
   | aws s3 cp - s3://acme-presentations/deck-with-margin.pdf