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

Set border and background color in AcroForm field appearance

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.1, 2.0.2, 2.0.3
    • Fix Version/s: 2.0.3, 3.0.0 PDFBox
    • Component/s: AcroForm
    • Labels:
      None

      Description

      Follow-up on PDFBOX-2918 - set border and background color so that the CreateSimpleForm.java example can be improved with this code, which I've had for some time and forgot to commit:

              // set green border and yellow background
              // if you prefer defaults, just delete this code block
              PDAppearanceCharacteristicsDictionary fieldAppearance
                      = new PDAppearanceCharacteristicsDictionary(new COSDictionary());
              fieldAppearance.setBorderColour(new PDColor(new float[]{0,1,0}, PDDeviceRGB.INSTANCE));
              fieldAppearance.setBackground(new PDColor(new float[]{1,1,0}, PDDeviceRGB.INSTANCE));
              widget.setAppearanceCharacteristics(fieldAppearance);
      

      without needing to call acroForm.setNeedAppearances(true);. While looking at it, I also found a bug in the current code, the border color is set with the non stroking color.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                tilman Tilman Hausherr
                Reporter:
                tilman Tilman Hausherr
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: