I have a question regarding a weird form field behaviour.
- Two pdf documents, both have textfield(s) using Helvetica as a font
- Both are filled with values using the same iText logic (cp. below)
The field value (/V) is correct for both PDFs however the field appearance is not. One Pdf is working fine the other scrambles special character like the euro symbol € or German characters like üöäß. I tried to define a substitute font (as described in the book) however never got € and ß to work.
The only difference I could find is that a /DR dictionary is defined on field level for the non-working PDF (in adition to the global one). But if I remove it, the € sign still doesn't work. Please note, that I am not talking about asian or some exotic unicode characters here - all are part of the standard helvetica font (as the other PDF proves)
Question(s):
- Any ideas how to get the non working PDF to correctly display the characters?
- Or does the PDF violates the pdf spec somehow? (It was created using Acrobat which makes that unlikely but not impossible).
- If you suggest to replace the form field font - how can I differentiate between working and non working PDF files since I don't want to do that for perfectly valid and working files
Update: The code is not the problem (I am certain of that since its the same code for both) however for the sake of completeness here it is:
AcroFields acroFields = stamper.getAcroFields();
try {
boolean successful = acroFields.setField("Mitarbeiter", "öäü߀@");
if (!successful) {
//throw some exception
}
}
catch (DocumentException de) {
//some exceptionhandling
}