Merge multiple PDFs into one.
Requirements: Java 8+
- Download the prebuilt distribution from the project's Releases page, or build it yourself (see instructions below).
- Extract the
pdfmerge-<version>.zip
file where you want. - Add the
bin
directory inside the extractedpdfmerge
directory to yourPATH
. - Confirm that you are able to run the program with
pdfmerge --version
.
To confirm your installation you can display the help message by issuing:
pdfmerge --help
The output should be similar to this:
Usage: pdfmerge [-fhV] -o=OUTFILE FILE FILE...
Merge multiple PDF FILEs into OUTFILE.
FILE FILE... Path to the files to be merged.
-f, --force Overwrite OUTFILE.
-h, --help Show this help message and exit.
-o, --output=OUTFILE Path to the output file.
-V, --version Print version information and exit.
Usage is very simple: first, you have to specify the output file with the -o
/ --output
option.
Then you have to specify at least two input files:
pdfmerge -o path/to/output.pdf path/to/input1.pdf path/to/input2.pdf
If the output file already exists the program will not overwrite it and it will exit with an error.
To overwrite the output file use the -f
/ --force
option:
pdfmerge -f --output existing.pdf input1.pdf input2.pdf
The program only accepts file paths; but you can use globs to reference PDFs in a directory:
pdfmerge -o output.pdf mypdfs/*.pdf
Requirements: JDK 8+
The build defaults to building the ZIP file.
To run the unit tests and build the ZIP file execute:
./mvnw package
To do all of the above and also run the integration tests execute:
./mvnw verify
The built ZIP file will be in the target
directory.
To build an executable JAR that contains all dependencies use the fatjar
profile:
./mvnw package -Pfatjar
The built pdfmerge.jar
will be in the target
directory.
You can use it like this:
java -jar pdfmerge.jar <options>
This project is heavily building on these libraries:
Both libraries are licensed under the Apache License version 2.0.
Gábor Némethi - nemethi
Project - https://github.com/nemethi/pdfmerge
This project is licensed under the MIT License. See the LICENSE file for more information.