- Generazione PDF e per Stampa

This commit is contained in:
Surya Paolo
2025-05-12 16:33:58 +02:00
parent 6ed648f8b3
commit ef48d7e741
9 changed files with 142 additions and 79 deletions

View File

@@ -2538,6 +2538,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
file_out: string = '',
print: boolean = false,
optcatalogo: IOptCatalogo | null = null,
salvasufiledascaricare
) {
try {
if (!pdfFile) {
@@ -2567,16 +2568,20 @@ export const useGlobalStore = defineStore('GlobalStore', {
const response = await this.execConvertPDF(formData);
if (response) {
const blob = new Blob([response], { type: 'application/pdf' });
const downloadUrl = window.URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = downloadUrl;
link.setAttribute('download', filenameToDownload);
document.body.appendChild(link);
link.click();
link.remove();
if (salvasufiledascaricare) {
const blob = new Blob([response], { type: 'application/pdf' });
const downloadUrl = window.URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = downloadUrl;
link.setAttribute('download', filenameToDownload);
document.body.appendChild(link);
link.click();
link.remove();
window.URL.revokeObjectURL(downloadUrl);
window.URL.revokeObjectURL(downloadUrl);
} else {
return response
}
} else {
console.error('No data returned from the server.');
}