How to open generated pdf using jspdf in new window

后端 未结 14 2464
遇见更好的自我
遇见更好的自我 2020-12-04 15:50

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.

I am using



        
14条回答
  •  遥遥无期
    2020-12-04 15:57

    Based on the source you can use the 'dataurlnewwindow' parameter for output():

    doc.output('dataurlnewwindow');
    

    Source in github: https://github.com/MrRio/jsPDF/blob/master/jspdf.js#L914

    All possible cases:

    doc.output('save', 'filename.pdf'); //Try to save PDF as a file (not works on ie before 10, and some mobile devices)
    doc.output('datauristring');        //returns the data uri string
    doc.output('datauri');              //opens the data uri in current window
    doc.output('dataurlnewwindow');     //opens the data uri in new window
    

提交回复
热议问题