JSFiddle - React, Tailwind, and code Playground
by Mykola Senyk
HTML
<div id="toPDF">
<h1>Title</h1>
<p>This is output for PDF doc.</p>
</div>
<button id="cmd">Click</button>
JavaScript
$(function () {
var specialElementHandlers = {
'#editor': function (element,renderer) {
return true;
}
};
$('#cmd').click(function () {
var doc = new jsPDF();
doc.fromHTML($('#toPDF').html(), 15, 15, {
'width': 170,'elementHandlers': specialElementHandlers
});
doc.save('sample-file.pdf');
});
});