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

NPE at org.apache.pdfbox.pdmodel.interactive.form.PDAppearance.calculateFontSize(PDAppearance.java:551)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8.4, 2.0.0
    • 2.0.0
    • AcroForm
    • None

    Description

      Using SVN trunk revision 1291094 (2012-02-18)
      Getting the following stack trace when trying to call PDField.setValue() on a AcroForm field in the attached document;

      java.lang.NullPointerException
      at org.apache.pdfbox.pdmodel.interactive.form.PDAppearance.calculateFontSize(PDAppearance.java:551)
      at org.apache.pdfbox.pdmodel.interactive.form.PDAppearance.insertGeneratedAppearance(PDAppearance.java:371)
      at org.apache.pdfbox.pdmodel.interactive.form.PDAppearance.setAppearanceValue(PDAppearance.java:281)
      at org.apache.pdfbox.pdmodel.interactive.form.PDVariableText.setValue(PDVariableText.java:131)

      Reason seems to be that PDApperance.getFontAndUpdateResources() returns null, in turn because the font dictionary for the DA of the field ("/Cour 11 Tf 0 g") is not present in the document.

      Attachments

        1. SetPDFFieldValueTest.java
          1 kB
          Damon Li
        2. fw8bene--dft.pdf
          308 kB
          Damon Li
        3. FontTest.java
          2 kB
          Christer Palm
        4. Fonts.pdf
          4 kB
          Christer Palm
        5. 200221.pdf
          18 kB
          Christer Palm

        Activity

          People

            msahyoun Maruan Sahyoun
            cpalm Christer Palm
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: