PDFviewer module requires pdf.js

Hello,

I am trying to install the PDFviewer module on Omeka S 3.1.1 but I get this message:

“The library “Mozilla pdf.js” should be installed. See module’s installation documentation”

It is not clear in the documentation how to install pdf.js for this module.

The readme says that the external library is included in the ZIP. Did you install via ZIP or via git?

Hello,

From the readme document I am assuming the release Zip is the PdfViewer.zip file, so I download that one…

Then I unzip and rename the folder to “PdfViewer” and run the following commands in a Ubuntu terminal…

npm install
cd node_modules/pdf.js
npm install

The npm install command gives lots of dependency errors.

One of the errors is a dependency that is no longer downloadable from the following github location…

https://github.com/Automattic/node-canvas/releases/download/v2.9.1/canvas-v2.9.1-node-v108-linux-glibc-x64.tar.gz

I am using Node 18.0.0. Not sure if I need to use a specific version of Node.

I think you have misunderstood the instructions: Either the installation via zip OR with composer /npm.
So just extract the zip to the module folder on the server and install the module in the backend of Omeka. No further commands on the command line are necessary.

Does this work?

Hello,

Thankyou. Unfortunately it does not work. I download PdfViewer 3.3.4.1 zip file from the following page and unzip it to the modules folder…

It shows up in the Modules as available to install. I press the install button…

But the following error message appears…

“The library “Mozilla pdf.js” should be installed. See module’s installation documentation.”

I am using the latest version of Omeka S.

Perhaps I am downloading the wrong Zip file? But I cannot find any other Zip file to download.

Also, I am behind a university firewall, so I wonder if it needs proxy server settings to be configured somewhere?

Many thanks

Hi @evansad, it looks like @Daniel_KM made a breaking change in a patch version 3.1.2 update where pdf.js is no longer included in the distributed zip (or the repo). I think there are a couple of options to get it working:

  • Manually add it back in locally to your installed module in the appropriate directory
  • Follow the instructions to install it via npm
  • Fork the repo, add pdf.js back in, and make a pull request for @Daniel_KM to merge into the original repo
  • Reach out to @Daniel_KM directly and wait for the module to be updated (either the code or the readme since we don’t know if this change was intentional or not)
1 Like

Thanks for the info. At least it is confirmed to be a bug.

Best regards.

@dan hello. It doess not work. I tried he zip files from several versions, new and old and I get the same message : The library “Mozilla pdf.js” should be installed. See module’s installation documentation.

@rudi, please follow the the steps @fackrellj mentioned. I’m not the delevoper of the module.

Hello

PdfViewer-3.3.4.1 definitely does not work on the latest version of Omeka S. The instructions are incorrect as it refers to a folder “node_modules/pdf.js” which does not exist.

However the latest pre-release version of the module does work.

Is there an estimated date when the pre-release version will be finished?

Hello,

I managed to get it working like this :

Using the version 3.3.4.1 (the latest i had through easy install), i checked into Module.php (at the root).

The file checks if pdf.js is installed inside asset/vendor/, but checks for the wrong name :

change

protected function preInstall(): void

    {

        $js = __DIR__ . '/asset/vendor/pdf.js/build/pdf.js';

        if (!file_exists($js)) {

To

protected function preInstall(): void

    {

        $js = __DIR__ . '/asset/vendor/pdf.js/build/pdf.min.js';

        if (!file_exists($js)) {

And you will be able to install the module.

My asset folder looks like this :

image

2 Likes

This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.