Errors with pdf.js e.g https://mozilla.github.io/pdf.js/legacy/web/viewer.html

For support with specific websites

Moderator: trava90

Forum rules
Please always mention the name/domain of the website in question in your topic title.
Please one website per topic thread (to help keep things organized). While behavior on different sites might at first glance seem similar, they are not necessarily caused by the same.

Please try to include any relevant output from the Toolkit Error Console or the Developer Tools Web Console using the following procedure:
  1. Clear any current output
  2. Navigate or refresh the page in question
  3. Copy and paste Errors or seemingly relevant Warnings into a single [ code ] block.
User avatar
malcolmd
Hobby Astronomer
Hobby Astronomer
Posts: 18
Joined: 2021-08-27, 13:35

Errors with pdf.js e.g https://mozilla.github.io/pdf.js/legacy/web/viewer.html

Post by malcolmd » 2025-09-04, 15:56

Hello,

I am trying to use pdf.js 5.4.149 with the standard distribution of Palemoon (and xulrunner built from version 6.7 release of UXP). While the PDF loads, the toolbar at the top is not displayed correctly.

The errors that are reported in the console are:

Code: Select all

Warning: Setting up fake worker.  (pdf.mjs:6350:13)

SyntaxError: import.meta may only appear in a module (pdf.worker.mjs:11338:29)

PDF 110dd61fd57444010b1ab5ff38782f0f [1.4 pdfeTeX-1.21a / TeX] (PDF.js: 5.4.162 [c386d9b87])  (viewer.mjs:21526:13)

Warning: Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering. (pdf.mjs:6350:13)

Warning: ICCBased color space: "InvalidAccessError: synchronous XMLHttpRequests do not support timeout and responseType.".  (pdf.worker.mjs:6084:13)

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience. For more help http://xhr.spec.whatwg.org/   (pdf.worker.mjs:8519:6)

Use of XMLHttpRequest’s responseType attribute is no longer supported in the synchronous mode in window context.    (pdf.worker.mjs:8520:2)
I have also tried the modern browser version but this fails earlier in the startup.

I've checked and the script tag in viewer.html sets the type of viewer.js to module.


I'd be grateful for any suggestions as to how we over come the "SyntaxError: import.meta may only appear in a module" error as this seems to be the reason that the toolbar is not displayed correctly.


Thanks in advance to your assistance.

User avatar
ron_1
Knows the dark side
Knows the dark side
Posts: 3021
Joined: 2012-06-28, 01:20

Re: Errors with pdf.js e.g https://mozilla.github.io/pdf.js/legacy/web/viewer.html

Post by ron_1 » 2025-09-04, 21:17

Try the one on the Pale Moon extension page. https://addons.palemoon.org/addon/pdf-js-for-seamonkey/

[BTW, I never open PDFs in the browser. Old Windows security habit that I never gave up.]

User avatar
malcolmd
Hobby Astronomer
Hobby Astronomer
Posts: 18
Joined: 2021-08-27, 13:35

Re: Errors with pdf.js e.g https://mozilla.github.io/pdf.js/legacy/web/viewer.html

Post by malcolmd » 2025-09-15, 17:02

The issue with v5 of pdfjs menus was that Goanna does not yet support "display: inline flex;"

For now we've reverted to an earlier version which does not use the new CSS display syntax. With a few tweaks we have got that working.

Thanks for the suggestions