You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "John Hewson (JIRA)" <ji...@apache.org> on 2015/04/25 03:32:38 UTC

[jira] [Updated] (PDFBOX-2774) Can't encode Euro with WinAnsiEncoding

     [ https://issues.apache.org/jira/browse/PDFBOX-2774?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

John Hewson updated PDFBOX-2774:
--------------------------------
    Component/s: PDModel

> Can't encode Euro with WinAnsiEncoding
> --------------------------------------
>
>                 Key: PDFBOX-2774
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2774
>             Project: PDFBox
>          Issue Type: Bug
>          Components: AcroForm, PDModel
>    Affects Versions: 2.0.0
>            Reporter: Maruan Sahyoun
>         Attachments: ArialMT.ttf, PdfTest.java, test.pdf, test2.pdf
>
>
> From the users mailing list when trying to set a field value to the Euro sign the following exception occurs
> {code}
> Exception in thread "main" java.lang.IllegalArgumentException: No glyph for U+20AC in font Arial
> 	at org.apache.pdfbox.pdmodel.font.PDTrueTypeFont.encode(PDTrueTypeFont.java:267)
> 	at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:268)
> 	at org.apache.pdfbox.pdmodel.font.PDFont.getStringWidth(PDFont.java:297)
> 	at org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.calculateHorizontalOffset(AppearanceGeneratorHelper.java:564)
> 	at org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.insertGeneratedAppearance(AppearanceGeneratorHelper.java:305)
> 	at org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.createAppearanceContent(AppearanceGeneratorHelper.java:228)
> 	at org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceValue(AppearanceGeneratorHelper.java:203)
> 	at org.apache.pdfbox.pdmodel.interactive.form.AppearanceGenerator.generateFieldAppearances(AppearanceGenerator.java:61)
> 	at org.apache.pdfbox.pdmodel.interactive.form.PDField.updateFieldAppearances(PDField.java:121)
> 	at org.apache.pdfbox.pdmodel.interactive.form.PDTextField.setValue(PDTextField.java:289)
> {code}
> A small test loading the extracted font {{ArialMT}} directly with
> {code}
>     PDTrueTypeFont font2 = PDTrueTypeFont.loadTTF(document, new File("ArialMT.ttf"));
>     font2.encode("€");
> {code}
>  gives the same error whereas using
> {code}
>     PDType0Font font = PDType0Font.load(document, new File("ArialMT.ttf"));
>     font.encode("€");
> {code}
> the error doesn't happen.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org