title: pdfmake generate PDF from Long HTML Table
body: <p>I am using pdfmake <a href="http://pdfmake.org/" rel="nofollow noreferrer">http://pdfmake.org/</a> to generate a PDF from an HTML Table and its a great little plugin, but my only problem is I have a very very long table and it gets cut off in width (see screenshot below)</p>
  
  <p><a href="https://i.stack.imgur.com/l7Koy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/l7Koy.png" alt="enter image description here"></a></p>
  
  <p>How do I handle long tables? This is just one of my tables, some tables I have are longer, some are shorter. Here is my code:</p>
  
  <pre><code>var widths = [200];
  
          var bodies = [];
  
          $('#cost-matrix-table tr:nth-child(3) td').not(':first').each(function () {
              widths.push(100);
          });
  
          var rowCounter = 0;
  
          $('#cost-matrix-table tr').not(':nth-child(4)').each(function () {
  
              var data = [];
  
              var columnCounter = 0;
  
              $(this).find("td").each(function () {
  
                  if ((rowCounter == 0 || rowCounter == 1) &amp;&amp; columnCounter != 0) {
                      data.push({ text: $(this).text(), colSpan: 2, alignment: 'center' }, {});
                  }
                  else {
                      if (rowCounter == 2) {
                          if (columnCounter == 0) {
                              data.push({ text: $(this).text(), style: 'filledHeader' });
                          }
                          else {
                              data.push({ text: $(this).text(), style: 'filledHeader', alignment: 'center' });
                          }
                      }
                      else {
                          data.push($(this).text());
                      }
                  }
  
                  columnCounter++;
  
              });
  
              bodies.push(data);
  
              rowCounter++;
  
          });
  
          var docDefinition = {
              pageOrientation: 'landscape',
              pageMargins: [40, 100, 40, 50],
              pageSize: 'A0',
              header: { text: $("#dropdown").val(), alignment: 'center', decoration: 'underline', fontSize: 28, bold: true, margin: [40, 40, 0, 0] },
              content: [
                {
                    table: {
                        widths: widths,
                        body: bodies,
                        headerRows: 3,
                        pageBreak: 'before',
                        dontBreakRows: true,
                        fontSize: 28
                    }
                }
              ],
              styles: {
                  filledHeader: {
                      color: 'white',
                      fillColor: 'black',
                  }
              }
          };
  
          pdfMake.createPdf(docDefinition).download('CostMatrix-' + $("#dropdown").val().replace(/\s/g, '') + '.pdf');
  </code></pre>
  
  <p>I have my pageSize set to A0 and it still gets cut off...The Height is perfect, just the width gets cut off, please help! I am able to set the width and the height of the page size, but I have no idea what to set it at. My table has 45 columns with a width of 100 per a column, except for the first one which is 200 for a total of 4600</p>