Linux join pdf files

How to Merge Multiple PDF Files into One PDF in Linux

PDF or Portable Document Format files have more to offer to its users apart from the obvious advantages of being easily printable and shareable over a network.

Some other uniqueness of having a file converted or existing in PDF includes the following:

  • eSigning capabilities to give a file the needed authenticity.
  • Built-in security as a PDF file can be protected with passwords.
  • File encryption support.
  • Compact file size support.

Now that you know the advantages and importance of having your document files existing as PDF, there comes a time when you will have multiple inter-related PDF files existing separately.

You might also like:

At this point, collecting and moving these relatable PDF files into a single folder or directory might fix your file reference problem at the cost of efficiency.

You will have to switch between multiple open PDF files to get the bits of information you need from each file. An ideal solution, in this case, will be to merge all these relatable PDF files into a single PDF file.

Create PDF Files in Linux

Before we look at the techniques and approaches of merging multiple PDF files into a single PDF file, let us create three sample PDF files that we will attempt to merge. You can use LibreOffice to create three different word document texts and then export each of them to be saved as PDF files.

Export PDF in LibreOffice

In my case, I created three PDF files for this tutorial article:

PDF Files in Linux

Ways to Merge Multiple PDF Files to a Single PDF File in Linux

We are going to look at two methods of merging multiple PDF files into a single PDF file in Linux. The First method considers merging a selection of PDF files into a single file. The second method considers merging all PDF files within a given folder or directory to a single file.

Method 1: Merging a Selection of PDF Files to a Single PDF File

Let us try to merge pdf1.pdf and pdf2.pdf files into a single file. To achieve this file merging objective, we are going to install and use the pdftk utility.

Reference the following pdftk installation commands in regards to your Linux operating system distribution. Make sure you are a Sudoer user or you have Sudo privileges on your Linux system.

$ sudo apt-get install pdftk [On Debian, Ubuntu and Mint] $ sudo yum install pdftk [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux] $ sudo emerge -a sys-apps/pdftk [On Gentoo Linux] $ sudo pacman -S pdftk [On Arch Linux] $ sudo zypper install pdftk [On OpenSUSE]

To merge our two PDF files, we will reference the following command syntax:

$ pdftk pdf_file_1 pdf_file_2 cat output final_pdf_file

The above command syntax merges pdf_file_1 and pdf_file_2 to a newly created file called final_pdf_file.

Читайте также:  Linux terminal change disk

Let us now merge our pdf1.pdf and pdf2.pdf files:

$ pdftk pdf1.pdf pdf2.pdf cat output pdf12.pdf

Merge PDF Files in Linux

Check for the existence of the merged file:

Check PDF Files in Linux

On opening the pdf12.pdf file, it showcases pdf1.pdf and pdf2.pdf files successfully merged in it.

View PDF Files in Linux

Method 2: Merging All PDF Files to a Single PDF File

In this section, we are going to attempt merging all PDF files inside the “LinuxShellTips PDF” folder without specifying their names.

List PDF Files in Linux

The command syntax to use is as follows:

$ pdftk *.pdf cat output final_pdf_file

In reference to the above command syntax, all files in the directory with a “.pdf” extension will be merged to a newly created PDF file called final_pdf_file.

Let us now merge our files:

$ pdftk *.pdf cat output pdf123.pdf

Merge PDF Files into One PDF

Check for the existence of the merged PDF file:

List Merged PDF Files in Linux

On opening the pdf123.pdf file:

View Merged PDF File in Linux

It accommodates all the three PDF files we created earlier.

Whether you want to merge multiple selections of PDF files or all PDF files existing in a single folder or directory, this article guide has shown you how to get the job done in a seamless manner. We hope this article lessens your file management routines.

Источник

How to Merge PDF Files Using GUI & CLI Tools in Linux

Whether you prefer to use a command-line or graphical application, several tools are available for free to combine multiple PDF files in Linux.

In this article, I’ll help you to merge multiple PDF files into one PDF without breaking the PDF content. Considering the Linux experience level, I’ll use both free command-line and GUI-based applications.

Merge Multiple PDF Files In Linux Using GUI App

Using the graphical app is helpful for not just beginners who find it hard to remember or type commands in a terminal, but also to save time by doing things with a click of a button.

Now there are several Linux software available that combine PDF files into one PDF such as PDF Chain, PDF Arranger, PDFJumbler, and PDF Mix Tool.

Though you’re free to use any of the tools, I’ll use the PDF Arranger app that offers the following important features:

  • Reorder PDF pages
  • Merge multiple PDF documents
  • Export all or selected page from a PDF
  • Delete, rotate, and crop PDF pages
  • Zoom in and out
  • Edit PDF metadata
  • Duplicate pages
  • Page format

Install PDF Arranger On Linux

If you’ve already set up universal package manager Flatpak, you can install PDF Arranger using Flatpak by running a single command:

$ flatpak install flathub com.github.jeromerobert.pdfarranger

However, if you don’t have Flatpak, binary packages of PDF Arranger are also available for several Linux distributions. If none of the installation methods works, you can install it from the source code.

Читайте также:  Параллельный запуск команд linux

Use PDF Arranger to Combine PDFs

Once you install it successfully, open the app and click on the icon at the top left corner. It will pop up a dialog box, where you can select all PDFs you want to merge.

Select PDF Files

Now you can see a list of all pages from the selected PDFs. Here before you combine all pages, you can perform certain actions such as rearrange, delete, export, and edit metadata.

Merge PDF Files

