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: 'HTML2FPDF' object has no attribute 'table_offset' #723

Closed
ruiz-manuel opened this issue Mar 15, 2023 · 7 comments
Closed
Assignees

Comments

@ruiz-manuel
Copy link

ruiz-manuel commented Mar 15, 2023

I am getting that error when writing a table from an html code. Originally the html comes from pandas.DataFrame.Styler.to_html() but this little code snippet is enough to reproduce the error:

from fpdf import FPDF

pdf = FPDF()

pdf.add_page()

html = """
<table  width=130>
  <tbody>
    <tr>
      <td>1.10</td>
    </tr>
  </tbody>
</table>
"""

pdf.write_html(html)
@Lucas-C
Copy link
Member

Lucas-C commented Mar 15, 2023

Hi @ruiz-manuel

Thank you for reporting this bug!
Thanks to your minimal code I was quickly able to reproduce it.
I'm working on a fix

@Lucas-C Lucas-C self-assigned this Mar 15, 2023
@Lucas-C
Copy link
Member

Lucas-C commented Mar 15, 2023

@allcontributors please add @ruiz-manuel for bug

@allcontributors
Copy link

@Lucas-C

I've put up a pull request to add @ruiz-manuel! 🎉

@ruiz-manuel
Copy link
Author

@Lucas-C awesome, thank you so much!

@Lucas-C
Copy link
Member

Lucas-C commented Mar 15, 2023

This will be solved by #703

You can test it by yourself:

pip install git+https://github.com/PyFPDF/fpdf2.git@table

Hence I'm closing this issue.
But feel free to drop a comment @ruiz-manuel if you have any question 😊

@shindodkar
Copy link

@ruiz-manuel would you help how to this type of projects get solved. Actually i am a beginner and your guidance will be so helpful for me.

@Lucas-C
Copy link
Member

Lucas-C commented Mar 27, 2023

A fix has been released in v2.7.0: https://github.com/PyFPDF/fpdf2/releases/tag/2.7.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants