JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.4/jspdf.debug.js" ></script>
</head>
<body>
<div id="test">
<p><font size="3" color="red">This is p one</font></p>
<p><font size="10" color="green">More Text to be printed on PDF</font></p>
<img width="100" height="100"...
JavaScript
function generatePDF() {
var doc = new jsPDF();
doc.fromHTML(document.getElementById("test"), // page element which you want to print as PDF
15,
15,
{
'width': 170
},
function(a)
{
doc.save("HTML2PDF.pdf");
});
}