In my angular web app I use jspdf to generate a pdf. Currently whenever I generate a pdf it is automatically downloaded in the browser. What I want it to do is either save it directly within a project folder (like assets) or have it overwrite an existing file in my project (for example say testPDF.pdf is in my assets and I generate test2.pdf and then have that overwrite testPDF.pdf). The reason for this is I want the user to be able to preview the generated pdf via ng2-pdf-viewer ( which would need the new file to display it). I have tried a couple of different things but Im not sure if this is possible on just the clientside. Please let me know if what im asking is possible.
Because it seems I was not able to do this with jspdf, I have been trying with FileSaver.js but have been getting the same results
In jsPDF this is code automatically downloads the pdf in the browser (there is an existing "test1.pdf" file in the project)
var doc = new jspdf();
doc.text('my name is bob', 10, 10);
doc.save('test1.pdf');
And using FileSaver.js I get the same results
var blob = doc.output('blob');
saveAs(blob,"test1.pdf");