Skip to content

Commit

Permalink
Also enable renderInteractiveForms by default in the viewer compone…
Browse files Browse the repository at this point in the history
…nts (PR 12201 follow-up)

Given that `renderInteractiveForms` is now enabled by default in "full" viewer, it seems reasonable to enable it by default in the viewer components as well.
Especially considering that it's simple to disable, when creating the affected components, for anyone implementing their own viewer.
  • Loading branch information
Snuffleupagus committed Aug 22, 2020
1 parent 37c5660 commit a8de614
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/display/annotation_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1500,7 +1500,10 @@ class AnnotationLayer {
linkService: parameters.linkService,
downloadManager: parameters.downloadManager,
imageResourcesPath: parameters.imageResourcesPath || "",
renderInteractiveForms: parameters.renderInteractiveForms || false,
renderInteractiveForms:
typeof parameters.renderInteractiveForms === "boolean"
? parameters.renderInteractiveForms
: true,
svgFactory: new DOMSVGFactory(),
annotationStorage:
parameters.annotationStorage || new AnnotationStorage(),
Expand Down
4 changes: 2 additions & 2 deletions web/annotation_layer_builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class AnnotationLayerBuilder {
downloadManager,
annotationStorage = null,
imageResourcesPath = "",
renderInteractiveForms = false,
renderInteractiveForms = true,
l10n = NullL10n,
}) {
this.pageDiv = pageDiv;
Expand Down Expand Up @@ -133,7 +133,7 @@ class DefaultAnnotationLayerFactory {
pdfPage,
annotationStorage = null,
imageResourcesPath = "",
renderInteractiveForms = false,
renderInteractiveForms = true,
l10n = NullL10n
) {
return new AnnotationLayerBuilder({
Expand Down
7 changes: 5 additions & 2 deletions web/base_viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const DEFAULT_CACHE_SIZE = 10;
* @property {string} [imageResourcesPath] - Path for image resources, mainly
* mainly for annotation icons. Include trailing slash.
* @property {boolean} [renderInteractiveForms] - Enables rendering of
* interactive form elements. The default is `false`.
* interactive form elements. The default value is `true`.
* @property {boolean} [enablePrintAutoRotate] - Enables automatic rotation of
* landscape pages upon printing. The default is `false`.
* @property {string} renderer - 'canvas' or 'svg'. The default is 'canvas'.
Expand Down Expand Up @@ -152,7 +152,10 @@ class BaseViewer {
? options.textLayerMode
: TextLayerMode.ENABLE;
this.imageResourcesPath = options.imageResourcesPath || "";
this.renderInteractiveForms = options.renderInteractiveForms || false;
this.renderInteractiveForms =
typeof options.renderInteractiveForms === "boolean"
? options.renderInteractiveForms
: true;
this.enablePrintAutoRotate = options.enablePrintAutoRotate || false;
this.renderer = options.renderer || RendererType.CANVAS;
this.enableWebGL = options.enableWebGL || false;
Expand Down
2 changes: 1 addition & 1 deletion web/interfaces.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class IPDFAnnotationLayerFactory {
pdfPage,
annotationStorage = null,
imageResourcesPath = "",
renderInteractiveForms = false,
renderInteractiveForms = true,
l10n = undefined
) {}
}
Expand Down
7 changes: 5 additions & 2 deletions web/pdf_page_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import { viewerCompatibilityParams } from "./viewer_compatibility.js";
* @property {string} [imageResourcesPath] - Path for image resources, mainly
* for annotation icons. Include trailing slash.
* @property {boolean} renderInteractiveForms - Turns on rendering of
* interactive form elements. The default is `false`.
* interactive form elements. The default value is `true`.
* @property {string} renderer - 'canvas' or 'svg'. The default is 'canvas'.
* @property {boolean} [enableWebGL] - Enables WebGL accelerated rendering for
* some operations. The default value is `false`.
Expand Down Expand Up @@ -90,7 +90,10 @@ class PDFPageView {
? options.textLayerMode
: TextLayerMode.ENABLE;
this.imageResourcesPath = options.imageResourcesPath || "";
this.renderInteractiveForms = options.renderInteractiveForms || false;
this.renderInteractiveForms =
typeof options.renderInteractiveForms === "boolean"
? options.renderInteractiveForms
: true;
this.useOnlyCssZoom = options.useOnlyCssZoom || false;
this.maxCanvasPixels = options.maxCanvasPixels || MAX_CANVAS_PIXELS;

Expand Down

0 comments on commit a8de614

Please sign in to comment.