1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Add an annotation storage in order to save annotation data in acroforms

This commit is contained in:
Calixte Denizet 2020-07-22 13:55:52 +02:00
parent d69fb446bf
commit 584902dbf8
13 changed files with 152 additions and 7 deletions

View file

@ -38,6 +38,7 @@ class AnnotationLayerBuilder {
pdfPage,
linkService,
downloadManager,
annotationStorage,
imageResourcesPath = "",
renderInteractiveForms = false,
l10n = NullL10n,
@ -49,6 +50,7 @@ class AnnotationLayerBuilder {
this.imageResourcesPath = imageResourcesPath;
this.renderInteractiveForms = renderInteractiveForms;
this.l10n = l10n;
this.annotationStorage = annotationStorage;
this.div = null;
this._cancelled = false;
@ -73,6 +75,7 @@ class AnnotationLayerBuilder {
renderInteractiveForms: this.renderInteractiveForms,
linkService: this.linkService,
downloadManager: this.downloadManager,
annotationStorage: this.annotationStorage,
};
if (this.div) {
@ -124,6 +127,7 @@ class DefaultAnnotationLayerFactory {
createAnnotationLayerBuilder(
pageDiv,
pdfPage,
annotationStorage,
imageResourcesPath = "",
renderInteractiveForms = false,
l10n = NullL10n
@ -135,6 +139,7 @@ class DefaultAnnotationLayerFactory {
renderInteractiveForms,
linkService: new SimpleLinkService(),
l10n,
annotationStorage,
});
}
}

View file

@ -1164,6 +1164,7 @@ class BaseViewer {
renderInteractiveForms,
linkService: this.linkService,
downloadManager: this.downloadManager,
annotationStorage: this.pdfDocument.annotationStorage,
l10n,
});
}

View file

@ -53,6 +53,7 @@ function composePage(pdfDocument, pageNumber, size, printContainer) {
transform: [PRINT_UNITS, 0, 0, PRINT_UNITS, 0, 0],
viewport: pdfPage.getViewport({ scale: 1, rotation: size.rotation }),
intent: "print",
annotationStorage: pdfDocument.annotationStorage.getAll(),
};
return pdfPage.render(renderContext).promise;
})

View file

@ -49,6 +49,7 @@ function renderPage(activeServiceOnEntry, pdfDocument, pageNumber, size) {
transform: [PRINT_UNITS, 0, 0, PRINT_UNITS, 0, 0],
viewport: pdfPage.getViewport({ scale: 1, rotation: size.rotation }),
intent: "print",
annotationStorage: pdfDocument.annotationStorage.getAll(),
};
return pdfPage.render(renderContext).promise;
})