【发布时间】:2020-11-25 08:24:58
【问题描述】:
我有多个 blob,我从中创建 blob url 并使用 print-js 库来显示浏览器的打印预览屏幕。
我有
async printDocuments(): Promise<any> {
const _files: { fileName: string, blob: any }[] = await this._getFiles();
_files.forEach((_fileInfo, index) => {
const blobUrl = URL.createObjectURL(_fileInfo.blob);
printJS(blobUrl);
});
}
但这仅显示第一个文件的打印预览对话框。
如何通过合并或打开多个打印窗口来打印所有文档。
我试过用这个
printJS({
printable: _files[0].blob,
type: "pdf",
onPrintDialogClose: () => {
console.log("nex");
}
});
但现在它正在显示
core.js:4196 ERROR Error: Uncaught (in promise): TypeError: params.printable.charAt is not a function
TypeError: params.printable.charAt is not a function
【问题讨论】:
-
尝试使用库
onPrintDialogClose,只有在第一个打印作业完成后才触发下一个打印作业。浏览器可能会忽略其他作业,因为它们是在处理第一个作业之前触发的。 printjs.crabbly.com/#configuration -
@crabbly,更新了问题,你能帮忙
标签: javascript angular printjs