Print a pdf created with jsPDF in all browsers

So, in conclusion, for Chrome and Safari, use

window.open(doc.output('datauristring'));

but for IE and Firefox, use

doc.save();

These will both allow you to open the pdf in a new window, from which it can be printed. For those who have taken the time to figure out what is necessary on other browsers, feel free to add your research here...


There is a method autoPrint() provided by jsPDF library. You can use that as shown below

var doc = new jsPDF();
var name = "Doe, John"
doc.setFontType("normal");
doc.setFontSize(12);
doc.text(20,20,'Name: '+ name);
doc.autoPrint();
//This is a key for printing
doc.output('dataurlnewwindow');

Try this:

window.open(doc.output('bloburl'), '_blank');

This can have problems with adblock sometimes.