Tuesday, October 16, 2012

Modify a PDF

I received a comment after my recent post on how to combine PDFs. The result was that I was reminded of another PDF tool called pdftk. It's a command line tool that does a lot of things on a PDF files. You can extract pages, burst the entire PDF into individual PDFs and yes, merge multiple PDFs into a single PDF. So, if I wanted to do the merge the same documents with pdftk, the command would be

pdftk source1.pdf source2.pdf source3.pdf cat output merged.pdf

PDFtk can also encrypt or decrypt a PDF. That means putting or removing password protection.
It can even insert a watermark or a stamp. The difference being is that while a watermark is an image underneath the document text, a stamp is an image or lettering on top of the document. An example for this is  a stamp marked "NULL AND VOID" on a document. But that it not the strangest thing it can do.

The strangest thing pdftk can do is fill in PDF forms. It could do it interactively or take the data from an existing FDF file. FDF is the format of the data file that PDF uses. You can look up details on what is an FDF file here.. You could use this to pre-fill forms or auto-fill many forms. How do you auto-fill a PDF form? First, you would fill in the PDF form that saves your input into an FDF file. PDF forms that do this saves the data in a separate FDF file. You can then make copies of the FDF file, change data in the appropriate fields and feed that data back to the PDF form through pdftk. To give an idea of what it looks like, look here.
PDFtk is a free tool developed for book PDF Hacks: 100 Industrial-Strength Tips & Tools.
For Windows users, there is a GUI interface available. It's called PDFtkBuilder. Like the name implies it still calls PDFtk to do the heavy lifting. It just formats the command line correctly. PDFtkBuilder is available here. There is a tool on linux called PDFChain which also uses pdftk on the back-end to do the processing but it currently has some prominent bugs that I can't recommend it.


  1. This link shows you how to remove a password from a PDF file but also points to other free PDF tools. http://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/

  2. Now there is Pdf-Shuffler which is a lot more stable.


Recently Popular