Is there a way to specify a callback function for the pdfMake's createPdf
function? I have a large vfs_fonts.js
file and that's why my export is slow.
There is a callback function getDataUrl:
this.getDataUrl(function(result) {
win.location.href = result;
});
This function is used by the open, save, and print functions that come built in. You can see their source here: https://github.com/bpampuch/pdfmake/blob/81de2c6a97ffb102f8c8c86ea9d7adf97e65976e/src/browser-extensions/pdfMake.js#L50
Using those functions, you should be able to build your own callback that does what you need.
You can use getDataUrl with something like
pdfMake.createPdf(docDefinition).getDataUrl(function(url) { alert('your pdf is done'); });
You would of course want more than that since you want to give them a way to do something with the completed PDF.
To add a callback after the download is done:
pdfMake.createPdf(docDefinition).download('file.pdf', function() { alert('your pdf is done'); });