Skip to content

Commit 3c4fa50

Browse files
committed
Fix object referenced in parent tree
1 parent eef8b4d commit 3c4fa50

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

weasyprint/pdf/pdfua.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,13 @@ def pdfua(pdf, metadata, document, page_streams):
4141
# Build structure elements
4242
kids = [mcid]
4343
if key == 'Link':
44-
reference = pydyf.Dictionary({
44+
object_reference = pydyf.Dictionary({
4545
'Type': '/OBJR',
4646
'Obj': box.link_annotation.reference,
47+
'Pg': pdf.pages['Kids'][page_number],
4748
})
48-
pdf.add_object(reference)
49-
kids.append(reference.reference)
49+
pdf.add_object(object_reference)
50+
links.append((object_reference.reference, box.link_annotation))
5051
etree_element = box.element
5152
child_structure_data_element = None
5253
while True:
@@ -93,8 +94,6 @@ def pdfua(pdf, metadata, document, page_streams):
9394
if isinstance(kid, int):
9495
parents[kid] = child.reference
9596
kid = child.reference
96-
if key == 'Link':
97-
links.append((kid, box.link_annotation))
9897
if child_structure_data_element is not None:
9998
child_structure_data_element['P'] = kid
10099
if not new_element:

0 commit comments

Comments
 (0)