JSP uses many JS libraries to convert HTML code into PDF files. It is basically used to generate report from the JSP page to HTML View.
How to use it?
1) import JS Script
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.4/jspdf.debug.js" ></script>
2) Write the JS Script of PDF under the head section
<script>
function generatePDF() {
var doc = new jsPDF(); //create jsPDF object
doc.fromHTML(document.getElementById("test"), // page element which you want to print as PDF
15,
15,
{
'width': 170 //set width
},
function(a)
{
doc.save("HTML2PDF.pdf"); // save file name as HTML2PDF.pdf
});
}
</script>
3) Write code under page element
<div id="test">
<p><font size="3" color="red">About Me</font></p>
<p><font size="10" color="green"><%
%></font></p>
</div>
<a href="javascript:generatePDF()">Dowload PDF</a>
..............................................................
Create Resume Maker Software in JSP and publish live on Heroku cloud server.
POST Answer of Questions and ASK to Doubt