PDF Editing with Perceptive Content & PDFtk Server

Leveraging open source PDFtk Server software is a great way to enhance your current Perceptive Content process by adding functionality to automatically fill out PDF forms. If you have a large number of PDF forms to fill out using predefined data that can be pulled from a database, csv file, or any other source accessible through iScript, you can save a great deal of time with PDFtk instead of resorting to manual data entry.

PDFtk Server is a tool that can be used to fill out a PDF form with an FAF file containing all of the necessary form fields and values requiring an update. With a simple iScript, you can create the FAF file using data pulled from a database, csv file, or another source. Once the FAF file is created, the iScript can run the necessary PDFtk commands required to pair the newly generated FAF file with the PDF Form. The result is a new PDF document containing all of the information defined in the FAF file created through the iScript process.

We’ve put together a proof of concept to display the PDFtk Server functionality. In the video, Geoff Lilienfeld demonstrates the simplicity of combining the FAF file with the original PDF form to create our filled out PDF form output. The FAF file mentioned is where we can define every form field specific to our desired PDF form and enter any value that we want to update the field to. When it comes to PDF forms, the possibilities are endless.

Although the focus of this post has been filling out forms, PDFtk Server can also merge PDFs, split PDFs, rotate PDF pages, flatten forms, apply watermarks, and a number of other things. The great news is that all of this functionality can be accessed through the command line, so all of the functionality can be leveraged through an iScript.


So, what we’ve done is we’ve created a simple command line application that can be called from the Perceptive Content, iScript, and what it does is, it starts, we will just maintain a … we have a PDF here, an image of a W2, which can be obtained from the IRS, of course. We utilize PDFTK to drive the application, which is a free library. So, there’s no licensing there, and of course, you might notice that I’m doing this on a Mac, but this does run the same on Windows, including Windows Server. Then, so, when we’re calling it from Perceptive Content, we’ll pass it the variables, so for every row in a CSV file, it will create an image, and store that image within Perceptive Content, and index it appropriately. In our case here, for the purpose of this demo, I just have some hard coded variables here.

So, if I run this command line, you’ll not that it just created this test W2 output, and that has the data on here. So, if I wanted to change this to anything, control, number 6789abc, save that, rerun this. Let’s go ahead and call this output2, and run that. We’ll now have a new PDF, and you will note that we now have an updated control number. So, again, this can be run from Perceptive Content iScript, and then we will be able to store these images within Perceptive Content, and securely retrieve them from clicking a link within Lawson.