Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Lucas-C opened this issue Jul 22, 2020 · 5 comments

Comments

@Lucas-C
Copy link

Lucas-C commented Jul 22, 2020

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.

@Lucas-C
Copy link
Author

Lucas-C commented Jul 22, 2020

The PR: #160

@rikiNeustadt
Copy link

I have the same issue.
How can I install the fix with pip? (or other recommended way).
this module installed inside docker container.
many Thx - this module is really great!!!

@Lucas-C
Copy link
Author

Lucas-C commented Nov 9, 2020

If you want to install my fork that includes this fix, you can do this:

pip install git+git://github.com/Lucas-C/pyfpdf.git@master

@alexanderankin
Copy link

alexanderankin commented Nov 9, 2020 via email

@Lucas-C
Copy link
Author

Lucas-C commented Jan 9, 2021

I confirm this is fixed in https://pypi.org/project/fpdf2/

@Lucas-C Lucas-C closed this as completed Jan 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants