Multi-line jsPDF header

Asked

Viewed 251 times

0

I need to generate pdf from a table, only my header has several lines and my code is overlapping those lines, follow picture: inserir a descrição da imagem aqui

I need each tr to be in a different line, as it would be possible?

var startColPosition=defaults.pdfLeftMargin;
$(el).find('thead').find('tr').each(function() {
     $(this).filter(':visible').find('th').each(function(index,data) {
            if ($(this).css('display') != 'none'){                  
                 if(defaults.ignoreColumn.indexOf(index) == -1){
                       var colPosition = startColPosition+ (index * 50);                                    
                       doc.text(colPosition,20, parseString($(this)));
                  }
            }
      });                                   
}); 
  • recommend using the jsPDF-Autotable plugin that deals with the printing of tables.

1 answer

1

Hello doing so is more complex, so I recommend using the jsPDF-Autotable plugin that deals with the printing of tables in a simple way. See here in Git jspdf & auto table

  • in my project I give the option to download through a button, thus: <a href="#" onClick ="$('#pawn_requester'). tableExport({type:'pdf', escape:'false'});"><img src='.. /.. /images/icons/pdf.png' width="24"/> PDF</a> -- how would I do something like that using autoTable? vc could help me?

  • @V.Avancini see this example here https://jsfiddle.net/sereno/p5pcLqz2/

Browser other questions tagged

You are not signed in. Login or sign up in order to post.