jsPDF fromHTML images cause the pdf to be empty jsPDF fromHTML images cause the pdf to be empty angularjs angularjs

jsPDF fromHTML images cause the pdf to be empty


I have found the solution to my problem. When using the fromHTML Plugin it's important to save the pdf in the callback because else it won't be done rendering by the time it saves the doc.

doc.fromHTML(tinymceToJSPDFHTML, 0, 0, {    'width': 100, // max width of content on PDF    'elementHandlers': specialElementHandlers},function(bla){doc.save('saveInCallback.pdf');},margin);


Thanks @FroZenViper for pointing me the callback solution then I can solve it using setTimeout :) - jsPDF Version 1.5.3

doc.fromHTML(yourTargetHTML, 0, 0, {    // options},setTimeout(function () {    doc.save(`fileName`);}, 0);