我在尝试预览使用 jsPDF API 生成的 PDF 文件时遇到问题,当我向文档添加超过 3 张图像(每张图像 300-400KB)时,我可以正确下载文档,但无法显示在浏览器中使用 jsPDF 方法:doc.output('dataurlnewwindow')。我的网络浏览器上打开了一个新选项卡,但它是空白的(选项卡顶部显示“正在充电...”,但从未显示。但是,我可以使用 jsPDF 将 PDF 文件下载到我的电脑上,没有任何问题方法: doc.save( this.reportFileName );
您知道为什么会发生这种情况吗?可能是与我需要在网络浏览器中预览的 PDF 文件大小有关的问题?这样做有最大尺寸吗?任何帮助将非常感激。
谢谢!
this.doc = new jsPDF({orientation: "p", unit: "pt", format: "a4"})
// ....
// doing some stuff in the doc file
// adding images of 400 KB aprox. (it works with 3 images... but with 4 or more doesn't
this.doc.addImage('data:image/jpeg;base64,'+ logoFooter, 'JPEG', this.marginLeft+40, 794, 40, 45);
// ....
preview () {
try {
this.doc.output('dataurlnewwindow'); // >> doesn't work and an …Run Code Online (Sandbox Code Playgroud)