in

How to merge PDF files from the web, desktop, and command line

Getty Images/Tetiana Musiyaka

I’ve had several instances where I needed to add a PDF document to the end of another. You might think that’s as simple as opening both files in a PDF editor and copying the second into the first. However, it’s not that easy.

Remember, PDF files are complex documents composed of several layers. When you export to a PDF, the file is often flattened so the layers can no longer be accessed (similarly to an image editor).

Also: How to use ChatGPT to analyze PDFs (and more) for free

The good news is there are tools for merging PDF documents. I’ll introduce you to those tools and then show you how to complete this task from the Linux command line interface.

<!–>

Web-based services

Several web-based services can merge PDF files. One of the most popular and reliable is Adobe’s PDF Combiner. This service is free and can be used from within any web browser.

There are other web-based PDF combiners, such as:

Those services are easy to use. The task often involves just dragging and dropping the two PDF files into a window, and clicking Merge.

Also: I’ve used Linux for 30 years. Here are 5 reasons why I’ll never switch to Windows or MacOS

My only issue with online editors is whether or not the company keeps a copy of your files. If so, are they encrypted, on trustworthy servers on a hardened network, and is there any guarantee the information in the documents will not be used in any way or sold?

If I’ve scared you away from the web-based editors, maybe you’d better trust a desktop app.

Desktop apps

There are plenty of applications you can install on your desktop (or laptop) that can merge PDF documents. The list of such apps includes:

  • PDF Merger & Splitter
  • Finder in MacOS – Select all the PDFs you want to merge by holding down the Command key, selecting the files with the cursor, and clicking Create PDF.
  • Soda PDF
  • PDFsam

These apps are easy to use and generally only require you to drag and drop the files into order and click Merge.

How to merge a PDF from the command line

Let’s make things trickier by merging two files from the Linux command line. I’ll demonstrate on Pop!_OS. Here’s how.

–> <!–>

We need access to the pdfunite command, which is found in the poppler-utils app. To install this app, open your default terminal window and issue the command:

–>

sudo apt-get install poppler-utils -y

If your distribution is based on Fedora, that command would be:

sudo dnf install poppler-utils -y

Let’s say you have the following PDF files:

  • file1.pdf
  • file2.pdf
  • file3.pdf

The command to merge those three files (in the above order) to a single, new file would be:

<!–>

–> <!–>

pdfunite file1.pdf file2.pdf file3.pdf new_file.pdf

If necessary, you could even merge them out of order, like so:

pdfunite file3.pdf file1.pdf file2.pdf new_file.pdf

Of all the tools available for merging PDF files, I always default to the Linux CLI because it’s fast and easy, and the results are the same as though you were using a GUI app.

Also: The first 5 Linux commands every new user should learn

But if you’re not using Linux, you’ll need to opt for a different tool.

–>


Source: Robotics - zdnet.com

I tried replacing Twitter with Bluesky, Threads, and Mastodon: Here’s what I found

Nearly half of Gen AI adopters want it open source – here’s why