pdfcpu

Logo

A PDF processor written in Go.

View the Project on GitHub pdfcpu/pdfcpu


Changelog

Merge

Merge 2 or more PDF files into outFile. Have a look at some examples.

Usage

pdfcpu merge [-m(ode) create|append|zip] [-s(ort) -b(ookmarks) -d(ivider) -opt(imize)] outFile inFile...


Flags

name description default required
m(ode) create, append, zip create no
s(ort) sort inFiles if present unsorted no
b(ookmarks) create bookmarks yes no
d(ivider) insert separator between merged docs no no
opt(imize) optimize before writing yes 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
outFile PDF output file yes
inFile… at least 2 PDF input files subject to concatenation yes


Restrictions

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


Examples

pdfcpu respects the order of the provided input files and merges accordingly. Merge three input files into out.pdf by concatenating in3.pdf to in2.pdf and the result to in1.pdf:

$ pdfcpu merge out.pdf in1.pdf in2.pdf in3.pdf


Merge all PDF Files in the current directory into out.pdf and don’t create bookmarks:

$ pdfcpu merge -b=f out.pdf *.pdf


Merge some PDF files into an existing PDF file out.pdf and create divider pages between the merged docuements:

$ pdfcpu merge -mode append -divider out.pdf in1.pdf in2.pdf in3.pdf


Zip two files together (eg. like in 1a,1b,2a,2b..):

$ pdfcpu merge -mode zip out.pdf a.pdf b.pdf