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

HTML table with null text in span cells that don't show correctly #1293

Closed
whoisltd opened this issue Oct 26, 2024 · 3 comments · Fixed by #1294
Closed

HTML table with null text in span cells that don't show correctly #1293

whoisltd opened this issue Oct 26, 2024 · 3 comments · Fixed by #1294
Labels

Comments

@whoisltd
Copy link

whoisltd commented Oct 26, 2024

Describe the bug:

the HTML table with null text in span cells that don't show correctly
HTML table with td tag have rowspan, colspan > 1 and text inside is null the pdf output not show table correctly

HTML input:

<table border="1">
    <tr>
        <td rowspan=2></td>
        <td>cell 2</td>
        <td>cell 3</td>
    </tr>
    <tr>
        <td>cell 4</td>
        <td>cell 5</td>
    </tr>
    <tr>
        <td colspan=2></td>
        <td>cell 7</td>
    </tr>
</table>

Expect output:
image
Actual ouput:
image

Error details
the HTML table with null text in span cells that don't show correctly

Minimal code

from fpdf import FPDF

pdf = FPDF()
pdf.add_page()
pdf.write_html(
    """<table border="1">
    <tr>
        <td rowspan=2></td>
        <td>cell 2</td>
        <td>cell 3</td>
    </tr>
    <tr>
        <td>cell 4</td>
        <td>cell 5</td>
    </tr>
    <tr>
        <td colspan=2></td>
        <td>cell 7</td>
    </tr>
</table>
    """,
    table_line_separators=True,
)
pdf.output("output.pdf")

Environment
Please provide the following information:

  • Operating System: Ubuntu 24.04
  • Python version: 3.8.16
  • fpdf2 version used: 2.8.1
@Lucas-C
Copy link
Member

Lucas-C commented Oct 26, 2024

Thank you for the report @whoisltd 👍

@allcontributors please add @whoisltd for bug and code

Copy link

@Lucas-C

I've put up a pull request to add @whoisltd! 🎉

@Lucas-C
Copy link
Member

Lucas-C commented Dec 16, 2024

This fixup has been included in the new release published today:
https://github.com/py-pdf/fpdf2/releases/tag/2.8.2

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

Successfully merging a pull request may close this issue.

2 participants