Merge PDF Ubuntu

May 8, 2025 11 min read

Managing PDF files on Ubuntu often requires combining multiple documents into one. Whether you are compiling research, organizing paperwork, or submitting documents to a portal that requires a single file, merging PDFs is a common task. This article provides a comprehensive guide to merging PDF files on Ubuntu, covering both graphical user interface (GUI) and command-line interface (CLI) methods. While BreezePDF excels in simplifying PDF tasks, including adding text, images, signatures, and even merging, this guide focuses on utilizing native Ubuntu tools and utilities for merging PDFs.

Need to Merge PDFs Easily?

BreezePDF offers a free, private, and simple way to merge PDFs directly in your browser.

Create Fillable PDF →

Why Merge PDF Files on Ubuntu?

Merging PDF files offers significant convenience and organizational benefits. Instead of managing numerous individual documents, consolidating them into a single PDF streamlines workflows and reduces clutter. This is particularly useful when dealing with related documents, such as reports, contracts, or collections of articles.

Many online platforms, such as government and academic portals, often require document submissions in a single-file format. Merging PDFs ensures compliance with these requirements, simplifying the submission process. This is especially relevant when applying for jobs, submitting grant proposals, or completing academic assignments. Having all the required information in one accessible PDF makes these processes smoother and more efficient, saving time and reducing potential errors.

GUI Methods for Merging PDFs on Ubuntu

Ubuntu offers several GUI-based tools that simplify the process of merging PDF files. These tools provide user-friendly interfaces and intuitive controls, making them accessible to users of all skill levels. Here are some of the most popular options:

PDF Tricks (via Flatpak)

PDF Tricks is a lightweight application designed for performing various PDF manipulations, including merging. It is available as a Flatpak package, which is a universal package format that works across different Linux distributions. Flatpak ensures that the application runs in a sandboxed environment, minimizing potential conflicts with other system libraries.

Installation of Flatpak (if needed)

First, you need to ensure that Flatpak is installed on your Ubuntu system. If you don't have Flatpak installed, open a terminal and run the following commands:

sudo apt install flatpak
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

The first command installs the Flatpak runtime, while the second command adds the Flathub repository, which hosts a wide variety of Flatpak packages. The Flathub repository allows you to easily install and update applications using Flatpak.

Installing PDF Tricks

After setting up Flatpak, you can install PDF Tricks using the following command:

flatpak install flathub com.github.muriloventuroso.pdftricks

This command downloads and installs PDF Tricks from the Flathub repository. Flatpak will manage the installation process, ensuring that all dependencies are properly handled.

How to use PDF Tricks for merging

  1. Open PDF Tricks from your application menu.
  2. Select the "Merge PDF" option from the main interface.
  3. Add the PDF files you want to merge by clicking the "+" button or dragging and dropping files into the window.
  4. Arrange the files in the desired order by dragging them within the list.
  5. Click the "Merge" button to start the merging process.
  6. Specify the output file name and location for the merged PDF file.

PDF Tricks provides a straightforward interface for merging PDF files quickly and efficiently. Its simple design makes it an excellent choice for users who prefer a minimalist approach to PDF manipulation.

PDF Arranger

PDF Arranger is another powerful GUI tool for manipulating PDF documents, offering a range of features beyond just merging. It allows you to rearrange pages, split PDFs, rotate pages, and more. PDF Arranger provides a visual interface for managing PDF documents, making it easy to perform complex operations.

Installing PDF Arranger

You can install PDF Arranger from the Ubuntu repositories using the following command:

sudo apt install pdfarranger

This command installs PDF Arranger and its dependencies from the official Ubuntu repositories, ensuring a stable and reliable installation process.

Using PDF Arranger

  1. Open PDF Arranger from your application menu.
  2. Drag and drop the PDF files you want to merge into the PDF Arranger window. You can also open them using the "File" menu.
  3. Arrange the pages in the desired order by dragging them within the window.
  4. Save the merged PDF as a single file by selecting "Export" from the "File" menu.

