Introduction
Java developers working with PDF documents are always looking to enhance functionality in their document workflows.
There is a large selection of Java PDF SDK libraries for them to choose from, one of the key feature is PDF merging.
PDF merging is an important requirement for use cases such as streamlining user downloads, consolidating reports and automate back-office processes to name a few. Though most Java libraries have the feature, the ease of use can vary.
JPedal’s Merging Feature
In the latest JPedal release, we added the feature preview for merging PDF files together.
We are still developing this feature, so the API is subject to change, but today I am going to show you how it works.
Merge two PDF files using Java
Here’s a simple example demonstrating how to merge two PDF files using JPedal’s API:
PdfMerge.mergeFiles(new File("inputFile1.pdf"), new File("inputFile2.pdf"), new File("outputFile.pdf"));
Merge two PDF files using the command line
You can also merge PDF files using Java straight from the command line.
java -cp jpedal.jar org.jpedal.tools.PdfMerge inputFile1.pdf inputFile2.pdf outputFile.pdf
Please let us know if you have any feedback about this feature preview!
Conclusion
As shown above, JPedal’s new merge feature provides a straightforward way to combine PDF files-either through a concise Java API or directly from the command line.
If you have any questions, you can view the full documentation for the PDF merging feature. You can also read from our extensive repository of posts to learn more about the PDF format.