Q: When I type in non-Latin characters in interactive PDF form fields, some characters vanish or disappear. Why is that so? What can I do to fix this?
A: The problem with non-Latin characters (Greek, Russian, Arabic, Hebrew) disappearing after being entered in an interactive text field has to do with the way that fonts and characters are stored in a PDF document. The PDF format was designed before Unicode, so characters are encoded in a single byte. Therefore the maximum numbers of characters defined in a font descriptor is 255. To use more than 255 characters, a string has to be broken up into sections with each section using a different font and character encoding definition.
When the characters typed inside the form fields are all defined in the font descriptor inside the PDF document, jPDFNotes and jPDFViewer(Qoppa’s java swing components) will work correctly. So for instance, if all Greek characters are defined in the font descriptor, filling interactive forms in Greek will work perfectly.
But sometimes the font descriptor will only define the Latin character set. In this case, jPDFNotes and jPDFViewer will not be able to display the non-latin characters. Unfortunately, we don’t have the technology yet in jPDFViewer to break up a string in different sections. We are only able to work with the characters that are already defined in the font used for a field. When Adobe Acrobat works with fields, it actually creates new font definitions as the characters are entered, so it can handle any range of characters. i.e. I can enter Latin, Greek and Chinese characters in the field and Acrobat will create three separate font definitions for this one field. We plan to implement a similar mechanism in jPDFViewer in the future, but this is a very complicated feature, so it might be some time before we are able to release.
The solution for now for our customers is to make sure that all the characters are defined in the font associated with the interactive form fields.
Note that, for cjk fonts, the issue is currently the same but we will be able to resolve the issue in a simpler way and sooner.