Skip to content

Commit 191ff09

Browse files
committed
PDFBOX-5938: implement missing method and use it
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1923313 13f79535-47bb-0310-9956-ffa450edef68
1 parent 4a18d61 commit 191ff09

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/form/PDFormXObject.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ public void setFormType(int formType)
121121
}
122122

123123
/**
124-
* Returns the group attributes dictionary.
124+
* Returns the transparency group attributes dictionary.
125125
*
126-
* @return the group attributes dictionary
126+
* @return the transparency group attributes dictionary, never null.
127127
*/
128128
public PDTransparencyGroupAttributes getGroup()
129129
{
@@ -137,7 +137,18 @@ public PDTransparencyGroupAttributes getGroup()
137137
}
138138
return group;
139139
}
140-
140+
141+
/**
142+
* Sets the transparency group attributes dictionary.
143+
*
144+
* @param group a transparency group attributes dictionary.
145+
*/
146+
public void setGroup(PDTransparencyGroupAttributes group)
147+
{
148+
this.group = group;
149+
getCOSObject().setItem(COSName.GROUP, group);
150+
}
151+
141152
public PDStream getContentStream()
142153
{
143154
return new PDStream(getCOSObject());

pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDHighlightAppearanceHandler.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
import java.io.IOException;
2020
import org.apache.logging.log4j.Logger;
2121
import org.apache.logging.log4j.LogManager;
22-
import org.apache.pdfbox.cos.COSDictionary;
23-
import org.apache.pdfbox.cos.COSName;
2422
import org.apache.pdfbox.pdmodel.PDFormContentStream;
2523
import org.apache.pdfbox.pdmodel.PDResources;
2624
import org.apache.pdfbox.pdmodel.common.PDRectangle;
@@ -32,6 +30,7 @@
3230
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationHighlight;
3331
import org.apache.pdfbox.pdmodel.PDAppearanceContentStream;
3432
import org.apache.pdfbox.pdmodel.PDDocument;
33+
import org.apache.pdfbox.pdmodel.graphics.form.PDTransparencyGroupAttributes;
3534

3635
/**
3736
*
@@ -128,10 +127,7 @@ public void generateNormalAppearance()
128127
mwfofrmCS.drawForm(frm2);
129128
}
130129
frm1.setBBox(annotation.getRectangle());
131-
COSDictionary groupDict = new COSDictionary();
132-
groupDict.setItem(COSName.S, COSName.TRANSPARENCY);
133-
//TODO PDFormXObject.setGroup() is missing
134-
frm1.getCOSObject().setItem(COSName.GROUP, groupDict);
130+
frm1.setGroup(new PDTransparencyGroupAttributes());
135131
cs.drawForm(frm1);
136132
frm2.setBBox(annotation.getRectangle());
137133
try (PDFormContentStream frm2CS = new PDFormContentStream(frm2))

0 commit comments

Comments
 (0)