The best way to manipulate PDFs on Linux

The pdftk command offers many choices for working with PDFs, together with merging pages, encrypting recordsdata, making use of watermarks, compressing recordsdata, and even repairing PDFs — simply and on the command line.

Whereas PDFs are typically thought to be pretty steady recordsdata, there’s quite a bit you are able to do with them on each Linux and different programs. This consists of merging, splitting, rotating, breaking into single pages, encrypting and decrypting, making use of watermarks, compressing and uncompressing, and even repairing. The pdftk command does all this and extra.

The title “pdftk” stands for “PDF instrument equipment,” and the command is surprisingly simple to make use of and does an excellent job of manipulating PDFs. For instance, to drag separate recordsdata right into a single PDF file, you’ll 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 comprise all 5 of the paperwork proven and the command will run in a matter of seconds. Word that the cat choice directs the recordsdata to be joined collectively and the output choice specifies the title of the brand new file.

You can even pull choose pages from a PDF to create a separate PDF file. For instance, in the event you needed to create a brand new PDF with solely pages 1, 2, 3, and 5 of the doc created above, you can do that:

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

If, however, you needed pages 1, 3, 4, and 5, we would use this syntax as a substitute:

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

You may have the choice of specifying all particular person pages or utilizing web page ranges as proven within the examples above.

This subsequent command will create a collated doc from one which comprises the odd pages (1, 3, and many others.) and one which comprises the even pages (2, 4, and many others.):

$ pdftk A=odd.pdf B=even.pdf shuffle A B output collated.pdf

Discover that the shuffle choice make this collation doable and dictates the order through which the paperwork are used. Word additionally: Whereas the odd/even pages instance would possibly recommend in any other case, you aren’t restricted to utilizing solely two enter recordsdata.

If you wish to create an encrypted PDF that may solely be opened by a recipient who is aware of the password, you can use a command like this one:

$ pdftk prep.pdf output report.pdf user_pw AsK4n0thingGeTn0thing

The choices present for 40 (encrypt_40bit) and 128 (encrypt_128bit) bit encryption. The 128 bit encryption is utilized by default.

You can even break a PDF file into particular person pages utilizing the burst choice:

$ pdftk allpgs.pdf burst
$ ls -ltr *.pdf | tail -5
-rw-rw-r– 1 shs shs 22933 Aug 8 08:18 pg_0001.pdf
-rw-rw-r– 1 shs shs 23773 Aug 8 08:18 pg_0002.pdf
-rw-rw-r– 1 shs shs 23260 Aug 8 08:18 pg_0003.pdf
-rw-rw-r– 1 shs shs 23435 Aug 8 08:18 pg_0004.pdf
-rw-rw-r– 1 shs shs 23136 Aug 8 08:18 pg_0005.pdf

The pdftk command makes pulling collectively, tearing aside, rebuilding and encrypting PDF recordsdata surprisingly simple. To study extra about its many choices, I take a look at the examples web page from PDF Labs.

Be a part of the Community World communities on




to touch upon matters which can be high of thoughts.


Germany Devoted Server

Leave a Reply