pdfcpu

Logo

A PDF processor written in Go.

View the Project on GitHub pdfcpu/pdfcpu


Changelog

Trim

Generate a trimmed version of inFile for selected pages. Have a look at some examples.

Usage

pdfcpu trim -p(ages) selectedPages inFile [outFile]


Flags

name description required
p(ages) selected pages yes


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 default
inFile PDF input file yes  
outFile PDF output file no inFile


Restrictions

The following PDF elements are not carried over into the trimmed document:


Examples

Get rid of unwanted blank pages:

$ pdfcpu trim -pages even test.pdf test_trimmed.pdf


Create a single page PDF file for a specific page number:

$ pdfcpu trim -pages 1 test.pdf firstPage.pdf


Get rid of the catalog and trailing index:

$ pdfcpu trim -pages "!2-4,!12-" book.pdf essence.pdf