Skip to content

Commit

Permalink
Merge branch 'main' into as-fast-as-pdfrw
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinThoma authored Aug 20, 2023
2 parents ebadbc1 + b532fa4 commit 2b0b040
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pypdf/_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -882,12 +882,17 @@ def _content_stream_rename(

@staticmethod
def _push_pop_gs(
contents: Any, pdf: Union[None, PdfReaderProtocol, PdfWriterProtocol]
contents: Any,
pdf: Union[None, PdfReaderProtocol, PdfWriterProtocol],
use_original: bool = True,
) -> ContentStream:
# adds a graphics state "push" and "pop" to the beginning and end
# of a content stream. This isolates it from changes such as
# transformation matricies.
stream = ContentStream(contents, pdf)
if use_original:
stream = contents
else:
stream = ContentStream(contents, pdf)
stream.operations.insert(0, ([], "q"))
stream.operations.append(([], "Q"))
return stream
Expand Down

0 comments on commit 2b0b040

Please sign in to comment.