如何在新窗口中使用jspdf打开生成的pdf文件 [英] How to open generated pdf using jspdf in new window

查看:219
本文介绍了如何在新窗口中使用jspdf打开生成的pdf文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 jspdf 生成pdf文件。一切都很好。但是如何在新标签页或新窗口中打开生成的
pdf。

I am using jspdf to generate a pdf file. Every thing is working fine. But how to open generated pdf in new tab or new window.

我正在使用

doc.output('datauri');

这是在同一个标​​签页中打开pdf。

Which is opening the pdf in same tab.

推荐答案


  1. 在jspdf.js中搜索:

  1. Search in jspdf.js this:

if(type == 'datauri') {
    document.location.href ='data:application/pdf;base64,' + Base64.encode(buffer);
}


  • 添加:

  • Add :

    if(type == 'datauriNew') {   
        window.open('data:application/pdf;base64,' + Base64.encode(buffer));
    }
    


  • 调用此选项'datauriNew'Saludos;)

  • 这篇关于如何在新窗口中使用jspdf打开生成的pdf文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