Hello,

I've got the dev version of PDF installed on Drupal 8.2.2. I also have the version of pdf.js in this directory: /libraries/pdf.js downloaded from the link on the main module page.

Despite that, I still get this error on my site's status report page:

Not available (Download from http://mozilla.github.io/pdf.js)

Any ideas what may be wrong?

Thank you for any help you you can provide.

Comments

georgedamonkey created an issue. See original summary.

shenzhuxi’s picture

Component: Code » Miscellaneous
Assigned: Unassigned » shenzhuxi
Category: Bug report » Support request
Status: Active » Postponed (maintainer needs more info)

Are you using Linux? Have you check your file permission setting?
What's the pdf.js version?

georgedamonkey’s picture

Yes, I'm running Ubuntu 16.04. Here are the permissions:

drwxr-xr-x 4 root www-data 4096 Nov 11 11:33 pdf.js

It's the latest stable version, 1.5.188

georgedamonkey’s picture

Status: Postponed (maintainer needs more info) » Active
dirmar’s picture

Comparable problem with Windows 10, Wampserver64 (but also on the production site), Drupal 8.2.6, pdf.js 1.6.210. Browsers Internet Explorer 11 , Edge and Firefox.

In the file-field manage display the options ‘PDF: Continuous scroll’ and ‘PDF: Display the first page’ are working fine, great!
But choosing ‘PDF: Default viewer of pdf.js’ generates the message 'Please download and install pdf.js!' just after the label without showing the pdf-file.

What I did: First installed the Libraties module (8.x-3.x-dev), then unzipped the pdf.js in /libraries/pdf.js/ and as last installed the PDF module. Flushed all caches, restarted Wamp, gave the verified user all rights and disabled Windows blocking of the files pdf.js and pdf.worker.js, unchecked Combine JavaScript files in Drupal, but unfortunately no avail.

Maybe I'm doing something wrong or do I just have to be patient? Could you please give me advice? Thanks.

fndtn357’s picture

Upon checking the pdf.module the version argument pattern is not up-to-date and does not match the new library anymore.

Please see pdf.module file and check out pdf_libraries_info()

function pdf_libraries_info() {
  $libraries = array();

  $libraries['pdf.js'] = array(
    'name' => 'pdf.js',
    'vendor url' => 'http://mozilla.github.io/pdf.js/',
    'download url' => 'http://mozilla.github.io/pdf.js/getting_started/#download',
    'version arguments' => array(
      'file' => 'build/pdf.js',
      'pattern' => '/ersion\s=\s\'(.*)\'/',
      'lines' => 32,
    ),

Where the pattern should be:

'pattern' => '/ersion\s(.*)\s/',

The reason behind it, the pdf.js

$ head -n10 build/pdf.js

/* Copyright 2017 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

There's no *ersions = 'X'* within the first 32 lines of the script. However there's *Versions 2.0* which pattern ersions\s(.*)\s can match.

In summary:

You may contact the author, or hack the module right away just to test (we don't recommend modifying the module as it may get overwritten during updates):

Open pdf.module and modify line 50 to -> 'pattern' => '/ersion\s(.*)\s/',

fndtn357’s picture

Version: 8.x-1.x-dev » 7.x-1.8

this comment is possibly reserved for just the latest Drupal 7 version; I have not tried to analyze or work with the Drupal 8 version of this module.
My apologies for posting incorrectly.

canucklehead’s picture

I tried the fix in #6 but it broke my site, giving me the white screen of death. Putting it back did not remedy. I could not get to any pages until I deleted the pdf module files and then I was able to get to and run update.php and get back to pre-pdf installation status.

georgedamonkey’s picture

Version: 7.x-1.8 » 8.x-1.x-dev
jasonflaherty’s picture

#6 was the fix for me on Drupal 7.

shenzhuxi’s picture

Status: Active » Fixed

I closed this issue since Library was not required for 8.x and 7.x has been fixed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.