1👍
This is a simple solution using jsPDF
HTML5 client and jQuery, it captures the current page and generates a pdf file which is automatically downloaded to the user’s system.
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('my-todos.pdf');
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.2.61/jspdf.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<!-- Test content-->
<h1> My TODO List</h1>
<button id="cmd">generate PDF</button>
Source:stackexchange.com