After doing the modification, click on the second or third icon at the top left corner to merge all pages in a single PDF file.

Merge Multiple PDF Files in Linux Command Line

Coming to the command line method of combining multiple PDF files, it can be helpful for system administrators who work on the server without a Linux desktop.

Similar to GUI apps, there are also several command-line tools available such as PDFtk, pdfconcat, Ghostscript, and pdfunite.

For this article I’ll use PDFtk, which comes in three variant:

  • PDFtk Free: a free graphical app
  • PDFtk Server: a free command-line tool
  • PDFtk Pro: paid version with both CLI and GUI app

Being terminal-based does not mean that PDFtk Server lacks features. Like any other graphical PDF merger app, you can use PDFtk Server to perform the following functions:

  • Merge PDF documents or collate PDF page scans.
  • Split PDF pages into a new Document.
  • Rotate PDF pages.
  • Fill PDF Forms with X/FDF data and/or Flatten Forms.
  • Add a background watermark or a foreground stamp.
  • Edit PDF metadata.
  • Attach files to PDF pages and unpack PDF attachments.

Install PDFtk On Linux

The easiest way to install PDFtk on Debian and Ubuntu-based Linux distributions is by running a single command:

$ sudo apt install pdftk-java

For CentOS, Fedora, and Red Hat, you first need to install libgcj dependency.

Then, you can download Binary RPM for Red Hat or CentOS – available for both 32-bit and 64-bit architecture.

If you cannot find a binary file for your Linux distro, you can also compile and build PDFtk Server from its source code.

Use PDFtk to Combine PDFs in Command Line

To join multiple PDFs, you need to give its name in the terminal along with the name of the single combined PDF.

$ pdftk pdf1.pdf pdf2 cat output out1.pdf

Merge PDF Files in Linux Commandline

If you have got a large number of PDFs to combine, you can also use an asterisk (*) wildcards as *.pdf .

$ pdftk *.pdf cat output combined.pdf

PDFtk also allows encrypting and decrypting a PDF using the “owner_pw” and “input_pw” options.

$ pdftk unsecured-1.pdf output secured-1.pdf owner_pw xyz [Encrypt PDF file] $ pdftk secured-1.pdf input_pw xyz output unsecured.pdf [Decrypt PDF file]

To use other features of PDFtk like remove and delete pages from PDF, check out its official manual.

Based on your experience and situation, you can decide whether you want to use a command line or graphical tool to merge multiple PDF files into one PDF. PDF Arranger might seem easy to use on a Linux desktop, but PDFtk can be the choice on a server with no GUI.

Источник

How to Quickly Merge PDF Files on Linux

In this guide I cover merging PDF files on Linux in two different ways: CLI and GUI.

Читайте также:  Junior системный администратор linux

If you’re comfortable at the command-line there’s a cool tool most Linux distributions come with that can do this task; or if you’re more comfortable clicking your way around there’s a user-friendly app for the task, available in most distro’s repos.

Either way, whether you’re a beginner or an experienced Linux user, by the end of this guide you’ll know how to merge PDF files quickly, easily, and all without affecting the quality of the content inside.

Merging PDF Files on Linux

1. Using pdfunite (CLI)

Combining multiple PDF files from the command-line is a cinch on Linux with open source tool pdfunite. Most Linux distributions have this available out-of-the-box (and on those that don’t, you can install the poppler-utils package to get).

To merge PDFs with pdfunite you just need to tell the tool which PDFs to merge into a single file, and give your combined PDF a file name:

  1. Open a new terminal window
  2. Use cd to enter the directory with the PDF files you want to merge
  3. Run: pdfunite file1.pdf file2.pdf output.pdf
  4. Hit enter to let the tool merge the PDF files

That’s it – you just successfully merged PDF files on Linux using pdfunite .

You can check everything merged correctly by opening the output.pdf file (or whatever file name you chose) in your preferred PDF app/document viewer.

2. Using PDF Arranger (GUI)

For a simple task like merging PDF files the (ably named) PDF Arranger app is ideal.

This Python-based app is available in the repos of most modern Linux distributions, though you’ll need to install it yourself (use your preferred method) first. Either search it out by name or drop to the command line and install, e.g., sudo def install pdf-arranger , etc.

  1. Open PDF Arranger
  2. Drag and drop PDFs on to the window
  3. Click to arrange PDFs in to desired order
  4. Go to Menu > Save As…
  5. Give merged file a name, location

Now, I will point out that this particular Python-based tool can do more than merely merge PDFs. You can use it to split multi-page PDFs in to individual ones, rotate PDFs, and (as you probably can guess from the name) rearrange pages inside of PDFs too.

Wrapping Up

In this post I focused on performing one task quickly. While there are a host of other PDF tools you can use to do the same job these are my go-to faves.

For expanded functionality, like editing PDF metadata, adding watermarks, or password protecting documents, you’ll want to look at more powerful apps. You can find plenty of free, (and not-so-free) ones by searching your distro’s repos or browsing sites like Flathub.

Home > How To > How to Quickly Merge PDF Files on Linux

Joey Sneddon

Joey Sneddon is a purveyor of puns and arbitrator of alliteration. Or at least, that’s what he says. When he’s not blogging about Ubuntu on omg! ubuntu! he’s collecting toys, feeding cats, and trying to master his Arch install…

  • omg! linux! — covering the worlds of linux and open source
    • About
    • Privacy
    • Commenting
    • omg! ubuntu!

    Источник

Оцените статью
Adblock
detector