Home / Linux / How to manipulate PDFs on Linux

How to manipulate PDFs on Linux

While PDFs are generally regarded as fairly stable files, there’s a lot you can do with them on both Linux and other systems. This includes merging, splitting, rotating, breaking into single pages, encrypting and decrypting, applying watermarks, compressing and uncompressing, and even repairing. The pdftk command does all this and more.

The name “pdftk” stands for “PDF tool kit,” and the command is surprisingly easy to use and does a good job of manipulating PDFs. For example, to pull separate files into a single PDF file, you would use a command like this:

$ pdftk pg1.pdf pg2.pdf pg3.pdf pg4.pdf pg5.pdf cat output OneDoc.pdf

That OneDoc.pdf file will contain all five of the documents shown and the command will run in a matter of seconds. Note that the cat option directs the files to be joined together and the output option specifies the name of the new file.

You can also pull select pages from a PDF to create a separate PDF file. For example, if you wanted to create a new PDF with only pages 1, 2, 3, and 5 of the document created above, you could do this:

$ pdftk OneDoc.pdf cat 1-3 5 output 4pgs.pdf

If, on the other hand, you wanted pages 1, 3, 4, and 5, we might use this syntax instead:

$ pdftk OneDoc.pdf cat 1 3-end output 4pgs.pdf

You have the option of specifying all individual pages or using page ranges as shown in the examples above.

>> Source Link


Check Also

Master Matlab and Labview with this massive learning kit

When it comes to mastering programming languages, sometimes enough just isn’t enough. This mega-bundle is …