fredmarks
fredmarks

Reputation: 327

PDFtk and XFDF file NOT filling in form

I have a pdf template file with form fields (amount_1, amount_2 etc) I created an XFDF file and am using PDFtk via command line to fill the form and flatten the file.

However, when I run the command below, the new pdf is created but the fields are not filled in.

/usr/bin/pdftk /home/admin/tickets/tickets.pdf fill_form /home/admin/tickets/files/1371711546.xfdf output 1371711546.pdf flatten 

the XFDF looks like this

<?xml version="1.0" encoding="UTF-8"?>
<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve">
<fields>
<field name="amount_1">
<value>$17.00</value>
</field>
<field name="amount_2">
<value>$17.00</value>
</field>
<field name="amount_3">
<value>$17.00</value>
</field>
<field name="amount_4">
<value>$17.00</value>
</field>
</fields>
<ids original="095b7b1e54742b95f30a987149d65453" modified="1371711546" />
<f href="http://test.selebtom.co.zw/tickets/tickets.pdf" />
</xfdf>

Upvotes: 4

Views: 6283

Answers (1)

Aaron
Aaron

Reputation: 3068

I know it's been a while, but just in case someone is researching this, here's the way I solve this problem:

First, if you don't mind removing the XFA format from the file, thereby creating a new pdf 'template' to do your form fills with, then simply, remove extra XML data with the following command line:

"pdftk xfa-pdf-form.pdf output acro-pdf-form.pdf drop_xfa"

If this still gives you trouble, start over with the original XFA file and in LiveCylce save the the file as an Adobe Static PDF form. Or using Acrobat X Pro I think you can do this too. Then repeat the step above, by calling the command line to drop_xfa.

You should have a regular Acroform at this point.

From here you will be able to save the ouput file's data as an XFDF or FDF. Then it's business as usual.

Thanks to @enriquein, who pointing me in the right direction.

Upvotes: 2

Related Questions