mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
#1940 Grosse Pdf-Dateien können nicht gedruckt werden
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core';
|
||||
import { Printer, DomainPrinterService } from '@domain/printer';
|
||||
import { UiModalRef } from '@ui/modal';
|
||||
import { isResponseArgs } from '@utils/object';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { PrintModalData } from './modal-printer.data';
|
||||
@@ -78,13 +80,24 @@ export class PrintModalComponent implements OnInit {
|
||||
|
||||
async print() {
|
||||
this.loaded = false;
|
||||
const printResponse = await this.modalRef.data.print(this.selectedPrinterValue);
|
||||
if (!printResponse.error) {
|
||||
this.printerService.setDefaultPrinter({ printerType: this.modalRef.data.printerType, printer: this.selectedPrinterValue });
|
||||
this.modalRef.close();
|
||||
} else {
|
||||
this.setError(printResponse.message);
|
||||
try {
|
||||
const printResponse = await this.modalRef.data.print(this.selectedPrinterValue);
|
||||
if (!printResponse.error) {
|
||||
this.printerService.setDefaultPrinter({ printerType: this.modalRef.data.printerType, printer: this.selectedPrinterValue });
|
||||
this.modalRef.close();
|
||||
} else {
|
||||
this.setError(printResponse.message);
|
||||
}
|
||||
} catch (error) {
|
||||
if (error instanceof HttpErrorResponse) {
|
||||
if (isResponseArgs(error.error)) {
|
||||
this.setError(error.error.message);
|
||||
} else {
|
||||
this.setError(error.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.loaded = true;
|
||||
this.cdr.markForCheck();
|
||||
}
|
||||
|
||||
@@ -52,10 +52,11 @@ export class PdfViewerModalComponent {
|
||||
content: PrintModalComponent,
|
||||
data: {
|
||||
printerType: 'Office',
|
||||
print: (printer) =>
|
||||
print: (printer) => {
|
||||
this.domainPrinterService
|
||||
.printPdf({ printer, data: this.taskCalendarService.removeMetaDataFromBase64(base64data) })
|
||||
.toPromise(),
|
||||
.toPromise();
|
||||
},
|
||||
} as PrintModalData,
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user