Computer >> Computer tutorials >  >> System >> Linux

How to Combine PDF Files on Windows and Linux

How to Combine PDF Files on Windows and Linux

You have probably received PDF files before and may have many PDF documents stored in your computer. Deleting them is not an option, and backing them up may take up a lot of storage space. One solution is to combine/merge multiple PDF files into a single PDF so that 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.

How PDFtk Works

PDFtk stands for “PDF Toolkit.” 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, 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, applicable only for Windows. It’s a graphical interface that allows you to add multiple PDF files and merge them into one.

How to Install PDFtk on Linux

For Linux (using 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.

How to Combine PDF Files on Windows and Linux

Using PDFtk to Combine Multiple PDFs

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 in which 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 be 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

How to Split, Encrypt, and Decrypt PDFs Using PDFtk

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 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 and save as PDF files in Windows 10.

Using PDFtk Free on Windows

While you can use the command line version of PDFtk on Windows, PDFtk Free offers an easier-to-use graphical interface. The great part is that both PDFtk Server and PDFtk Free come together in a single installation, so you get both. Feel free to use either option. The following instructions, though, apply to PDFtk Free.

The free version doesn’t have quite as many features but does still merge PDFs together. The premium upgrade is just $3.99 if you want to switch.

How to Combine PDF Files on Windows and Linux

Press “Add PDF” to add the PDF files you want to merge. Files are added to the list in the order you select them, but you don’t need to worry about the order right now.

How to Combine PDF Files on Windows and Linux

Once added, simply drag and drop the files to create the order you want. You can also double-click the “Pages to Copy” field to select any pages you want to copy in your merged PDF. Use the “Copy Selection” and “Remove Selection” buttons to copy a selection to add it twice or remove a selection.

When you’re ready, press “Create PDF” at the bottom of the window. You can also choose to open the newly created PDF or show the location of the PDF in the “Afterwards” drop-down menu.

How to Combine PDF Files on Windows and Linux

Using PDF Arranger to Merge PDF Files on Linux and Windows

If you find PDFtk too complicated for you, another application you can use to merge PDF files is PDF Arranger.

PDF Arranger is a fork of the old pdfshuffler and it is a small python-gtk application which allows the user to merge or split PDF documents and rotate, crop and rearrange their pages using a simple graphical interface.

You can install PDF Arranger from the Software Center or your package manager. For Windows, you can download the msi installer here.

1. Once installed, open PDF Arranger.

2. Click the “Open a file” icon. Select the PDF files you want to combine.

How to Combine PDF Files on Windows and Linux

3. From here, you can drag to arrange the PDF pages. You can also delete pages from the file or even rotate and crop.

4. Once you are done, save it to a new file.

Beyond Merging PDFs

Merging PDFs is great and all, but there’s so much more PDFtk is capable of. Naturally, PDFtk Free is limited, but one thing you can still do in both PDFtk Server and PDFtk Free is split PDFs.

1. For PDFtk Free, select the PDF you want to split.

2. Double-click the “Pages to Copy” field.

3. Select the page numbers or range for the first section you want to split. You can save the split portion using a new name to avoid replacing the original PDF.

4. Repeat the process to split the file into multiple parts.

How to Combine PDF Files on Windows and Linux

For Linux, you’ll need to remove pages from the output file. You can remove as many pages as you need. Use the following as an example:

pdftk A=in1.pdf cat A1-12 A14-end output out1.pdf

Other things you can do with PDFtk Free include:

  • Rotate (premium only)
  • Add stamps or watermarks (premium only)
  • Encrypt documents (premium only)

Other things you can do with PDFtk Server (both Linux and Windows) include:

  • Rotate pages
  • Encrypt and decrypt pages
  • Fill out PDF forms
  • Add stamps and watermarks
  • Repair corrupted files (not always possible butdoes recover the file if possible)
  • Add PDF bookmarks and metadata
  • Break a PDF into single pages
  • Unpack attachments
  • Attach files to PDF documents

As you can see, this seemingly simple tool can do so much more than merge PDF files. Once you get the hang of the commands, it’s a great all-in-one PDF utility.

Frequently Asked Questions

1. How can I make using the command-line version of PDFtk easier on Windows?

The most difficult part is typing the entire file path name. Open the GUI version, add your files to it, then drag and drop them into the command prompt one at a time to copy the file path over.

2. What PDFtk commands are available?

While command-line examples have been linked above, the PDFtk Server Manual gives you a more comprehensive look at the various commands to work with all the features available.

3. Is PDFtk Really Free?

Yes, but there are premium options available. You can buy PDFtk Pro for the full GUI version, but that’s not necessary to merge or split PDFs.

Also, if you need commercial support for use in a business, you can purchase a one-year service agreement for $79/year.

Wrapping Up

If you’re tired of trying to organize related PDFs in folders, just use PDFtk to merge PDF files. There’s ample documentation and tutorials at PDF Labs to help you learn how the command line tools work. Alternatively, you can also use PDF Arranger if you prefer to deal with a graphical interface. You can also learn how to combine scanned documents on macOS and convert a PDF to a Microsoft Word document.