RED-5931: fix document loading error
This commit is contained in:
parent
591676b033
commit
45e06c83b8
@ -137,7 +137,7 @@ export const appModuleFactory = (config: AppConfig) => {
|
||||
enabled: false,
|
||||
},
|
||||
PDF: {
|
||||
enabled: false,
|
||||
enabled: true,
|
||||
},
|
||||
FILE: {
|
||||
enabled: false,
|
||||
|
||||
@ -47,6 +47,7 @@ export class REDDocumentViewer {
|
||||
const toBool$ = event$.pipe(map(() => true));
|
||||
|
||||
return toBool$.pipe(
|
||||
tap(() => this.#flattenAnnotations()),
|
||||
tap(() => this.#setCurrentPage()),
|
||||
tap(() => this.#setInitialDisplayMode()),
|
||||
tap(() => this.updateTooltipsVisibility()),
|
||||
@ -161,6 +162,11 @@ export class REDDocumentViewer {
|
||||
}
|
||||
}
|
||||
|
||||
async #flattenAnnotations() {
|
||||
const pdfDoc = await this.#document.getDocument().getPDFDoc();
|
||||
await pdfDoc.flattenAnnotations(false);
|
||||
}
|
||||
|
||||
#disableTextPopupIfCompareMode(pageNumber) {
|
||||
if (this.#pdf.isCompare && pageNumber % 2 === 0) {
|
||||
return this.#pdf.disable('textPopup');
|
||||
|
||||
@ -175,12 +175,12 @@ export class PdfViewer {
|
||||
actionOnError?.();
|
||||
};
|
||||
|
||||
const document = await this.PDFNet.PDFDoc.createFromBuffer(await blob.arrayBuffer());
|
||||
await document.flattenAnnotations(false);
|
||||
this.fileId = file.fileId;
|
||||
this.dossierId = file.dossierId;
|
||||
|
||||
this.#instance.UI.loadDocument(document, { filename: file?.filename + '.pdf' ?? 'document.pdf', onError });
|
||||
this._logger.info('[PDF] Loading document...');
|
||||
|
||||
this.#instance.UI.loadDocument(blob, { documentId: file.fileId, filename: file?.filename ?? 'document.pdf', onError });
|
||||
}
|
||||
|
||||
quad(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, x4: number, y4: number) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user