html div content include with input text value to pdf using java script??
My html body is something look like,
<body>
<table>
<tr>
<td></td><td></td><td></td>
</tr>
<tr>
<td></td><td></td><td></td>
</tr>
<tr>
<td></td><td></td><td></td>
</tr>
<tr>
<td colspan="3">
<table><tr>
<td></td><td></td>
</tr>
<tr>
<td></td><td></td>
</tr></table>
</td>
</tr>
<tr>
<td></td><td colspan="2"></td>
</tr>
</table>
</body>
Script code:
<script type="text/javascript"> $(document).ready(function() {
$("#exportpdf").click(function() {
var pdf = new jsPDF('p', 'pt', 'ledger');
// source can be HTML-formatted string, or a reference
// to an actual DOM element from which the text will be scraped.
source = $('#tableresponsive')[0];
// we support special element handlers. Register them with jQuery-style
// ID selector for either ID or node name. ("#iAmID", "div", "span" etc.)
// There is no support for any other type of selectors
// (class, of compound) at this time.
specialElementHandlers = {
// element with id of "bypass" - jQuery style selector
'#bypassme' : function(element, renderer) {
// true = "handled elsewhere, bypass text extraction"
return true
}
};
margins = {
top : 80,
bottom : 60,
left : 60,
width : 522
};
// all coords and widths are in jsPDF instance's declared units
// 'inches' in this case
pdf.fromHTML(source, // HTML string or DOM elem ref.
margins.left, // x coord
margins.top, { // y coord
'width' : margins.width, // max width of content on PDF
'elementHandlers' : specialElementHandlers
},
function(dispose) {
// dispose: object with X, Y of the last line add to the PDF
// this allow the insertion of new lines after html
pdf.save('fileNameOfGeneretedPdf.pdf');
}, margins);
});
}); </script>
tableresponsive is table id and exportpdf is button id.It generates pdf but,text and content are spread in the pdf.Lots of ',' also in generated pdf.
Please, tell me how to generate this type of pdf with including input text values??
Used Plugins for jspdf:
<script src='/static/jspdf.min.js'></script>
<script src='/static/jspdf.debug.js'></script>