pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fritteng...@fettabernett.de
Subject Populate PDF form with special characters
Date Mon, 31 Jan 2011 08:58:05 GMT
Hi there,

hopefully you can help me with the following usecase: I have a third party pdf file containing
a form. My task is to populate the form's fields with content. This works fine except for
special characters like the german umlauts or the EURO-character. I stumbled upon posts suggesting
to use a custom TrueTypeFont for inserting values, but alas I did not find a way to do this.
Could someone please reply with an idea how to do this?

Below you will find the code snippet I am using:

<pre>

PDDocument document = null;
try {
 document = PDDocument.load(template);
} catch (IOException e) {
 throw new RuntimeException("...");
}

PDAcroForm acroForm = document.getDocumentCatalog().getAcroForm();

List<PDField> fields = acroForm.getFields();
for (PDField field : fields) {
 ((PDTextbox) field).setValue(string); // <- "string" is an UTF-8 encoded String like "äöü߀"
}

</pre>

Best regards,
Stephan
-- 
NEU: FreePhone - kostenlos mobil telefonieren und surfen!			
Jetzt informieren: http://www.gmx.net/de/go/freephone

Mime
View raw message