- Generazione PDF e per Stampa
This commit is contained in:
@@ -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.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user