Skip to content

Commit

Permalink
ROB: Cope with missing /W entry (#1136)
Browse files Browse the repository at this point in the history
Closes #1134
  • Loading branch information
pubpub-zz authored Jul 20, 2022
1 parent 2abae35 commit fd00f20
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion PyPDF2/_cmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,10 @@ def compute_space_width(
w1[-1] = cast(float, ft1["/DW"])
except Exception:
w1[-1] = 1000.0
w = list(ft1["/W"]) # type: ignore
if "/W" in ft1:
w = list(ft1["/W"]) # type: ignore
else:
w = []
while len(w) > 0:
st = w[0]
second = w[1]
Expand Down
5 changes: 5 additions & 0 deletions tests/test_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,11 @@ def test_extract_text_single_quote_op():
"https://corpora.tika.apache.org/base/docs/govdocs1/932/932446.pdf",
"tika-932446.pdf",
),
# iss 1134:
(
"https://github.com/py-pdf/PyPDF2/files/9150656/ST.2019.PDF",
"iss_1134.pdf",
),
],
)
def test_extract_text_page_pdf(url, name):
Expand Down

0 comments on commit fd00f20

Please sign in to comment.