I tried to implement the zipping function as soon as the files were downloaded (multiple files) successfully. And files with zip files should be sent to the server for saving in db. Zipping works fine, but pdf content is displayed as empty.
I also tried to set hardcoded values for pdf, shown below, and its performance.
var doc = new jsPDF();
doc.setFontSize(40);
doc.text(35, 25, "Octonyan loves jsPDF");
var zip = new JSZip();
zip.file("Hello.pdf", doc.output());
zip.generateAsync({ type: "blob" })
.then(function (content) {
saveAs(content, "example.zip");
});
The approach I tried to download the file: -
for(var uploadedFile in uploadedFileArray){
if(uploadedFileArray[uploadedFile]){
doc1 = new jsPDF(uploadedFileArray[uploadedFile]);
}
}
Does anyone have any ideas how to implement zip files on the fly after the download is complete?
Thanks in advance.
source
share