To generate pdf from dynamic table in Angular JS please follow the given procedure:
step 1: Create directives and call to page in js
step 2: call directives in view with elem-id=''
step 3: Done & Enjoy.
HTML:
step 1: Create directives and call to page in js
step 2: call directives in view with elem-id='
step 3: Done & Enjoy.
HTML:
ANGULARJS:
/*PDF */
app.directive('exportToPdf', function() {
return {
restrict: 'E',
scope: {
elemId: '@'
},
template: '',
link: function(scope, elem, attr) {
scope.exportToPdf = function() {
var doc = new jsPDF();
console.log('elemId 12312321', scope.elemId);
doc.fromHTML(
document.getElementById(scope.elemId).innerHTML, 15, 15, {
'width': 170
});
doc.save('eumrv.pdf')
}
}
}
});
No comments:
Post a Comment
Dharamart.blogspot.in