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

Flags

namedescriptiondefaultrequired
m(ode)create, append, zipcreateno
s(ort)sort inFiles if presentunsortedno
b(ookmarks)create bookmarksyesno
d(ivider)insert separator between merged docsnono
opt(imize)optimize before writingyesno

Common Flags


Arguments

namedescriptionrequired
outFilePDF output fileyes
inFile…at least 2 PDF input files subject to concatenationyes

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 out.pdf *.pdf -b=f

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

$ 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