0

I'm using jspdf and jspdf-autotable to export data based tables into PDF.

Sometimes, my data could contain DOM elements, which aren't handled by the jspdf-autotable plugin. In the most cases, the DOM element is a span or a div element containing some inner text, but it could also be any other element type.

The goal is to print at least an approximate content into the printed cell. For that, I want to use the hook methods provided by the jspdf-autotable options (drawCell() / createdCell()) to prepare the content.

Is there a approximation approach to generate some useful text for the print output, which does not depend on specific element tag types? Otherwise, is there a way to get the elements rendered into the corresponding cells?

Darkmiller
  • 50
  • 7

1 Answers1

1

You can try first to iterate though the table cells and clear then up to have only text, not DOM elements there. There code may be smth like this:

$('#mytable td').each(function(){
  $(this).contents().unwrap();​​
});
shershen
  • 9,875
  • 11
  • 39
  • 60