A PDF processor written in Go.

View the Project on GitHub pdfcpu/pdfcpu



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


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


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

Common Flags

name description values
v(erbose) turn on logging  
vv verbose logging  
q(uiet) quiet mode  
u(nit) display unit po(ints),in(ches),cm,mm
c(onf) config dir $path, disable
upw user password  
opw owner password  


name description required
outFile PDF output file yes
inFile… at least 2 PDF input files subject to concatenation yes


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


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:

$ pdfcpu merge 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