File tree Expand file tree Collapse file tree 2 files changed +16
-9
lines changed
pdfbox/src/main/java/org/apache/pdfbox/pdmodel
interactive/annotation/handlers Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Original file line number Diff line number Diff 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 ());
Original file line number Diff line number Diff line change 1919import java .io .IOException ;
2020import org .apache .logging .log4j .Logger ;
2121import org .apache .logging .log4j .LogManager ;
22- import org .apache .pdfbox .cos .COSDictionary ;
23- import org .apache .pdfbox .cos .COSName ;
2422import org .apache .pdfbox .pdmodel .PDFormContentStream ;
2523import org .apache .pdfbox .pdmodel .PDResources ;
2624import org .apache .pdfbox .pdmodel .common .PDRectangle ;
3230import org .apache .pdfbox .pdmodel .interactive .annotation .PDAnnotationHighlight ;
3331import org .apache .pdfbox .pdmodel .PDAppearanceContentStream ;
3432import 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 ))
You can’t perform that action at this time.
0 commit comments