Skip to content

Commit

Permalink
Fix object referenced in parent tree
Browse files Browse the repository at this point in the history
  • Loading branch information
liZe committed Oct 11, 2022
1 parent eef8b4d commit 3c4fa50
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions weasyprint/pdf/pdfua.py
Expand Up @@ -41,12 +41,13 @@ def pdfua(pdf, metadata, document, page_streams):
# Build structure elements
kids = [mcid]
if key == 'Link':
reference = pydyf.Dictionary({
object_reference = pydyf.Dictionary({
'Type': '/OBJR',
'Obj': box.link_annotation.reference,
'Pg': pdf.pages['Kids'][page_number],
})
pdf.add_object(reference)
kids.append(reference.reference)
pdf.add_object(object_reference)
links.append((object_reference.reference, box.link_annotation))
etree_element = box.element
child_structure_data_element = None
while True:
Expand Down Expand Up @@ -93,8 +94,6 @@ def pdfua(pdf, metadata, document, page_streams):
if isinstance(kid, int):
parents[kid] = child.reference
kid = child.reference
if key == 'Link':
links.append((kid, box.link_annotation))
if child_structure_data_element is not None:
child_structure_data_element['P'] = kid
if not new_element:
Expand Down

0 comments on commit 3c4fa50

Please sign in to comment.