Install

Works with Drupal: ^10.3 || ^11

Using Composer to manage Drupal site dependencies

Alternative installation files

Download tar.gz 21.95 KB
MD5: b6eda6cb53799c43a9ddb1164a1ff8c9
SHA-1: 73bede5219e6ff56e35ba09a00535d60a0bbb673
SHA-256: 569bd20f0e87b2c68dfaf9e5ca6357448e8a1b5d662616b81419a80ea4497a7f
Download zip 32.62 KB
MD5: 1b3d4750db8df8be6238dc2901a1cdd1
SHA-1: 6245ba08b6b20d045642a9a04e59e30f4d5627f7
SHA-256: 66e128b27b57077af1fb7c2dec94747b0dc97dbe6b07cdf11c3631f259c50fc5

Release notes

Changes since 2.0.0-alpha1

  • Fixed the GitLab CI configuration (it referenced a template include that does not exist), so the pipeline now runs and passes.
  • PHPUnit tests are now discovered by the CI group filter (PHPUnit 11 attribute).
  • JavaScript and CSS reformatted to the Drupal core ESLint, Prettier and stylelint rules; viewer script restructured (no top-level await).
  • Added a project dictionary for cspell and the core .prettierrc.json.
  • README: documented the viewer trust boundary (iframe needs allow-same-origin) and the large PDF limitation.

No functional changes to the formatter or the viewer compared with alpha1.

2.0.0-alpha1 notes (still apply)

Complete rewrite for Drupal 10.3 and 11 (PHP 8.1+ on Drupal 10.3, PHP 8.3+ on Drupal 11). Not an upgrade path from 7.x/8.x: re-select the "ViewerJS" formatter on your displays.

  • Field formatter for file and image fields: overlay, new window or inline preview.
  • PDFs rendered with PDF.js (pdfjs-dist 4.2.67 or newer, keep it updated), images natively. SVG is never previewed.
  • Viewer toolbar: page indicator, zoom, fit width, fullscreen, download, print.
  • Previews are served from /viewerjs/frame/{file} with a strict Content-Security-Policy and Drupal file access checks (private files supported).
  • Status report entry for the PDF.js library; PDF preview is disabled if it is missing or too old.
  • The ViewerJS/WebODF library used by 7.x and 8.x is gone (it bundled a 2014 PDF.js with CVE-2024-4367 and many others). Removed: widget colors, thumbnail and image style settings, the template setting, the Libraries module dependency, the drush download command, ODF preview.

Installation

Install pdfjs-dist into libraries/pdfjs-dist (for example composer require npm-asset/pdfjs-dist with asset-packagist). Block libraries/pdfjs-dist/web/viewer.html at the web server. See the README.

Known limitations

No text selection or search layer yet. Very large PDFs (thousands of pages) are slow to open. The viewer iframe needs allow-same-origin (see README, Security notes).

Created by: mouhammed
Created on: 26 Oct 2026 at 14:58 UTC
Last updated: 26 Oct 2026 at 14:58 UTC
Bug fixes

Other releases