You probably have received PDF files before, and may have plenty of PDF documents lying around in your computer. Deleting them is not an option, and backing them up may take a lot of storage space. One solution is to combine multiple PDF files into one single PDF so it is easier to manage, access and back up. PDFtk Server is a command line tool that allows you to easily combine multiple PDF files into one.
PDFtk stands for “PDF Toolkit” and PDFtk Server allows you to merge PDF documents, split PDF pages into new documents, rotate PDF pages, decrypt and encrypt, update metadata, apply watermarks, and much more. It is free and open source software available for Windows, Linux and macOS. Best of all, it does not require Acrobat or any other Adobe products to work.
Note: There is also a PDFtk Free that is only applicable for Windows that comes a graphical interface where you can add multiple PDF files and merge them into one.
For Linux, in Ubuntu, you can install it with the command:
sudo snap install pdftk
or
sudo apt install pdftk
PDFtk is also available in most repositories so you can easily install it from your package manager/software center.
1. Once you have pdftk installed, you will need to run it from the command line, so start the terminal.
2. Change to the directory containing your PDF files:
cd ~/pdf-directory
3. Decide what order you want the PDF files to appear in the final document. You will use that order when typing the command line string.
4. Type the following string, listing your PDF files in the order you want them to appear:
pdftk file1.pdf file2.pdf file3.pdf cat output newfile.pdf
That is all it takes. Be sure to check the new PDF file to make sure all of the new pages display correctly. The merging process is seamless, painless, and should work on any regular PDF files you have.
To combine multiple documents in a directory without listing each one, use wildcards (*):
pdftk *.pdf cat output newfile.pdf
As an added bonus, pdftk can perform many other tasks. For example, to split a pdf file’s pages into multiple documents, run the following command:
pdftk newfile.pdf burst
This will split the document into single pages that you can then manipulate as you see fit.
With pdftk you can even merge certain pages from within multiple documents into one new document. Just enter the following command:
pdftk A=one.pdf B=two.pdf cat A1-7 B1-5 A8 output combined.pdf
In this case, “A” and “B” are used as “handles” for the names of your documents. You can use as many as you need.
To encrypt your new PDF file, use the following command:
pdftk mydoc.pdf output mydoc_encrypted.pdf owner_pw foopass
where “foopass” is the password you use to encrypt the file. Change to a more secure password for your own usage.
On the other hand, if you have an encrypted PDF file, you can also decrypt it with pdftk:
pdftk mydoc_encrypted.pdf input_pw foopass output mydoc_decrypted.pdf
This only touches the surface of the many functions of PDF manipulation available with pdftk. You can use pdftk --help
or access their online examples to get a good overview of the command.
If you are not using Linux, make sure you check out how to extract pages from PDF in macOS, or how to save as PDF files in Windows 10.
Image credit: Partnership concept with hands putting green and red puzzle pieces together on concrete backgroud by DepositPhotos
Damien, thank you very much for this information. I look forward to every Make Tech Easier that comes into my email, and I save them all in a separate folder, just because there is so much information.