jsPDF: Uncaught TypeError: Cannot read property 'name' of undefined

Seem to consistently be getting an error on this line in from_html and jspdf.debug. Tried to work through it, though I’m not sure this part

rowData[headers[j].name]

I might just be doing something wrong though.

var doc = new jsPDF();
var area = document.getElementById("pdf");
var specialElementHandlers = {
    '#ignore1': function(element, renderer){
        return true;
    },
        '#ignore2': function(element, renderer){
            return true;
        },
        '#ignore3': function(element, renderer){
            return true;
        },
        '#ignore4':function(element, renderer){
            return true;
        }
};
doc.fromHTML($('#bill-display').get(0), 15, 15, {
    'width': 170, 
    'elementHandlers': specialElementHandlers,
});

otherwise this has been a troublesome bug

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 18

Most upvoted comments

I was able to fix this by modifying line 6203 of jspdf.debug.js (on version 1.2.61) to this:

while (j < tableRow.cells.length && headers[j] != undefined) {

Which was originally:

while (j < tableRow.cells.length) {

Alternatively, I could make it go away by adding another td to the tr it was processing (it only had one td, which apparently caused the problem).

i got the same issue because of i have used colspan. removed that and everything fine for me…

im getting erro