Skip to content

Commit

Permalink
coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
pubpub-zz committed Oct 3, 2023
1 parent 73a3134 commit d9d0d0f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions pypdf/generic/_data_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -1487,9 +1487,7 @@ def __init__(
self[NameObject("/Type")] = typ

# from table 8.2 of the PDF 1.7 reference.
if len(args) == 0:
pass
elif typ == "/XYZ":
if typ == "/XYZ":
if len(args) < 1: # left is missing : should never occur
args.append(NumberObject(0.0))
if len(args) < 2: # top is missing
Expand All @@ -1501,6 +1499,8 @@ def __init__(
self[NameObject(TA.TOP)],
self[NameObject("/Zoom")],
) = args
elif len(args) == 0:
pass
elif typ == TF.FIT_R:
(
self[NameObject(TA.LEFT)],
Expand Down
5 changes: 4 additions & 1 deletion tests/test_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1462,4 +1462,7 @@ def test_xyz_with_missing_param():
url = "https://github.com/py-pdf/pypdf/files/12795356/tt1.pdf"
name = "issue2236.pdf"
reader = PdfReader(BytesIO(get_data_from_url(url, name=name)))
reader.outline
assert reader.outline[0]["/Left"] == 820
assert reader.outline[0]["/Top"] == 0
assert reader.outline[1]["/Left"] == 0
assert reader.outline[0]["/Top"] == 0

0 comments on commit d9d0d0f

Please sign in to comment.