Can't get table width to fit to page

See original GitHub issue

Hi, I’ve got a page with an HTML table on it, set to 100% width on the page. I’d like to output the table into a PDF which fits the table to the width of the page and the document will create as many pages as is necessary for the whole table. My code is as follows:

html2pdf($('div.node-content')[0], {
      filename:     'myReport.pdf',
      margin:       0,
      image:        { type: 'jpeg', quality: 0.98 },
      html2canvas:  { dpi: 192, letterRendering: true },
      jsPDF:        { format: 'a4', orientation: 'p' }
});

I’ve found that the table does not fit the PDF page width and a couple of columns on the right of the table are clipped off. I’ve experimented with the format option in the jsPDF setting as well as the margin option but I can’t seem to affect this behaviour.

Any thoughts on how to do this would be much appreciated. John

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:19 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
johnvanbredacommented, Dec 5, 2017

Yes - the fit-to-width option would meet my needs. Thanks.

5reactions
dorsaffercommented, Dec 9, 2019

same here

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resize a table, column, or row - Microsoft Support
On the Layout tab, in the Cell Size group, click AutoFit, and then click AutoFit Contents.
Read more >
Adjust Table Columns in Word (Auto Fit) - Cedarville University
Learn how to use the AutoFit features in Word to adjust table columns. Quickly increase/decrease row height and column width precisely and easily....
Read more >
How can I make a CSS table fit the screen width?
Save this question. Show activity on this post. Currently the table is too wide and causes the browser to add a horizontal scroll...
Read more >
How can I resize a table to fit the page's width? - Word MVP Site
In Word 2000 you can select Table + Properties, click on the “preferred width” checkbox; where it says “Measure in”, change it to...
Read more >
Resize table rows and columns in Pages on Mac
Click the table. Move the pointer to the right of the row number or column letter, click the arrow, then choose Fit Height...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found