How to open generated pdf using jspdf in new window

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

Leave a Comment