I'm used to fill PDF forms from PHP using PDFTK. Recently, I was asked to insert a code-128 barcode in a PDF. To do so, I created a PDF with several text fields for human-readable entries plus a special text fields which text is render with a special font that represents code-128 symbols. This font can be found here: http://www.jtbarton.com/Barcodes/Code128.aspx. The only difference between human-readable and barcode fields is the font used to display the characters.
Up to this step, everything works fine. With Adobe Reader, I am able to copy-paste a prepared barcode into my special field, it renders just fine, this code can be scanned by barcode readers. A sample example is Ñ000002HÓ (Ñ is a starter, then is my data 000002, the checksum H follows, and the whole ends with the stopper Ó).
Then I get into troubles when trying to fill the form with PDFTK. If I try to fill my special field with Ñ000002HÓ it only renders characters in the ASCII table (ie 000002H) and displays some kind of squares instead of the expected barcode symboles for Ñ and Ó. More surprising, trying to fill human-readable fields with the exact same Ñ000002HÓ phrase works like a charm.
I verified both kind of fields receive the exact same characters sequence (including utf-8 encoding), I checked the font was well embedded in order to prevent display issues, I ensured the XFDF file is well-formed, etc.
Here a XFDF sample used to fill a PDF form with fields named 'human' and 'barcode'
<?xml version="1.0" encoding="UTF-8"?>
<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve">
<fields>
<field name="human"><value>Ñ000002HÓ</value></field>
<field name="barcode"><value>Ñ000002HÓ</value></field>
</fields>
</xfdf>
I'm afraid I have no more ideas how to solve this issue. If you do, your help would be much appreciated.