jsPDF not working on Safari

荒凉一梦 提交于 2019-12-19 09:54:09

问题


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');
}

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

doc.output('dataurlnewwindow');

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


回答1:


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

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

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

regards



来源:https://stackoverflow.com/questions/21755171/jspdf-not-working-on-safari

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!