Skip to content

Commit

Permalink
fix bus-event and get pdfDocument from this
Browse files Browse the repository at this point in the history
  • Loading branch information
panaC committed Nov 22, 2024
1 parent aa7fc73 commit 6ef26ba
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
21 changes: 11 additions & 10 deletions web/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,14 +378,15 @@ const PDFViewerApplication = {
async _initializeViewerComponents() {
const { appConfig, externalServices, l10n } = this;

const eventBus =
typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")
? new FirefoxEventBus(
AppOptions.get("allowedGlobalEvents"),
externalServices,
AppOptions.get("isInAutomation")
)
: new EventBus();
// const eventBus =
// typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")
// ? new FirefoxEventBus(
// AppOptions.get("allowedGlobalEvents"),
// externalServices,
// AppOptions.get("isInAutomation")
// )
// : new EventBus();
const eventBus = window.pdfjsEventBus;
this.eventBus = AppOptions.eventBus = eventBus;
this.mlManager?.setEventBus(eventBus, this._globalAbortController.signal);

Expand Down Expand Up @@ -2026,9 +2027,9 @@ const PDFViewerApplication = {
});
const img = await blob.arrayBuffer();

const doc = page?.annotationLayerFactory?.pdfDocument;
const doc = this.pdfDocument;
const metadata = await doc.getMetadata();
const numberofpages = doc?.numPages;
const numberofpages = doc.numPages;
const numberOfPagesChecked = typeof numberofpages === "number" ? numberofpages : 0;

// https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
Expand Down
1 change: 0 additions & 1 deletion web/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ function getViewerConfiguration() {
principalContainer: document.getElementById("mainContainer"),
mainContainer: document.getElementById("viewerContainer"),
viewerContainer: document.getElementById("viewer"),
eventBus: window.pdfjsEventBus,
toolbar: {
container: document.getElementById("toolbarContainer"),
numPages: document.getElementById("numPages"),
Expand Down

0 comments on commit 6ef26ba

Please sign in to comment.