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:
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:
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:
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 (*):
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:
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:
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:
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:
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.
Image credit: Partnership concept with hands putting green and red puzzle pieces together on concrete backgroud by DepositPhotos