Hi, I am getting this error, is there something I am doing wrong?
core.js:15714 ERROR Error: Uncaught (in promise): TypeError: Cannot set property 'autoPaging' of undefined
TypeError: Cannot set property 'autoPaging' of undefined
at ZoneAwarePromise.<anonymous> (jspdf.min.js:118)
at ZoneDelegate.push.../../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:391)
at Object.onInvoke (core.js:17289)
at ZoneDelegate.push.../../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:390)
at Zone.push.../../node_modules/zone.js/dist/zone.js.Zone.run (zone.js:150)
at zone.js:889
at ZoneDelegate.push.../../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
at Object.onInvokeTask (core.js:17280)
at ZoneDelegate.push.../../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:422)
at Zone.push.../../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195)
at resolvePromise (zone.js:831)
at resolvePromise (zone.js:788)
at zone.js:892
at ZoneDelegate.push.../../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
at Object.onInvokeTask (core.js:17280)
at ZoneDelegate.push.../../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:422)
at Zone.push.../../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195)
at drainMicroTaskQueue (zone.js:601)
at ZoneTask.push.../../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:502)
at invokeTask (zone.js:1744)
const pdf = new jsPDF('p', 'pt', 'letter');
const data = document.getElementById('contentToConvert');
pdf.html(data, function(pdf2: any) {
pdf2.save('test.pdf');
});
Imports:
<script src="https://unpkg.com/html2canvas@latest/dist/html2canvas.js"></script>
<script src="https://unpkg.com/jspdf@latest/dist/jspdf.min.js"></script>
@andmaltes I see you've closed this - I'm stumbling into this error currently.. Any ways you resolved it?
Add an promise-polyfill.
Add an promise-polyfill ???
What this answer?
any fix for this?
If anyone else stumbles upon this: the fix is that the html()-function should be called with the second parameter as an options-object with a callback member. Like this:
pdf.html(data, {
callback: function(pdf) {
pdf.save('test.pdf');
}
});
Most helpful comment
If anyone else stumbles upon this: the fix is that the html()-function should be called with the second parameter as an options-object with a callback member. Like this: