JSFiddle - React, Tailwind, and code Playground

by Ravichandra Thota

HTML

<script src="http://cdnjs.cloudflare.com/ajax/libs/jspdf/0.9.0rc1/jspdf.min.js"></script>
<div id="content">
     <h3>Hello, this is Ravi chandra</h3>

    <p>A Sample Data to Download</p>
</div>
<div id="editor"></div>
<button id="cmd">Generate PDF</button>

JavaScript

var doc = new jsPDF();
var specialElementHandlers = {
    '#editor': function (element, renderer) {
        return true;
    }
};

$('#cmd').click(function () {
    doc.fromHTML($('#content').html(), 15, 15, {
        'width': 170,
            'elementHandlers': specialElementHandlers
    });
    doc.save('Ravi.pdf');
});