PDFtk on CentOS7

Months ago, I tested it with positive results on either Mac OSX and/or UbuntuĀ 14.04 so now I’m gonna test it on the new CentOS7. If it doesn’t work, I’ll either wipe the VPS and install CentOS6 or Ubuntu 16.04. First, I have to remember how I used the templates I created to test it. Ugh.

Watching The Defenders on Netflix, btw. I wanna like Iron Fist so bad. Loved the comics. Iron Fist, that is, not the Defenders. Except for Defenders: Indefensible.

So, testing process is:

  1. Get form field info using dump_data_fields
  2. Export fdf from a filled-in form using generate_fdf
  3. Import that fdf data to fill in an empty version of that same form via fill_form

I have a PDF form that, filled out, looks like this:

AlbumForm

So, first, I need to get the names of the form fields.

pdftk AlbumFormEmpty.pdf dump_data_fields >AlbumForm.txt

That was successful. Yay. Result looks like this:

textOutputDump

Now, I’ll export the data from the filled-in form’s content — not normally a part of this process, but it’ll quickly get me the data and other shizzle I need for testing.

pdftk AlbumForm.pdf generate_fdf output AlbumData.fdf

Cool cool cool, that worked fine. It’s hideous, but I have it.

Later, I will/would write a PHP script to create such an fdf file out of data from an html form but for now, I’ll put that fdf back into a PDF form:

pdftk AlbumFormEmpty.pdf fill_form AlbumData.fdf output filled.pdf

Perfect. Awesome.

One of the places where I learned stuff:

https://www.sitepoint.com/filling-pdf-forms-pdftk-php/

Advertisements