mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
[api-minor] Introduce a new annotationMode
-option, in PDFPageProxy.{render, getOperatorList}
*This is a follow-up to PRs 13867 and 13899.* This patch is tagged `api-minor` for the following reasons: - It replaces the `renderInteractiveForms`/`includeAnnotationStorage`-options, in the `PDFPageProxy.render`-method, with the single `annotationMode`-option that controls which annotations are being rendered and how. Note that the old options were mutually exclusive, and setting both to `true` would result in undefined behaviour. - For improved consistency in the API, the `annotationMode`-option will also work together with the `PDFPageProxy.getOperatorList`-method. - It's now also possible to disable *all* annotation rendering in both the API and the Viewer, since the other changes meant that this could now be supported with a single added line on the worker-thread[1]; fixes 7282. --- [1] Please note that in order to simplify the overall implementation, we'll purposely only support disabling of *all* annotations and that the option is being shared between the API and the Viewer. For any more "specialized" use-cases, where e.g. only some annotation-types are being rendered and/or the API and Viewer render different sets of annotations, that'll have to be handled in third-party implementations/forks of the PDF.js code-base.
This commit is contained in:
parent
56e7bb626c
commit
41efa3c071
16 changed files with 272 additions and 134 deletions
|
@ -24,7 +24,7 @@ import { SimpleLinkService } from "./pdf_link_service.js";
|
|||
* @property {AnnotationStorage} [annotationStorage]
|
||||
* @property {string} [imageResourcesPath] - Path for image resources, mainly
|
||||
* for annotation icons. Include trailing slash.
|
||||
* @property {boolean} renderInteractiveForms
|
||||
* @property {boolean} renderForms
|
||||
* @property {IPDFLinkService} linkService
|
||||
* @property {DownloadManager} downloadManager
|
||||
* @property {IL10n} l10n - Localization service.
|
||||
|
@ -44,7 +44,7 @@ class AnnotationLayerBuilder {
|
|||
downloadManager,
|
||||
annotationStorage = null,
|
||||
imageResourcesPath = "",
|
||||
renderInteractiveForms = true,
|
||||
renderForms = true,
|
||||
l10n = NullL10n,
|
||||
enableScripting = false,
|
||||
hasJSActionsPromise = null,
|
||||
|
@ -55,7 +55,7 @@ class AnnotationLayerBuilder {
|
|||
this.linkService = linkService;
|
||||
this.downloadManager = downloadManager;
|
||||
this.imageResourcesPath = imageResourcesPath;
|
||||
this.renderInteractiveForms = renderInteractiveForms;
|
||||
this.renderForms = renderForms;
|
||||
this.l10n = l10n;
|
||||
this.annotationStorage = annotationStorage;
|
||||
this.enableScripting = enableScripting;
|
||||
|
@ -90,7 +90,7 @@ class AnnotationLayerBuilder {
|
|||
annotations,
|
||||
page: this.pdfPage,
|
||||
imageResourcesPath: this.imageResourcesPath,
|
||||
renderInteractiveForms: this.renderInteractiveForms,
|
||||
renderForms: this.renderForms,
|
||||
linkService: this.linkService,
|
||||
downloadManager: this.downloadManager,
|
||||
annotationStorage: this.annotationStorage,
|
||||
|
@ -139,7 +139,7 @@ class DefaultAnnotationLayerFactory {
|
|||
* @param {AnnotationStorage} [annotationStorage]
|
||||
* @param {string} [imageResourcesPath] - Path for image resources, mainly
|
||||
* for annotation icons. Include trailing slash.
|
||||
* @param {boolean} renderInteractiveForms
|
||||
* @param {boolean} renderForms
|
||||
* @param {IL10n} l10n
|
||||
* @param {boolean} [enableScripting]
|
||||
* @param {Promise<boolean>} [hasJSActionsPromise]
|
||||
|
@ -151,7 +151,7 @@ class DefaultAnnotationLayerFactory {
|
|||
pdfPage,
|
||||
annotationStorage = null,
|
||||
imageResourcesPath = "",
|
||||
renderInteractiveForms = true,
|
||||
renderForms = true,
|
||||
l10n = NullL10n,
|
||||
enableScripting = false,
|
||||
hasJSActionsPromise = null,
|
||||
|
@ -161,7 +161,7 @@ class DefaultAnnotationLayerFactory {
|
|||
pageDiv,
|
||||
pdfPage,
|
||||
imageResourcesPath,
|
||||
renderInteractiveForms,
|
||||
renderForms,
|
||||
linkService: new SimpleLinkService(),
|
||||
l10n,
|
||||
annotationStorage,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue