How to Merge Several PDF Files on Ubuntu?
Merging PDF files is essential for combining multiple documents into one PDF file. Ubuntu offers various tools to merge several files. In Ubuntu, merging PDF files reduces the need to open and close several files, making navigating and accessing the necessary information easier.
Instead of having a cluttered folder filled with multiple files, merging them into one document simplifies storing and sharing information. This saves time and reduces the chance of accidentally deleting or misplacing files.
With the importance of merging PDF files on Ubuntu, we have compiled this post to demonstrate various methods/tools to merge PDF files on Linux. All the practical demonstration is carried out on Ubuntu 22.04.
Method 1: Merge Several PDF Files Using pdftk (CLI Method)
The pdftk tool is not installed on Ubuntu by default. Before using it for editing, let’s install it first using the command provided below:
sudo snap install pdftk
The successful execution of the command ensures that the tool has been installed.
Step 1: Locate the PDF to be Merged
To locate the PDF files, type the below-given command:
Test1.pdf and Test2.pdf will be merged.
Step 2: Merging Several pdf Files
At this stage, we will merge the Test1.pdf and Test2.pdf in a single pdf file with the name mergedTest.pdf:
pdftk Test1.pdf Test2.pdf cat output mergedTest.pdf
After successfully running the command, you will find an output like the one mentioned in the screenshot above.
Repeat the ls command to show whether the output was generated successfully or not.
It can be shown above that several pdf files are merged in a single file with the name tag mergedTest.pdf:
You can verify the mergedTest.pdf by opening the file in a PDF reader. The image is attached below for your reference.
This was all about merging the PDF using the pdftk tool.
Method 2: Merge Multiple PDF Files Using pdfsam (GUI Method)
Like pdftk, the pdfsam tool needs to be installed before its being used to merge the PDF files. The command provided below is used to install the pdfsam tool on Ubuntu:
sudo apt install pdfsam -y
The pdfsam tool has been installed on the system.
Step 1: Launch the pdfsam Tool
Open the applications menu and search for the pdfsam tool. Once launched, you can see the Merge option as shown below:
Step 2: Load PDF Files
Add multiple pdf files from the destination path by clicking Add button, as presented in the below-given screenshot:
Locate the pdf files that need to be merged in a single pdf file, i.e., Home/linuxuser > Test1.pdf + Test2.pdf > Open.
Step 3: Merge PDF File
When you open the PDF files, they appear in the Add list:
– Select the destination file for the output file.
– Click on the Run button.
Open the destination path to confirm the merged file in PDF format:
Open the output file with any PDF reader to examine the content inside the file:
That’s how you can merge the PDF files using the pdfsam tool.
Ubuntu, the most used Linux distribution, offers the Command Line and GUI support to merge PDF files. The pdftk tool offers command line support, while the pdfsam is a GUI to serve the same purpose. Both these tools are third-party and not available on Ubuntu by default. However, these can be installed easily using the commands in this post. This post has also provided a practical demonstration of merging several PDF files on Ubuntu.