To merge multiple PDF files into a single PDF on Linux, you can use one of the following tools:
1. Using pdftk
(PDF Toolkit)
Installation:
sudo apt install pdftk-java # Debian/Ubuntu
sudo dnf install pdftk # Fedora
Merge PDFs:
pdftk file1.pdf file2.pdf file3.pdf cat output merged.pdf
- Wildcard Support:
pdftk *.pdf cat output merged.pdf # Merges all PDFs in the current directory
2. Using pdfunite
(from Poppler Utils)
Installation:
sudo apt install poppler-utils # Debian/Ubuntu
sudo dnf install poppler-utils # Fedora
Merge PDFs:
pdfunite file1.pdf file2.pdf file3.pdf merged.pdf
3. Using Ghostscript
Installation (usually preinstalled):
sudo apt install ghostscript # If missing
Merge PDFs:
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=merged.pdf file1.pdf file2.pdf file3.pdf
4. Using a GUI Tool (e.g., PDF Arranger)
Installation:
sudo apt install pdfarranger # Debian/Ubuntu
sudo flatpak install com.github.pdfarranger # Flathub
Usage: Open PDF Arranger, import files, reorder pages, and export as a merged PDF.
Key Notes
- Order Matters: Files are merged in the order they appear in the command.
- Large Files: Ghostscript handles complex PDFs better but may alter formatting.
- Security: Merging password-protected/encrypted PDFs may require decryption first.
Example Workflow
# Merge specific files (pdftk)
pdftk chapter1.pdf chapter2.pdf appendix.pdf cat output book.pdf
# Merge all PDFs in a directory (pdfunite)
pdfunite *.pdf combined.pdf
Choose pdftk
/pdfunite
for simplicity or Ghostscript for advanced PDF manipulation.