Skip to content

AttributeError: 'FPDF' object has no attribute 'orientation_changes' when using set_link #159

Description

@Lucas-C

The error I get:

Traceback (most recent call last):
  File "./gen_pdf.py", line 20, in main
    pdf.output('out.pdf', 'F')
  File "/opt/pyfpdf/fpdf/fpdf.py", line 1110, in output
    self.close()
  File "/opt/pyfpdf/fpdf/fpdf.py", line 270, in close
    self._enddoc()
  File "/opt/pyfpdf/fpdf/fpdf.py", line 1688, in _enddoc
    self._putpages()
  File "/opt/pyfpdf/fpdf/fpdf.py", line 1210, in _putpages
    if l[0] in self.orientation_changes:
AttributeError: 'FPDF' object has no attribute 'orientation_changes'

The function I use to add links:

def link_to_page(pdf, page_id, x, y, width, height):
    link = pdf.add_link()
    pdf.set_link(link, page=page_id)
    pdf.link(x, y, width, height, link)

I am working on a PR to fix this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions