mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 09:20:06 +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
|
@ -23,9 +23,10 @@ const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
|
|||
* how these flags are being used:
|
||||
* - ANY, DISPLAY, and PRINT are the normal rendering intents, note the
|
||||
* `PDFPageProxy.{render, getOperatorList, getAnnotations}`-methods.
|
||||
* - ANNOTATIONS_FORMS, and ANNOTATIONS_STORAGE controls which annotations are
|
||||
* rendered onto the canvas, note the `renderInteractiveForms`- respectively
|
||||
* `includeAnnotationStorage`-options in the `PDFPageProxy.render`-method.
|
||||
* - ANNOTATIONS_FORMS, ANNOTATIONS_STORAGE, ANNOTATIONS_DISABLE control which
|
||||
* annotations are rendered onto the canvas (i.e. by being included in the
|
||||
* operatorList), note the `PDFPageProxy.{render, getOperatorList}`-methods
|
||||
* and their `annotationMode`-option.
|
||||
* - OPLIST is used with the `PDFPageProxy.getOperatorList`-method, note the
|
||||
* `OperatorList`-constructor (on the worker-thread).
|
||||
*/
|
||||
|
@ -35,9 +36,17 @@ const RenderingIntentFlag = {
|
|||
PRINT: 0x04,
|
||||
ANNOTATIONS_FORMS: 0x10,
|
||||
ANNOTATIONS_STORAGE: 0x20,
|
||||
ANNOTATIONS_DISABLE: 0x40,
|
||||
OPLIST: 0x100,
|
||||
};
|
||||
|
||||
const AnnotationMode = {
|
||||
DISABLE: 0,
|
||||
ENABLE: 1,
|
||||
ENABLE_FORMS: 2,
|
||||
ENABLE_STORAGE: 3,
|
||||
};
|
||||
|
||||
// Permission flags from Table 22, Section 7.6.3.2 of the PDF specification.
|
||||
const PermissionFlag = {
|
||||
PRINT: 0x04,
|
||||
|
@ -1027,6 +1036,7 @@ export {
|
|||
AnnotationFieldFlag,
|
||||
AnnotationFlag,
|
||||
AnnotationMarkedState,
|
||||
AnnotationMode,
|
||||
AnnotationReplyType,
|
||||
AnnotationReviewState,
|
||||
AnnotationStateModelType,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue