How to upload dynamic data with jspdf in angular 5

189 views
Skip to first unread message

amit sutar

unread,
Oct 26, 2018, 2:29:03 PM10/26/18
to Angular and AngularJS discussion
I am using angular 5 with laravel. generating pdf with jspdf of html component. its working but dynamic data is not visible in pdf file.

public captureScreen()
{
let data2pdf = this.store_sales_invoice;
var data = document.getElementById('contentToConvert');
html2canvas(data).then(canvas => {
// Few necessary setting options
var imgWidth = 208;
var pageHeight = 295;
var imgHeight = canvas.height * imgWidth / canvas.width;
var heightLeft = imgHeight;
const contentDataURL = canvas.toDataURL('image/png')
let pdf = new jsPDF('p', 'mm', 'a4'); // A4 size page of PDF
var position = 0;
pdf.addImage(contentDataURL, 'PNG', 0, position, imgWidth, imgHeight)
pdf.save('data.pdf'); // Generated PDF
});
}



Reply all
Reply to author
Forward
0 new messages