Here is my jqgrid Design Page code
<div id='jqxWidget1'>
<div id="jqxgrid1">
</div>
</div>
This im my html Button
<button type="button" id="pdfExport" class="btn btn-warning">Export To PDF</button>
And I had write the javascript code inside a js and call in this page...
<script src="userScript/ComplianceReport.js"></script>
What I have tried:
Here is my javascript code...
$("#pdfExport").click(function () {
var pdf = new jsPDF('p', 'pt', 'letter');
source = $('#tab_customers')[0]; //table Id
specialElementHandlers = {
'#htmlexportPDF': function (element, renderer) {
return true
}
};
margins = { //table margins and width
top: 80,
bottom: 60,
left: 40,
width: 100,
height: 200
};
pdf.fromHTML(
source,
margins.left,
margins.top, {
'width': margins.width,
'elementHandlers': specialElementHandlers
},
margins);
var gridContent = $("#jqxgrid1").jqxGrid('exportdata', 'html');
var filtercontent1 = '
Visit Type:- | Camp Name:- | Time Duration:- |
---|
'
pageContent =
'<!DOCTYPE html>\n' +
'<html>\n' +
'<head>\n' +
'<meta charset="utf-8" />\n' +
'<title>camp schedule report</title>\n' +
'</head>\n' +
'<body>\n' + filtercontent1 + '\n' + gridContent + '\n</body>\n</html>';
//filtercontent += gridContent;
console.log(pageContent);
pdf.fromHTML(pageContent, 15, 15, {
'width': 270,
'elementHandlers': specialElementHandlers
});
pdf.save('CampScheduleReport.pdf');
});
Thanks & Regards
Bigyan Sahoo