Skip to content

Only call PDFDocumentProxy.getPermissions, in the viewer, when pdfjs.enablePermissions is set (PR 14362 follow-up) #14364

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

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions web/base_viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ class BaseViewer {
if (pdfDocument !== this.pdfDocument) {
return; // The document was closed while the permissions resolved.
}
if (!permissions || !this.#enablePermissions) {
if (!permissions) {
return;
}

Expand Down Expand Up @@ -554,7 +554,9 @@ class BaseViewer {
const firstPagePromise = pdfDocument.getPage(1);
// Rendering (potentially) depends on this, hence fetching it immediately.
const optionalContentConfigPromise = pdfDocument.getOptionalContentConfig();
const permissionsPromise = pdfDocument.getPermissions();
const permissionsPromise = this.#enablePermissions
? pdfDocument.getPermissions()
: Promise.resolve();

// Given that browsers don't handle huge amounts of DOM-elements very well,
// enforce usage of PAGE-scrolling when loading *very* long/large documents.
Expand Down