this is what it worked for me I'm using html2pdf from an Angular2 app, so I made a reference to this function in the controller
var html2pdf = (function(html2canvas, jsPDF) {
declared in html2pdf.js.
So I added just after the import declarations in my angular-controller this declaration:
declare function html2pdf(html2canvas, jsPDF): any;
then, from a method of my angular controller I'm calling this function:
generate_pdf(){
this.someService.loadContent().subscribe(
pdfContent => {
html2pdf(pdfContent, {
margin: 1,
filename: 'myfile.pdf',
image: { type: 'jpeg', quality: 0.98 },
html2canvas: { dpi: 192, letterRendering: true },
jsPDF: { unit: 'in', format: 'A4', orientation: 'portrait' }
});
}
);
}
Hope it helps