pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Agermose // Conviator ApS ...@conviator.com>
Subject RE: encoding
Date Sun, 09 Feb 2014 19:38:12 GMT
yes. The code is used as part of a webpage where some data is prefilled by my code. At the
moment im just doing

somefield.setValue(myString.replaceall("ø", "oe")); 

and so on - at least its readable and all danes know that oe is ø and aa is å and so on
so its workable but not nice of cause. 

Then the document is streamed to the browser and now the user can edit the rest of the fields
not prefilled and/or change the prefilled fields. Here the user can very well enter øæå
and print it or save it, email it or what ever. 



-----Original Message-----
From: Maruan Sahyoun [mailto:sahyoun@fileaffairs.de] 
Sent: 9. februar 2014 20:32
To: users@pdfbox.apache.org
Subject: Re: encoding

what happens if you enter the form field e.g in Adobe Reader - will it display the text correctly?

Maruan Sahyoun

> Am 09.02.2014 um 20:10 schrieb "Jan Agermose // Conviator ApS" <ja@conviator.com>:
> 
> 
> So Theresia is no way in the current version and supported encoding to write the letter
ø?
> 
> 
> Andreas Lehmkuehler <andreas@lehmi.de> skrev:
> 
> 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
> 
> 



Mime
View raw message