download files

This commit is contained in:
Peter Maquiran
2024-09-11 12:38:25 +01:00
parent 80e1db12b8
commit 4413ce4698
3 changed files with 39 additions and 39 deletions
@@ -1400,8 +1400,6 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
a.href = url;
a.download = fileName; // Set the desired file name
// Programmatically click the <a> element to trigger the download
document.body.appendChild(a);
a.click();
} else {
const link = document.createElement("a")
@@ -1418,8 +1416,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
this.openViewDocumentModal(msg);
}
openFile(pdfString, filename, type) {
const blob = this.b64toBlob(pdfString, type)
openFile(blob: Blob, filename, type) {
let pathFile = ''
const fileName = filename
const contentFile = blob
@@ -1429,8 +1426,6 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
pathFile = this.file.externalRootDirectory
}
this.file
.writeFile(pathFile, fileName, contentFile, { replace: true })
.then(success => {