How to open generated pdf using jspdf in new window

后端 未结 14 2503
遇见更好的自我
遇见更好的自我 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 16:19

    Step I: include the file and plugin

    ../jspdf.plugin.addimage.js
    

    Step II: build PDF content var doc = new jsPDF();

    doc.setFontSize(12);
    doc.text(35, 25, "Welcome to JsPDF");
    doc.addImage(imgData, 'JPEG', 15, 40, 386, 386);
    

    Step III: display image in new window

    doc.output('dataurlnewwindow');
    

    Stepv IV: save data

    var output = doc.output();
    return btoa( output);
    

提交回复
热议问题