Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Fix: render PDF form values in annotation layer (#13607)

shamoon2635a12281a7
diff --git a/src-ui/src/app/components/common/pdf-viewer/pdf-viewer.component.scss b/src-ui/src/app/components/common/pdf-viewer/pdf-viewer.component.scss
index 6863f5463..b68836b4a 100644
--- a/src-ui/src/app/components/common/pdf-viewer/pdf-viewer.component.scss
+++ b/src-ui/src/app/components/common/pdf-viewer/pdf-viewer.component.scss
@@ -151,6 +151,13 @@
inset: 0;
pointer-events: none;
+ & section {
+ position: absolute;
+ text-align: initial;
+ box-sizing: border-box;
+ transform-origin: 0 0;
+ }
+
& .annotationTextContent {
opacity: 0;
}
diff --git a/src-ui/src/app/components/common/pdf-viewer/pdf-viewer.component.ts b/src-ui/src/app/components/common/pdf-viewer/pdf-viewer.component.ts
index f5798650e..959ea3011 100644
--- a/src-ui/src/app/components/common/pdf-viewer/pdf-viewer.component.ts
+++ b/src-ui/src/app/components/common/pdf-viewer/pdf-viewer.component.ts
@@ -13,6 +13,7 @@ import {
ViewChild,
} from '@angular/core'
import {
+ AnnotationMode,
getDocument,
GlobalWorkerOptions,
PDFDocumentLoadingTask,
@@ -221,6 +222,7 @@ export class PngxPdfViewerComponent
linkService: this.linkService,
findController: this.findController,
textLayerMode,
+ annotationMode: AnnotationMode.ENABLE,
enableSelectionRendering: false,
removePageBorders: true,
}
diff --git a/src-ui/src/test/mocks/pdfjs-legacy-build-pdf.ts b/src-ui/src/test/mocks/pdfjs-legacy-build-pdf.ts
index 30e3ac410..aa5ec9460 100644
--- a/src-ui/src/test/mocks/pdfjs-legacy-build-pdf.ts
+++ b/src-ui/src/test/mocks/pdfjs-legacy-build-pdf.ts
@@ -19,6 +19,13 @@ export const GlobalWorkerOptions = {
workerSrc: '',
}
+export const AnnotationMode = {
+ DISABLE: 0,
+ ENABLE: 1,
+ ENABLE_FORMS: 2,
+ ENABLE_STORAGE: 3,
+}
+
export const getDocument = (_src: unknown): PDFDocumentLoadingTask => {
return new PDFDocumentLoadingTask(Promise.resolve(new PDFDocumentProxy()))
}