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
990 stars 716 forks source link

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

Closed blendxorz closed 7 months ago

blendxorz commented 7 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 7 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 7 months ago

Thank you!