admin管理员组文章数量:1277901
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.
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.
1 Answer
Reset to default 9There 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 e built in. You can see their source here: https://github./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 pleted PDF.
To add a callback after the download is done:
pdfMake.createPdf(docDefinition).download('file.pdf', function() { alert('your pdf is done'); });
本文标签: javascriptpdfMake callback when export is finishedStack Overflow
版权声明:本文标题:javascript - pdfMake callback when export is finished - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741265054a2368302.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论