I'm a newbie. I can finally save my document as a pdf but the problem is the text in the textfield that i input was not display in the pdf file that i download. Here is my code.
HTML
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>How To Download a DIV in a HTML Page as PDF File Using JavaScript</title>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/0.9.0rc1/jspdf.min.js"></script>
</head>
<body>
<!-- Content Area -->
<div id="print">
<h3>Welcome To Veewom</h3>
<p>This is a Sample Pararaph</p>
<input type="text" id="try1" placeholder="Enter Name Here">
</div>
<div id="print-btn"></div>
<button id="submit">Download PDF File</button>
</body>
</html>
JAVASCRIPT
var doc = new jsPDF();
var specialElementHandlers = {
'#print-btn': function (element, renderer) {
return true;
}
};
$('#submit').click(function () {
var fieldId = "field100";
var chars = $('#try1').val();
var chars2 = $('#try2').val();
var chars3 = $('#try3').val();
var d3 = $('[name=' + fieldId + ']:enabled').val();
diff1 = "";
if (d3) {
diff = d3;
}
$('#veewom').html('<b>'+"One"+":"+'</b>'+ chars+
'<b>'+"Two"+":"+'</b>'+chars2+
'<b>'+"Three"+":"+'</b>'+chars3
);
var source = $('#print').html();
doc.fromHTML(source, 15, 15, {
'width': 170,
'elementHandlers': specialElementHandlers
});
doc.save('pdf-version.pdf');
});
This is the screenshot of the download pdf. I want to display the text that i input in this pdf file. but the problem is its only give me that content