File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -2197,9 +2197,16 @@ def _pushPopGS(contents, pdf):
21972197 # adds a graphics state "push" and "pop" to the beginning and end
21982198 # of a content stream. This isolates it from changes such as
21992199 # transformation matricies.
2200- stream = ContentStream (contents , pdf )
2201- stream .operations .insert (0 , [[], "q" ])
2202- stream .operations .append ([[], "Q" ])
2200+ if not isinstance (contents , ArrayObject ):
2201+ contents = [contents ]
2202+ data = BytesIO ()
2203+ data .write (b"q\n " )
2204+ for item in contents :
2205+ data .write (item .getData ())
2206+ data .write (b"\n " )
2207+ data .write (b"Q\n " )
2208+ stream = DecodedStreamObject ()
2209+ stream .setData (data .getvalue ())
22032210 return stream
22042211 _pushPopGS = staticmethod (_pushPopGS )
22052212
You can’t perform that action at this time.
0 commit comments