Skip to content

Add annotationMode option #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Conversation

pauldanner-wk
Copy link
Contributor

No description provided.

@pauldanner-wk
Copy link
Contributor Author

pauldanner-wk commented Jan 7, 2022

mozilla/pdf.js#13923

* @property {number} [annotationMode] Controls which annotations are rendered
 *   onto the canvas, for annotations with appearance-data; the values from
 *   {@link AnnotationMode} should be used. The following values are supported:
 *    - `AnnotationMode.DISABLE`, which disables all annotations.
 *    - `AnnotationMode.ENABLE`, which includes all possible annotations (thus
 *      it also depends on the `intent`-option, see above).
 *    - `AnnotationMode.ENABLE_FORMS`, which excludes annotations that contain
 *      interactive form elements (those will be rendered in the display layer).
 *    - `AnnotationMode.ENABLE_STORAGE`, which includes all possible annotations
 *      (as above) but where interactive form elements are updated with data
 *      from the {@link AnnotationStorage}-instance; useful e.g. for printing.
 *   The default value is `AnnotationMode.ENABLE`.

@aviary2-wf
Copy link

Security Insights

No security relevant content was detected by automated scans.

Action Items

  • Review PR for security impact; comment "security review required" if needed or unsure
  • Verify aviary.yaml coverage of security relevant code

Questions or Comments? Reach out on Slack: #support-infosec.

@semveraudit-wf
Copy link

Public API Changes

Recommendation: ⚠️ Minor version bump

@@ line 19: package:pdfjs/src/pdf_page_view.dart @@
+  enum AnnotationMode { disabled, enabled }
// Adding an enum is a minor change.
@@ line 19: package:pdfjs/src/pdf_page_view.dart @@
class PDFPageView
-     PDFPageView PDFPageView({DivElement container, num id, num scale, PageViewport defaultViewport, PDFPageViewRenderer renderer, IPDFAnnotationLayerFactory annotationLayerFactory, IPDFTextLayerFactory textLayerFactory})
+     PDFPageView PDFPageView({DivElement container, num id, num scale, PageViewport defaultViewport, PDFPageViewRenderer renderer, IPDFAnnotationLayerFactory annotationLayerFactory, IPDFTextLayerFactory textLayerFactory, AnnotationMode annotationMode})
//    `annotationMode` was added.
//    Adding an optional parameter is a minor change.

Showing results for 44e5476

Powered by semver-audit-service. Please report any problems by filing an issue.
Reported by the dart semver audit client 2.2.2
Browse public API.

@@ -47,7 +53,8 @@ class PDFPageView {
'renderer': rendererString,
'annotationLayerFactory': annotationLayerFactory?._jsInternal,
'textLayerFactory': textLayerFactory?._jsInternal,
'eventBus': JsObject(PDFJS.versionSafePdfJsViewerContext['EventBus'] as JsFunction),
'eventBus': JsObject(context['pdfjsViewer']['EventBus'] as JsFunction),
'annotationMode': annotationMode == AnnotationMode.disabled ? 0 : 2,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can tell, the default value appears to be 2
Screen Shot 2022-01-07 at 3 28 15 PM

const AnnotationMode = {
  DISABLE: 0,
  ENABLE: 1,
  ENABLE_FORMS: 2,
  ENABLE_STORAGE: 3,
};

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still need to check the behavior on if we would pass this option into an older version of pdf.js. Hopefully it would ignore it, but 🤷

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smoke tested with older versions of pdf.js (2.5.207), and didn't see any abnormalities in using this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants