Aymkdn / html-to-pdfmake

This module permits to convert HTML to the PDFMake format
https://aymkdn.github.io/html-to-pdfmake/index.html
MIT License
545 stars 88 forks source link

Table cell organization bug #196

Closed ubidval closed 11 months ago

ubidval commented 11 months ago

I have an issue with the table cell organization when we have 2 columns that have with child columns. The children of the second column are not rendered correctly during the PDF generation with pdfmake.

The HTML code used :

<table style="width: 100%;" data-pdfmake='{ "dontBreakRows": true }'>
            <th colspan="3" rowspan="2">Numéro d'ordre</th>
            <th colspan="13" rowspan="1">Titulaire</th>
            <th colspan="4" rowspan="2">Nombre de titres</th>
            <th colspan="13" rowspan="1">Bénéficiaire</th>
        </tr>

        <tr style="font-weight: bold; text-align: center;">
            <th colspan="10" rowspan="1">Nom et prénom / Dénomination sociale</th>
            <th colspan="3" rowspan="1">N° de compte</th>

            <th colspan="10" rowspan="1">Nom et prénom / Dénomination sociale</th>
            <th colspan="3" rowspan="1">N° de compte</th>
        </tr>
</table>

The generated PDF : image

Aymkdn commented 11 months ago

I need to investigate. I'll get back to you.

Aymkdn commented 11 months ago

I've just released v2.5.0 with a new way to deal with colspan and rowspan.

Also, make sure to use headerRows in data-pdfmake to have a better rendering:

<table style="width: 100%;" data-pdfmake='{ "dontBreakRows":true, "headerRows":2 }'>

image

ubidval commented 11 months ago

Thanks !