jsPDF, new document in new browser tab
I use jsPDF to make a pdf document, but it appears in the same window as
page. That is bad, so I want to find how to make it appear in new tab. Can
you help me plz ? Here's the code :
$('.buy-products').on('click',function(){
question = confirm('Would you like to get a printable version ?')
if (question == true){
var list = document.getElementsByClassName('pdf');
var doc = new jsPDF();
doc.text(20, 20, 'What you bought is :');
for(var i = 0; i < list.length; i++)
{
doc.setFontSize(15);
doc.text(20, 30 + i*10,
(list[i].innerHTML.toString()).toLowerCase());
}
doc.output('datauri');
}
No comments:
Post a Comment