Skip to content

Commit

Permalink
PDFObjectReader: fix parsing of graphviz 10+ PDF files
Browse files Browse the repository at this point in the history
  • Loading branch information
brechtm committed Jul 12, 2024
1 parent 5338cc4 commit a62bf2f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Changed:

Fixed:

* Embedding of PDF images produces by Graphviz 10+
* Google Fonts downloading (https://github.com/google/fonts/issues/7481)
* Caption labels ("Figure", "Table", "Listing") were not localized
* Rendering of tables with no body (#420, PR #422 by th0mr)
Expand Down
6 changes: 4 additions & 2 deletions src/rinoh/backend/pdf/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,9 @@ def read_dictionary_or_stream(self, indirect=False):
else:
stream_filter = None
stream = cos.Stream(stream_filter)
stream.update(dictionary)
# copy dict contents: .update() would dereference Reference values!
for key, value in dictionary.items():
stream[key] = value
stream._data.write(self.file.read(length))
self.eat_whitespace()
assert self.next_token() == b'endstream'
Expand Down Expand Up @@ -388,7 +390,7 @@ def parse_xref_stream(self, offset):
if 'Index' in xref_stream:
index = iter(int(value) for value in xref_stream['Index'])
else:
index = (0, size)
index = iter((0, size))
xref_stream.seek(0)
while True:
try:
Expand Down

0 comments on commit a62bf2f

Please sign in to comment.