How to Easily Split or Merge PDF Files in Linux
Here is a simple tutorial on how you can split/merge PDF files in Linux. If you don’t want to use CLI (Command Line Interface), I have also included a simple GUI application that you can use for the same purpose. Lets get started.
Split / Merge PDF in Linux using Poppler
Poppler, a very simple and easy to use tool that use can use to manipulate, split & merge PDFs in Linux.
It is available in official repositories of almost all major Linux distributions and their derivatives.
To install Poppler in Ubuntu & Debian based systems, use command:
sudo apt install poppler
Arch Linux based systems:
sudo pacman -S poppler
sudo yum install poppler-utils
sudo is only needed if you are not using the root account.)
To use it, open a terminal window and cd into the directory where the PDF files are.
For Merging PDFs, type:
pdfunite file1.pdf file2.pdf outputfile.pdf
Here, file1.pdf & file2.pdf represent two individual PDF files and the outputfile.pdf is both of them merged together.
For Splitting PDFs, type:
pdfseparate multiplepages.pdf output-page%d.pdf
multiplepages.pdf is a PDF document with multiple pages, outputpages%d.pdf is the output. %d will automatically get replaced with page numbers and will present you will multiple PDF files, each containing a single page from the main (multiplepages.pdf) PDF.
On Linux, pdftk has been ported as a java-based app and is available on the repositories of Debian, Ubuntu, Arch Linux and their derivatives.
To Install pdftk on Ubuntu/Debian, type in:
sudo apt install pdftk-java
On Arch Linux:
sudo pacman -S pdftk
For CentOS/Fedora/RHEL, pdf is not available in the reposotries but you can install the rpm package.
To merge pdf files using pdftk, type:
pdftk file1.pdf file2.pdf file3.pdf output file_output.pdf
Replace file1/file2/file3.pdf with your input pdf files and file_output.pdf with the name that you want the output file to have.
To split a pdf file in pdftk, type:
pdftk multiplepages.pdf burst
Here, replace multiplepages.pdf with your pdf file name.
This does it for the CLI pdf splitting/merging tools. Now here is a recommendation for the users out there who want to use a Graphical tool to combine pdf in Linux or splitting them.
PDF Arranger (a fork of pdf Shuffler)
PDF Arranger is a easy to use Graphical PDF tool for Linux users. What it can do is made pretty much clear by its name. It can re-arrange, rotate, merge and split PDF files. This gtk based app is fork of now discontinued PDF Shuffler.
To merge or split a PDF in PDF Arranger, you can either open the PDF file via the apps menu or simply drag n drop it onto the apps window. You can do this for multiple PDF files.
It will show you all the pages from the files that you have loaded and from there you can re-arrange, remove, & merge pages at will.
While I prefer to use CLI tools, PDF Arranger is a good choice if you do this type of work quite often and most of your workflow is on GUI applications.
This concludes my post on how you can split & merge PDFs in Linux. Have other awesome PDF tools that you use and want to share? Drop down a comment below to let others know.