doqment (pronounced as doc-HUE-ment) is a custom deployment of the PDF.js generic viewer with doq reader mode add-on (that lets you change the PDF’s colors) on top, packaged as a Web Extension.
It also adds some other features like Smart Zoom text and Show/Hide toolbar to optimize space and assist reading, especially on smaller devices.
Here is the demo PDF rendered in Solarized Light theme:
View more screenshots.
Latest release can be installed from AMO / CWS, or downloaded from Releases.
In Firefox, doqment replaces the built-in PDF.js viewer as the default PDF viewer application. In Chrome(ium), it co-exists with the native viewer, and provides a context menu and toolbar button to open PDFs in it instead.
Preferences for both the PDF.js viewer and doq can be configured through the extension options page (right click the toolbar icon and choose Options or Manage Extension -> Preferences).
It is recommended to disable the built-in viewer while this extension is enabled to avoid funny and weird behaviours while opening/downloading PDFs. (Go to Settings -> Files and Applications -> set the Action for PDF to something other than Open in Firefox).
The extension can open PDF links via the context menu whether the native viewer
is enabled or disabled. To always open PDFs in the browser without downloading
them first, keep it enabled. (Go to Settings -> Privacy and security ->
Site Settings -> Additional content settings (under Content) ->
PDF documents; or open chrome://settings/content/pdfDocuments
).
Note: In Firefox, doqment uses Manifest Version 2, while in Chromiums it uses MV3.
$ cd src
$ ln -sf manifest-v2.json manifest.json # for Firefox (default)
$ ln -sf manifest-v3.json manifest.json # for Chrome, Edge, etc
about:debugging
/ chrome:extensions
(or using
web-ext
)Run the pack.sh
script from the repo root:
$ ./pack.sh [mv2|mv3] # default is mv2
Compared with the viewer baked right into Firefox’s code, an extension is a lot less previleged and hence, has certain limitations:
file:
URL scheme. The user has to first
open the extension’s viewer in a tab and use the viewer’s UI to open them
(hence a browser toolbar button is provided for this).file:
URLs, only if the user grants access in the extension’s
settings.As the built-in viewer of Firefox is a previleged page, extensions cannot modify it. Thus a custom deployment is currently the only way to ship add-ons to the viewer (other than getting your patch merged into PDF.js).
On the plus side, this also enables users of other browsers to have PDF.js and doq.
This project can also be used as a boilerplate by anyone else wishing to develop their own awesome crazy add-on for the PDF.js viewer.
For the rationale behind reader mode see the doq Readme.
Happy PDF Reading!