File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
layout/src/main/java/com/itextpdf/layout/renderer Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,17 @@ protected void flushSingleRenderer(IRenderer resultRenderer) {
109
109
if (toTag ) {
110
110
tagPointer = canvas .getPdfDocument ().getTagStructureContext ().getAutoTaggingPointer ();
111
111
tagPointer .setPageForTagging (canvas .getPage ());
112
- tagPointer .setContentStreamForTagging (canvas .getPdfCanvas ().getContentStream ());
112
+
113
+ boolean pageStream = false ;
114
+ for (int i = canvas .getPage ().getContentStreamCount () - 1 ; i >= 0 ; --i ) {
115
+ if (canvas .getPage ().getContentStream (i ).equals (canvas .getPdfCanvas ().getContentStream ())) {
116
+ pageStream = true ;
117
+ break ;
118
+ }
119
+ }
120
+ if (!pageStream ) {
121
+ tagPointer .setContentStreamForTagging (canvas .getPdfCanvas ().getContentStream ());
122
+ }
113
123
}
114
124
resultRenderer .draw (new DrawContext (canvas .getPdfDocument (), canvas .getPdfCanvas (), toTag ));
115
125
if (toTag ) {
You can’t perform that action at this time.
0 commit comments