PDF Arranger's drag-and-drop interface makes it easy to rearrange and merge PDF files. It's a versatile tool for managing PDF documents with a wide array of features.

LibreOffice Draw

LibreOffice Draw, part of the LibreOffice suite, is a versatile vector graphics editor that can also be used for merging PDF files. While not specifically designed for PDF manipulation, it offers a flexible way to combine multiple PDF documents into one.

How to merge PDFs using LibreOffice Draw

  1. Open each PDF file with LibreOffice Draw. Each PDF will open in its own Draw window.
  2. In each Draw window, thumbnails of the PDF pages are displayed on the left-hand sidebar.
  3. Drag and drop the thumbnails from the other Draw windows into the main window where you want them to be inserted.
  4. Once all the pages are arranged in the correct order, export the document as a PDF file by selecting "File" > "Export As" > "Export as PDF..."

LibreOffice Draw offers a manual but effective way to merge PDF files, especially useful for users already familiar with the LibreOffice suite. The drag-and-drop functionality provides precise control over the final document structure.

PDFsam Basic

PDFsam Basic is a free, open-source tool specifically designed for splitting and merging PDF files. It provides a user-friendly interface and supports various merging options, including combining entire documents or specific page ranges.

Installation of dependencies necessary:

sudo apt install openjdk-8-jre libopenjfx-jni libopenjfx-java openjfx

Define the variable JAVA_HOME in the path / etc / environment using text editor

Add the following line:

JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/"

Reload the edited file

source /etc/environment

Download the .deb file

wget https://github.com/torakiki/pdfsam/releases/download/v3.3.6/pdfsam_3.3.6-1_all.deb

Install the file

sudo dpkg -i pdfsam_3.3.6-1_all.deb

Start PDFsam by writing its name in terminal

pdfsam

How to merge PDFs using PDFsam Basic

  1. When we want to combine documents, we will click on 'Combine'
  2. On the screen that will be shown, you will have to drag and drop the files in the section dedicated to these

PDFsam Basic offers a robust set of features for managing PDF documents, focusing specifically on splitting and merging functionalities. Its dedicated interface and merging options make it a solid choice for users needing precise control over PDF manipulation.

CLI Methods for Merging PDFs on Ubuntu

For users comfortable with the command line, Ubuntu offers several CLI tools for merging PDF files. These tools are often more efficient and scriptable than their GUI counterparts, making them suitable for batch processing and automated workflows. Here are some popular CLI options:

pdfunite (Poppler Utils)

pdfunite is a simple command-line utility included in the Poppler Utils package, specifically designed for merging PDF files. It offers a straightforward and efficient way to combine multiple PDFs into a single document.

Installation

sudo apt install poppler-utils

Usage

To merge two PDF files (file1.pdf and file2.pdf) into a single output file (output.pdf), use the following command:

pdfunite file1.pdf file2.pdf output.pdf

pdfunite is a quick and easy tool for basic PDF merging tasks. Its simplicity makes it ideal for users who need a fast and efficient command-line solution.

PDFtk (PDF Toolkit)

PDFtk is a powerful command-line tool for manipulating PDF documents, including merging, splitting, and encrypting. It provides a wide range of options for managing PDF files from the command line.

Installation

Due to potential dependency issues, you might need to add a PPA (Personal Package Archive) to install PDFtk:

sudo add-apt-repository ppa:malteworld/ppa
sudo apt install pdftk

Usage

To merge two PDF files (file1.pdf and file2.pdf) into a single output file (output.pdf), use the following command:

pdftk file1.pdf file2.pdf cat output output.pdf

PDFtk offers a more comprehensive set of features compared to pdfunite, making it suitable for advanced PDF manipulation tasks.

Ghostscript

