Tilman Hausherr created PDFBOX-4152:
---------------------------------------

             Summary: Glyphs don't appear properly in form with embedded type1 
font with DictionaryEncoding
                 Key: PDFBOX-4152
                 URL: https://issues.apache.org/jira/browse/PDFBOX-4152
             Project: PDFBox
          Issue Type: Bug
          Components: AcroForm
    Affects Versions: 2.0.8
            Reporter: Tilman Hausherr
         Attachments: PDFBOX-1084-mod-after.pdf, PDFBOX-1084-mod-before.pdf

I'm trying to reproduce a problem mentioned in the user mailing list 
("International characters only show correctly when form field is selected") 
with a confidential file that isn't shared. We know from screenshots is that it 
is a type 1 font with DictionaryEncoding. The only file I found is the one from 
PDFBOX-1084.

The original file was changed with this code so that all text fields have an 
embedded font with DictionaryEncoding that isn't used in the original form:
{code:java}
        try (PDDocument doc = PDDocument.load(new File("PDFBOX-1084.pdf")))
        {
            doc.getDocumentCatalog().setViewerPreferences(null);
            PDAcroForm acroForm = doc.getDocumentCatalog().getAcroForm();
            for (PDField field : acroForm.getFieldTree())
            {
                if (field instanceof  PDTextField )
                {
                    PDTextField tf = (PDTextField) field;
                    String da = tf.getDefaultAppearance();
                    if (da.startsWith("/HeBo"))
                    {
                        tf.setDefaultAppearance("/HelveticaNeue-Italic" + 
da.substring(5));
                        field.setValue(field.getPartialName());
                    }
                }
            }
            doc.save("PDFBOX-1084-mod.pdf");
        }
{code}
On the modified file, this code was run:
{code:java}
acroForm.getField("f1_09(0)").setValue("Stanisław äöüÄÖÜß");
{code}
PDFBox shows the field content but the ł is hard to see. Adobe Reader doesn't 
show the ł, and when clicking on the field, it shows the ł but not the german 
umlauts. Amusingly, if I copy & paste the mess that I get, it's umlauts again.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to