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

PDFBox doesn't respect different setting of /DA at PDAnnotationWidget level to /DA at PDField level


    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.4
    • Fix Version/s: 2.0.6, 3.0.0 PDFBox
    • Component/s: AcroForm
    • Labels:


      See the attached file "SF1152.pdf" and locate the "Bureau" field. If you open this document in Acrobat the font size shows as Auto and functions as such in Acrobat/Acrobat Reader. However, PDFBox thinks the font size is set to 9. I confirmed this in both PDFDebugger and in our rendering code.

      The second attachment "TestSF1152-LL.pdf" shows the behavior from PDFBox not picking up the correct Auto font size. The value is truncated unless you click inside the field or delete the value and replace it.

      The following code shows the problem:

                  final PDDocument document = PDDocument.load(ClassLoader.getSystemResourceAsStream("SF1152.pdf"));
                  final PDAcroForm form = document.getDocumentCatalog().getAcroForm();
                  final PDTextField field = (PDTextField)form.getField("Bureau");
                  final COSDictionary dict = field.getCOSObject();
                  String defaultAppearance = ((COSString)dict.getDictionaryObject(COSName.DA)).getString();

      results in:

      /Helv 9 Tf 0 0 0.5 rg

      If I manually set the font size to auto using:

      dict.setString(COSName.DA, "/Helv 0 Tf 0 0 0.5 rg");

      the PDF renders correctly.

      But we shouldn't have to manipulate font sizes in code when it's set correctly in the PDF.


        1. SF1152.pdf
          176 kB
          Scott Coldwell
        2. TestSF1152-LL.pdf
          212 kB
          Scott Coldwell
        3. DifferentDALevels.pdf
          9 kB
          Maruan Sahyoun

          Issue Links



              • Assignee:
                msahyoun Maruan Sahyoun
                scoldwell Scott Coldwell
              • Votes:
                0 Vote for this issue
                6 Start watching this issue


                • Created: