Skip to content

Commit

Permalink
feat(pdfinterp): add on_new_stream call and method
Browse files Browse the repository at this point in the history
- call on_new_stream in pdfinterp.py to reset color spaces
- implement on_new_stream in il_creater.py to reset stroking and non-stroking color space names
  • Loading branch information
awwaawwa committed Jan 20, 2025
1 parent 45a71ae commit 226b0d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions yadt/document_il/frontend/il_creater.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ def on_stroking_color_space(self, color_space_name):
def on_non_stroking_color_space(self, color_space_name):
self.non_stroking_color_space_name = color_space_name

def on_new_stream(self):
self.stroking_color_space_name = None
self.non_stroking_color_space_name = None

def on_page_start(self):
self.current_page = il_version_1.Page(
pdf_font=[],
Expand Down
1 change: 1 addition & 0 deletions yadt/pdfinterp.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ def execute(self, streams: Sequence[object]) -> None:
while True:
try:
(_, obj) = parser.nextobject()
self.il_creater.on_new_stream()
except PSEOF:
break
if isinstance(obj, PSKeyword):
Expand Down

0 comments on commit 226b0d0

Please sign in to comment.