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

'tableAutoSize' with '%' not working #222

Closed
ikbal-nayem opened this issue Aug 19, 2024 · 1 comment
Closed

'tableAutoSize' with '%' not working #222

ikbal-nayem opened this issue Aug 19, 2024 · 1 comment

Comments

@ikbal-nayem
Copy link

My HTML code is given bellow,

<table style="border-color: rgb(77, 230, 77); border-width: 2px; width: 83.1%;">
   <colgroup>
      <col style="width:46.65%;">
      <col style="width:41.01%;">
      <col style="width:12.34%;">
   </colgroup>
   <tbody>
      <tr>
         <td style="border-color:hsl(0, 75%, 60%);">sdfsd</td>
         <td style="border-color:hsl(0, 75%, 60%);">sds</td>
         <td style="border-color:hsl(0, 75%, 60%);">zcx</td>
      </tr>
      <tr>
         <td style="border-color:hsl(0, 75%, 60%);">zc</td>
         <td style="border-color:hsl(0, 75%, 60%);">dcsd</td>
         <td style="border-color:hsl(0, 75%, 60%);">cc</td>
      </tr>
   </tbody>
</table>

When I try to convert the HTML to pdfMake JSON with the help of htmlToPdfMake it provides me the following output,

{
  "content": [
    {
      "nodeName": "TABLE",
      "marginBottom": 5,
      "borderColor": "rgb(77, 230, 77)",
      "borderWidth": 2,
      "width": "83.1%",
      "style": [
        "html-table",
        "ck-table-resized"
      ],
      "table": {
        "body": [
          [
            {
              "text": "sdfsd",
              "nodeName": "TD",
              "borderColor": "hsl(0, 75%, 60%)",
              "borderWidth": 2,
              "style": [
                "html-td",
                "html-tr",
                "html-tbody",
                "html-table",
                "ck-table-resized"
              ]
            },
            {
              "text": "sds",
              "nodeName": "TD",
              "borderColor": "hsl(0, 75%, 60%)",
              "borderWidth": 2,
              "style": [
                "html-td",
                "html-tr",
                "html-tbody",
                "html-table",
                "ck-table-resized"
              ]
            },
            {
              "text": "zcx",
              "nodeName": "TD",
              "borderColor": "hsl(0, 75%, 60%)",
              "borderWidth": 2,
              "style": [
                "html-td",
                "html-tr",
                "html-tbody",
                "html-table",
                "ck-table-resized"
              ]
            }
          ],
          [
            {
              "text": "zc",
              "nodeName": "TD",
              "borderColor": "hsl(0, 75%, 60%)",
              "borderWidth": 2,
              "style": [
                "html-td",
                "html-tr",
                "html-tbody",
                "html-table",
                "ck-table-resized"
              ]
            },
            {
              "text": "dcsd",
              "nodeName": "TD",
              "borderColor": "hsl(0, 75%, 60%)",
              "borderWidth": 2,
              "style": [
                "html-td",
                "html-tr",
                "html-tbody",
                "html-table",
                "ck-table-resized"
              ]
            },
            {
              "text": "cc",
              "nodeName": "TD",
              "borderColor": "hsl(0, 75%, 60%)",
              "borderWidth": 2,
              "style": [
                "html-td",
                "html-tr",
                "html-tbody",
                "html-table",
                "ck-table-resized"
              ]
            }
          ]
        ],
        "widths": [
          "0.9329999999999999%",
          "0.8201999999999999%",
          "0.2468%"
        ],
        "heights": [
          "auto",
          "auto"
        ]
      }
    }
  ],
  "styles": {
    "green": {
      "color": "green"
    }
  }
}

And the PDF output is,
image

Aymkdn added a commit that referenced this issue Aug 19, 2024
Fix issue #222
@Aymkdn
Copy link
Owner

Aymkdn commented Aug 19, 2024

The width issue should be fixed with v2.5.13

@Aymkdn Aymkdn closed this as completed Aug 19, 2024
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

2 participants