How to convert html table to pdf using pdfmake

后端 未结 2 1221
旧巷少年郎
旧巷少年郎 2020-12-22 12:53

Am trying to convert my html table to pdf using pdfmake http://pdfmake.org/ but i cant make it to how to use





        
2条回答
  •  攒了一身酷
    2020-12-22 13:32

    Below is the correct syntax to pass the table data :-

    var docDefinition = {
      content: [
    {
      table: {
    
    
        body: [
          [ 'First', 'Second', 'Third', 'The last one' ],
          [ 'Value 1', 'Value 2', 'Value 3', 'Value 4' ],
          [ { text: 'Bold value', bold: true }, 'Val 2', 'Val 3', 'Val 4' ]
        ]
      }
    }
    

    ] };

    This will print the HTML table and not the html code on the pdf file.You need to pass the table data in this format.

提交回复
热议问题