Using html2canvas and pdfmake to export HTML to a PDF file. Doing this in an AngularJS framework.
The problem I am having, images in the HTML are not shown in the PDF file. data
does contain a base64 string, but when I decode this there are no images (only the table and text I wrote). What am I doing wrong here?
html2canvas($("#pdfFileToExport"), {
onrendered: function (canvas) {
var data = canvas.toDataURL();
var docDefinition = {
content: [{
image: data,
width: 500
}]
};
pdfMake.createPdf(docDefinition).download("fileName.pdf");
}
});