jsPDF无法在Safari上运行 [英] jsPDF not working on Safari

查看:912
本文介绍了jsPDF无法在Safari上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在生成并保存PDF的HTML页面末尾有一个按钮,所以我决定尝试使用jsPDF。

I need to have a button at the end of a HTML page that generates and saves a PDF, so I decided to try jsPDF.

function pdfComprovativo(arg){
    var doc = new jsPDF();
    doc.text(20, 20, 'Hello world!');
    doc.save('Test.pdf');
}

我在几个浏览器上测试了这个并且它不适用于Safari(5.1.7)版本)。

I tested this on several browsers and it's not working for Safari (5.1.7 version).

doc.output('dataurlnewwindow');

如果我用这个替换save(),它可以工作,但我不能使用这个解决方案,因为弹出窗口拦截器。

It works if I replace the save() with this, but I can't use this solution because of popup blockers.

推荐答案

我在Github问了你的问题,因为我有同样的问题。以下是对我有用的开发人员的回复:

I asked your question on Github, because I had the same the issue. Here is the response of the developer which works for me:


doc.output('dataurl')怎么样; ?

What about doc.output('dataurl'); ?

PDF现在以内联方式显示。用户可以保存,打印并且不会生成新的弹出窗口。

The PDF is now displayed inline. The user can save it, print it and no new popup is generated.

问候

这篇关于jsPDF无法在Safari上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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