Ghostscript is a versatile interpreter for the PostScript language and PDF files. It can also be used for various PDF manipulations, including merging. While the command-line syntax is a bit more complex, Ghostscript provides a powerful and flexible way to manage PDF documents.

Installation

sudo apt install ghostscript

Usage

To merge two PDF files (file1.pdf and file2.pdf) into a single output file (merged.pdf), use the following command:

gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=merged.pdf -dBATCH file1.pdf file2.pdf

Ghostscript is a powerful tool for PDF manipulation, offering a wide range of options and capabilities. However, its command-line syntax can be challenging for new users.

ImageMagick's convert

ImageMagick is a comprehensive image manipulation tool that can also be used for basic PDF merging. While not specifically designed for PDF merging, its `convert` command offers a convenient way to combine multiple PDF files.

Installation

sudo apt install imagemagick

Basic merging

To merge two PDF files (file1.pdf and file2.pdf) into a single output file (output.pdf), use the following command:

convert file1.pdf file2.pdf output.pdf

Merging specific pages

To merge only specific pages from PDF files, you can use the following syntax (remembering that page numbering starts from 0):

convert file1.pdf[0-1] file2.pdf mergedfile.pdf

This command merges the first two pages of file1.pdf with all pages of file2.pdf into mergedfile.pdf.

Troubleshooting ImageMagick "policy.xml" issues and delegate errors

Sometimes, ImageMagick may encounter issues due to security policies. A common error involves delegates.xml and potential jailed shell restrictions.

To resolve this, you might need to modify the `/etc/ImageMagick-6/policy.xml` file. Open the file with a text editor:

sudo nano /etc/ImageMagick-6/policy.xml

Find the section related to PDF rights and change the rights to `read|write`:

<policy domain="delegate" rights="read | write" pattern="PDF"/>

Save the file and restart ImageMagick or your system for the changes to take effect.

Considerations and Advanced Tips

When merging PDF files on Ubuntu, keep these considerations in mind to ensure a smooth and successful process. These tips can help you optimize your workflow and avoid potential issues.

Order of PDFs

The order in which you specify the PDF files is crucial. The files will be merged in the order they appear in the command or GUI list. Always double-check the order to ensure the final document flows correctly.

Large Files

Merging very large PDF files can sometimes cause performance issues with certain tools, especially GUI-based applications. If you encounter problems, consider using a command-line tool like `pdfunite` or `pdftk`, which are generally more efficient for large files.

GUI vs. CLI

GUI tools offer ease of use and a visual interface, making them suitable for simple merging tasks. CLI tools provide greater control and are often more efficient for batch processing and automated workflows. Choose the method that best suits your needs and technical comfort level.

Specific Page Selection (ImageMagick)

ImageMagick allows you to select specific pages from PDF files to merge. Remember that page numbering starts from 0. For example, `file.pdf[0-2]` selects the first three pages of the PDF. This feature is helpful when you only need to combine certain sections of different documents.

BreezePDF: A Simpler Alternative

While this guide covers various native Ubuntu tools for merging PDFs, BreezePDF offers a simpler and more intuitive solution for many basic PDF tasks. BreezePDF operates entirely within your browser, ensuring your documents never leave your device, maintaining complete privacy. It allows you to create fillable PDFs, add text, images, signatures, and even merge PDFs effortlessly, all without needing to install any software or sign up for an account. BreezePDF also has features to delete pdf pages. It's 100% free!

Conclusion

Ubuntu provides a range of options for merging PDF files, catering to different user preferences and technical skill levels. Whether you prefer the simplicity of GUI tools like PDF Tricks and PDF Arranger or the efficiency of CLI tools like `pdfunite` and ImageMagick, you can find a method that suits your needs. Explore the tools discussed in this guide and discover the best approach for managing and merging your PDF documents on Ubuntu. Remember that while native tools offer robust functionality, BreezePDF provides a convenient, browser-based alternative for quick and easy PDF manipulation.