Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-3585

National characters not correctly displayed in text form field

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 2.0.3
    • 2.0.10
    • AcroForm
    • None

    Description

      I tried to follow workaround suggested in PDFBOX-3138 to be able to display czech national characters in PDF form field. I created sample form in OpenOffice 4.1.3 (file sampleform.pdf) and I created code that adds Type 0 font to existing PDF font and then it replaces current font used in form field.
      I've got 3 problems:

      1. After using PDFont font = PDType0Font.load(doc, new File("fonts/TIMESS__.ttf"));
      the font is not loaded into PDF document resources. It is loaded there once it is used in content stream. OK, I created new dummy page and created dummy text. Finally I can remove the dummy page and the font is still loaded in PDF document resources.

      2. Czech characters are not displayed, you can see just strange square chars. I investigated once I use the czech chars somewhere in content stream in my dummy text then all is displayed correctly (file sampleform_filled.pdf).
      Ok, I did the workaround and I have now file sampleform_filled_workaround.pdf

      3. Now when in Acrobat Reader I click in field with correctly displayed text I can see error "Cannot extract the embedded font 'AAAPNQ+TimesSansSerif'. Some characters may not display or print correctly." This can be workarounded if I flatten the form using acroForm.flatten(); ( file sampleform_filled_workaround_flatten.pdf)

      I'm not sure about root causes for all 3 issues but the behaviour is strange so these issues should be investigated. Attaching java project and PDFs

      Attachments

        1. acrobat_error.png
          38 kB
          rumburak
        2. fontissue.zip
          182 kB
          rumburak
        3. sampleform_filled_workaround_flatten.pdf
          25 kB
          rumburak
        4. sampleform_filled_workaround.pdf
          25 kB
          rumburak
        5. sampleform_filled.pdf
          20 kB
          rumburak
        6. sampleform.pdf
          16 kB
          rumburak

        Activity

          People

            Unassigned Unassigned
            rumburak rumburak
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: