How to Merge PDF files on Linux?

There are different formats for presenting the documents; one of them, which is popular as well appreciated worldwide, is the pdf format, and the pdf (Portable Document Format) is used to save and share documents with other users. Pdf documents are more reliable and can be opened in any operating system. The pdf files are non-editable and can be edited using some pdf readers.

In this blog, we will elaborate on how we can merge different pdf files into one file, and the content is as follows.

  • Using the PDFtk Tool
  • Using the PDF Arranger Tool

Let’s get into the first tool first.

Method 1: Merge the PDF Files Using the PDFtk

This section utilizes the PDFtk tool to merge PDF files in Linux. Furtherly, the process of its installation is also provided.

How to Install the PDFtk on Linux?

The installation of the package varies as per the Linux distributions.

For Debian/Ubuntu-based Distros:

$ sudo apt install pdftk-java

The package will be installed in Ubuntu-based Linux distribution.

For RPM-based Linux distributions:

Download the rpm package and install it through the rpm manager as follows:

$ wget https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk-2.02-1.el6.x86_64.rpm 
$ sudo rpm -i <package-name>.rpm

How to Use the PDFtk on Linux?

To use the PDFtk on Linux, the general usage syntax of the “PDFtk” to convert files is:

$ pdftk [file1] [file2] cat output [combined file]

Replace the file1 and file2 with the pdf file name you want to merge and then replace combine file with the single file name you suppose to get after merging the files. For example, we will merge our two pdf files:

$ pdftk mypdf.pdf mypdf1pdf cat output New_pdf.pdf

To confirm the new merge file, list down the contents:

$ ls

Similarly, to merge all the available pdf files into a single pdf file, use the command:

$ pdftk *.pdf cat output ALL_COMBINED.pdf

It will convert all the pdf files which are having the pdf extension in their names to a single new file.

Method 2: Merge the PDF Files Using the PDF Arranger

The PDF Arranger is a GUI tool that can be installed on various Linux distributions using the Flatpak Utility. Let’s get into the installation method first and then its usage. 

How to Install PDF Arranger on Linux?

To install PDF Arranger on Linux distributions:

$ flatpak install flathub com.github.jeromerobert.pdfarranger

Or the following commands can be used to install it on Linux.

For Debian/Ubuntu-based:

$ sudo apt install pdfarranger

For Fedora-based:

$ sudo dnf install pdfarranger

In the next section, we will find out how to use the PDF Arranger in Linux.

How to Use the PDF Arranger in Linux?

After installing the PDF Arranger in your Linux distribution, launch the application, then click on the “Open” icon to upload the PDF Files:

Choose the PDF Files and open them:

After selecting the Pages of the PDF File which are supposed to be merged, click on the ”Save as” icon:

Save the file with some name:

List down the contents to show the new merged pdf file:

$ ls

These are the methods by which the PDF files can be merged on Linux.

Conclusion

To merge PDF files on Linux, pdftk, a command-line tool, and PDF Arranger a GUI tool can be installed on Linux. There are other tools, like ImageMagick and PDF Chain, but the popular pdf mergers are discussed in this blog. This article will demonstrate the usage of merging PDF files on Linux.