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) -opt(imize)] 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 |
| opt(imize) | optimize before writing | yes | no |
| 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 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 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