Skip to content

Commit

Permalink
ROB: Widths def in cmap calls IndirectObject (#1719)
Browse files Browse the repository at this point in the history
Fixes #1718
  • Loading branch information
pubpub-zz authored Mar 17, 2023
1 parent 9878034 commit 3419429
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pypdf/_cmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ def compute_space_width(
w = []
while len(w) > 0:
st = w[0]
second = w[1]
second = w[1].get_object()
if isinstance(second, int):
for x in range(st, second):
w1[x] = w[2]
Expand Down
10 changes: 10 additions & 0 deletions tests/test_cmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,13 @@ def test_iss1533():
reader = PdfReader(BytesIO(get_pdf_from_url(url, name=name)))
reader.pages[0].extract_text() # no error
assert build_char_map("/F", 200, reader.pages[0])[3]["\x01"] == "Ü"


@pytest.mark.enable_socket()
def test_iss1718(caplog):
url = "https://github.com/py-pdf/pypdf/files/10983477/Ballinasloe_WS.pdf"
name = "iss1718.pdf"
reader = PdfReader(BytesIO(get_pdf_from_url(url, name=name)))
for p in reader.pages:
_txt = p.extract_text()
assert caplog.text == ""

0 comments on commit 3419429

Please sign in to comment.