1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 17:48:07 +02:00

[api-minor] Remove the separate enableScripting option in BaseViewer

Prior to PR 13042, when scripting wasn't really possible to use outside of the full viewer, the `enableScripting` option made sense.
However, at this point in time having to both pass in a `PDFScriptingManager`-instance *and* set the `enableScripting`-boolean when creating a `BaseViewer`-instance feels redundant and (mostly) annoying. Hence this patch, which removes the *separate* boolean and always enables scripting when `scriptingManager` is provided.

The relevant "viewer component" examples are also updated (with a comment), but in such a way that scripting support won't just break when used with the current PDF.js releases.
This commit is contained in:
Jonas Jenwald 2021-07-29 09:53:24 +02:00
parent 4ad5c5d52a
commit 76c805f83b
4 changed files with 13 additions and 14 deletions

View file

@ -35,8 +35,6 @@ const DEFAULT_URL = "../../web/compressed.tracemonkey-pldi-09.pdf";
// var DEFAULT_URL = "../../test/pdfs/160F-2019.pdf";
const SEARCH_FOR = ""; // try 'Mozilla';
// For scripting support, note also `enableScripting` below.
const SANDBOX_BUNDLE_SRC = "../../node_modules/pdfjs-dist/build/pdf.sandbox.js";
const container = document.getElementById("viewerContainer");
@ -66,7 +64,7 @@ const pdfViewer = new pdfjsViewer.PDFViewer({
linkService: pdfLinkService,
findController: pdfFindController,
scriptingManager: pdfScriptingManager,
enableScripting: true,
enableScripting: true, // Only necessary in PDF.js version 2.10.377 and below.
});
pdfLinkService.setViewer(pdfViewer);
pdfScriptingManager.setViewer(pdfViewer);