How to Merge PDF Files Using the Java PDF Toolkit (jpdfkit) Command Line on Ubuntu, Debian, CentOS, openSUSE, etc. Linux systems
PDF files are a ubiquitous format for document sharing, and sometimes, you may need to merge multiple PDF files into a single document. If you're using Ubuntu Linux, you're in luck because you can easily achieve this using the Java PDF Toolkit, or jpdfkit. In this guide, we'll walk you through the steps to merge PDF files using the command line on your Ubuntu Linux system.
Step 1: Download Java PDF Toolkit (jpdfkit)
Before you can start merging PDF files, you'll need to obtain the Java PDF Toolkit (jpdfkit). You can download it from the official website at following web page,
https://veryutils.com/java-pdf-toolkit-jpdfkit
Step 2: Prepare the PDF Files
Make sure you have the PDF files you want to merge in your current working directory. For this example, let's assume you have three PDF files named file1.pdf, file2.pdf, and file3.pdf that you want to combine into a single PDF file named outputfile.pdf.
Step 3: Merge PDF Files Using jpdfkit
To merge the three PDF files into one, open a Terminal window and run the following command:
java -jar jpdfkit.jar file1.pdf file2.pdf file3.pdf cat output outputfile.pdf
"java -jar jpdfkit.jar": This part of the command runs the Java PDF Toolkit using the JAR file.
"file1.pdf file2.pdf file3.pdf": Replace these with the actual names of the PDF files you want to merge.
"cat output outputfile.pdf": This part instructs jpdfkit to concatenate (cat) the specified input files and save the result as outputfile.pdf.
Your Terminal should display the merging process, and once it's completed, you'll have a single PDF file named outputfile.pdf that contains the contents of the merged PDF files.
You can run jpdfkit Command Line to merge two PDF files easily,
java -jar jpdfkit.jar 1.pdf 2.pdf cat output merged.pdf
Advanced Merging Options
The jpdfkit command line offers advanced merging options that allow you to perform more complex operations. Here are a few examples:
Merge All PDF Files in a Folder
You can merge all PDF files in a folder into a single PDF file using the wildcard character *:
java -jar jpdfkit.jar *.pdf cat output combined.pdf
In this command, *.pdf represents all PDF files in the current directory, and combined.pdf is the name of the output file.
Combine Specific Pages from Different PDFs
You can combine specific pages from different PDF files by specifying the page ranges and input files. For example, to combine pages 1-12 and 14-end from in1.pdf, you can use:
java -jar jpdfkit.jar A=in1.pdf cat A1-12 A14-end output out1.pdf
In this command, A=in1.pdf specifies the input file, and cat A1-12 A14-end instructs jpdfkit to concatenate pages 1 to 12 and pages 14 to the end from in1.pdf. The result is saved as out1.pdf.
Combine Pages from Multiple PDFs
You can also combine pages from multiple PDF files into a new PDF. For example, to combine pages from in1.pdf and in2.pdf, you can use:
java -jar jpdfkit.jar A=in1.pdf B=in2.pdf cat A1-12 A14-end B4 B5 B6 B20-end output out1.pdf
In this command, A=in1.pdf and B=in2.pdf specify the input files. The cat command combines pages 1 to 12 and 14 to the end from in1.pdf and pages 4, 5, 6, and 20 to the end from in2.pdf, creating a new PDF named out1.pdf.
With the Java PDF Toolkit (jpdfkit) and these command-line options, you have the flexibility to merge, concatenate, and manipulate PDF files to suit your specific needs on your Ubuntu Linux system. Whether you're merging multiple documents into one or extracting specific pages, jpdfkit is a powerful tool for managing your PDF files efficiently.
Please find more Java PDF Toolkit (jpdfkit) Command Line examples from following web page,
https://veryutils.com/blog/java-pdf-toolkit-jpdfkit-command-line-examples/
✅ Want to buy this product from VeryUtils?
If you are interested in purchasing this software or developing a customized software based on it, please do not hesitate to contact us.
We look forward to the opportunity of working with you and providing developer assistance if required.