I have some xfdf data as shown here and i need to fill an editable pdf in PHP. Can anyone give me a solution ?
<?xml version="1.0" encoding="UTF-8"?>
<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve">
<fields>
<field name="first_name">
<value>tismon</value>
</field>
<field name="last_name">
<value>varghese</value>
</field>
</fields>
<ids original="dbd3aadc6b6b85761ca83030e0558363" modified="1362548354" />
<f href="unlocked.pdf" />
</xfdf>
$fdf='<?xml version="1.0" encoding="UTF-8"?> <xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve"> <fields> <field name="first_name"> <value>tismon</value> </field> <field name="last_name"> <value>varghese</value> </field> </fields> <ids original="dbd3aadc6b6b85761ca83030e0558363" modified="1362548354" /> <f href="unlocked.pdf" /> </xfdf>'; file_put_contents("file_name.fdf", $fdf);
3.Fill FDF to PDF
or you do this
Note: to make the file output fillable, you just ignore "flatten" in both cases:
exec("$root/resources\PDFtk\bin\pdftk fillablePDF.pdf fill_form file_name.fdf output output.pdf 2>&1");