Skip to content

Commit

Permalink
PDFBOX-5797: also modify /DA entries in kid widgets if they exist
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1922555 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
THausherr committed Dec 17, 2024
1 parent a7d9720 commit eae97f6
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.apache.pdfbox.cos.COSStream;
import org.apache.pdfbox.cos.COSString;
import org.apache.pdfbox.pdmodel.PDResources;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationWidget;

/**
* Base class for fields which use "Variable Text".
Expand Down Expand Up @@ -127,6 +128,19 @@ PDDefaultAppearanceString getDefaultAppearanceString() throws IOException
public void setDefaultAppearance(String daValue)
{
getCOSObject().setString(COSName.DA, daValue);

// PDFBOX-5797: Sejda files have a /DA entry in kid widgets
if (getCOSObject().containsKey(COSName.KIDS))
{
for (PDAnnotationWidget widget : getWidgets())
{
COSDictionary widgetDict = widget.getCOSObject();
if (widgetDict.containsKey(COSName.DA))
{
widgetDict.setString(COSName.DA, daValue);
}
}
}
}

/**
Expand Down

0 comments on commit eae97f6

Please sign in to comment.