Sanyifejű
Sanyifejű

Reputation: 2740

How to solve line discontinuity in html table (python fpdf2 generate PDF documents)

I try to generate a PDF document. I use PYPDF2. The PDF contains a table which is generated by :

class HTMLMixin:
    HTML2FPDF_CLASS = HTML2FPDF

    def write_html(self, text, *args, **kwargs):
        """Parse HTML and convert it to PDF"""
        kwargs2 = vars(self)
        # Method arguments must override class & instance attributes:
        kwargs2.update(kwargs)
        h2p = self.HTML2FPDF_CLASS(self, *args, **kwargs2)
        text = html.unescape(text)  # To deal with HTML entities
        h2p.feed(text)

I did not write this class, it is part of the library. Certain columns however has more content so they contains line-breaks. Because of these line-breaks the result is like this: enter image description here

How can I have full, continuous side-lines for each columns in the table? (Just like for column 'Teilnehmer')

Upvotes: 1

Views: 517

Answers (1)

Lucas Cimon
Lucas Cimon

Reputation: 2043

This is a current limitation of the library, reported here on the project bug tracker: https://github.com/PyFPDF/fpdf2/issues/91

The documentation also lists the limitations of the HTMLMIxin: https://pyfpdf.github.io/fpdf2/HTML.html#supported-html-features

Notes:

  • tables should have at least a first <th> row with a width attribute.
  • currently multi-line text in table cells is not supported. Contributions are welcome to add support for this feature! 😊

Upvotes: 1

Related Questions