jspdf how can i delete file after save?
i use this code to genarate pdf file
after the last line :
pdf.save(datetime + "_pdf.pdf");
where it saves the file
is this file will be deletes after sent to the browser or i have to delete it my self
if i let every one generate pdf without delete this will effect the disk size
html2canvas(document.querySelector("#capture"),{
allowTaint: true,
}).then(canvas => {
var resizeCanvas = canvas.getContext('2d');
resizeCanvas.height = "209";
resizeCanvas.width = "296";
var imgData = canvas.toDataURL("image/jpeg",1.0);
// var pdf = new jsPDF();
var pdf = new jsPDF({
orientation: "landscape"
});
pdf.addImage(imgData, 'JPEG', 0, 0, 296, 209);
var currentdate = new Date();
var datetime = "certificate_" + currentdate.getDate() + "_"
+ (currentdate.getMonth()+1) + "_"
+ currentdate.getFullYear() + "_"
+ currentdate.getHours() + "_"
+ currentdate.getMinutes() + "_"
+ currentdate.getSeconds();
pdf.save(datetime + "_pdf.pdf");
});
you can reset pdf variable like first called function. work for me
html2canvas(document.querySelector("#capture"),{
allowTaint: true,
}).then(canvas => {
var resizeCanvas = canvas.getContext('2d');
resizeCanvas.height = "209";
resizeCanvas.width = "296";
var imgData = canvas.toDataURL("image/jpeg",1.0);
// var pdf = new jsPDF();
var pdf = new jsPDF({
orientation: "landscape"
});
pdf.addImage(imgData, 'JPEG', 0, 0, 296, 209);
var currentdate = new Date();
var datetime = "certificate_" + currentdate.getDate() + "_"
+ (currentdate.getMonth()+1) + "_"
+ currentdate.getFullYear() + "_"
+ currentdate.getHours() + "_"
+ currentdate.getMinutes() + "_"
+ currentdate.getSeconds();
pdf.save(datetime + "_pdf.pdf");
pdf = new jsPDF({
orientation: "landscape"
});
});
Please or to participate in this conversation.