I currently create a PDF in Django using js.PDF that gets download to wherever the web browser directs it to on my local computer. I would like to instead have it saved in a directory in my Django project that is hosted in Pythonanywhere.(i.e. /home/abraner/ABS/absdatabase/pdfs) Below is my current JavaScript code.
Any suggestions would be appreciated.
async function generatePDF(){
document.getElementById("downloadButton").innerHTML = "Currently downloading, please wait";
var downloading = document.getElementById("whatToPrint");
var doc = new jsPDF('1', 'pt');
await html2canvas(downloading, {
allowTaint: true,
useCORS: true,
width: 798
}).then((canvas) => {
doc.addImage(canvas.toDataURL("image/png"), 'PNG', 5, 5, 585, 800);
})
doc.save("Document.pdf");
window.location.replace('../emailproposal');
}