pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Agermose // Conviator ApS ...@conviator.com>
Subject encoding
Date Sat, 08 Feb 2014 16:31:29 GMT
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?
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message