Hi,

Am 08.02.2014 17:31, schrieb Jan Agermose // Conviator ApS:
hi

Im trying to use this code to fill a document. It works - except for encoding 
because of Danish chars: æøå

             PDDocument pdfDocument = PDDocument.load(path);
             PDType1Font font = PDType1Font.HELVETICA;
             //contentStream.setFont(font, 12);

             PDDocumentCatalog docCatalog = pdfDocument.getDocumentCatalog();
             PDAcroForm acroForm = docCatalog.getAcroForm();

             List<PDField> fields = acroForm.getFields();
             for (PDField field : fields) {
                 if (field.getFullyQualifiedName().equals("Text1")) {
                     field.setValue(p.getFornavn() + " " + p.getEfternavn());
             }
             File f = File.createTempFile("ansoegningsyddanmark",".pdf");
             pdfDocument.save(f);


im also trying to change this :
                     field.setValue(p.getFornavn() + " " + p.getEfternavn());
into one of:
                     field.setValue(p.getFornavn() + " " + p.getEfternavn()+ 
"\0153u");
                     field.setValue(new String(p.getBy().getBytes("UTF-16"), 
"ISO8859_1")
in order to try to fix it but its not working.

any ideas how to fix this?
Other encodings as WinANSI aren't yet supported, see PDFBOX-922 [1] for further details.

BR
Andreas Lehmkühler

[1] https://issues.apache.org/jira/browse/PDFBOX-922

Reply via email to