Click here to Skip to main content
15,903,523 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm using JSPDF to convert HTML to pdf and I want to send it over email. For that, I need to store the file in the folder. But I'm not able to store it on the folder as "jspdf.save('filename.pdf')" does not give option for path

What I have tried:

$('#print').click(function () {

domtoimage.toPng(document.getElementById('divinvoiceprint'))
.then(function (blob) {
var pdf = new jsPDF('l', 'pt', [$('#divinvoiceprint').width(), $('#divinvoiceprint').height()]);

pdf.addImage(blob, 'PNG', 0, 0, $('#divinvoiceprint').width(), $('#divinvoiceprint').height());
pdf.output("D:\Test.pdf");
alert("ok");
pdf.save("D:\Test.pdf");



that.options.api.optionsChanged();
});
});
Posted
Updated 15-Jul-20 23:54pm
Comments
Richard MacCutchan 15-Jul-20 13:25pm    
Browser code cannot store files on the user's system.

1 solution

As mentioned in the comments, the browser has no control over where, or even if, a file is saved on the user's system.

In addition, you will not be able to load a file from the user's system unless they select it first. Nor will you be able to automate their email client from Javascript.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900