1

I am trying to render a table using jsPDF and I used this code from here but the problem is if the text is bigger than the cell borders, it goes outside the cell. Is there an easy way to make the text truncate or make the cell bigger in height to fit all the text inside ?

$.each(table, function (i, row){
            console.debug(row);
            $.each(row, function (j, cell){
                doc.cell(10, 50,120, 50, cell, i);
            })
        })
Community
  • 1
  • 1
Pacuraru Daniel
  • 1,207
  • 9
  • 30
  • 56
  • This approach might work for you: https://github.com/MrRio/jsPDF/blob/master/jspdf.plugin.cell.js (untested; found using Google). – Jongware Feb 15 '14 at 14:08

1 Answers1

2

I found that the support for tables overall is lacking in jsPDF so I made a plugin. It features truncate of text if the column widths exceeds the page width among other things. Check it out! jspdf-AutoTable

tab

Simon Bengtsson
  • 7,573
  • 3
  • 58
  • 87
  • that's very nice, i let this comment for future viewers, my personal aproach lately when it comes to printing content from a web app is to create a html with the print design and load it into an iframe and call print inside the iframe – Pacuraru Daniel Jun 09 '16 at 13:18