hhurz / tableExport.jquery.plugin

jQuery plugin to export a html table to JSON, XML, CSV, TSV, TXT, SQL, Word, Excel, PNG and PDF
MIT License
984 stars 714 forks source link

pdfmake - table column width to automatically adjust to cell content #378

Closed blendxorz closed 5 months ago

blendxorz commented 5 months ago

Hi, I'm currently using pdfmake and I'm having trouble adjusting the column width to fit the cell content. In the snippet below, I would like to adjust the column width to fit the content in order to minimize whitespaces. How do I do that?

image

hhurz commented 5 months ago

Hi, use the new widths option from the latest release 1.29.0

$('#tableID').tableExport({
  type:'pdf',
  pdfmake:{enabled:true,
           docDefinition:{pageOrientation:'landscape'},
           widths: 'auto'}
});
blendxorz commented 5 months ago

Thank you!