Migrating from Mozilla PDF.js

Mozilla’s PDF.js is an open source, client-side PDF renderer by Mozilla that is completely based on JavaScript. It’s currently used by Firefox but will eventually be replaced by a faster, native renderer via Mozilla’s Project Mortar.

PDF.js can deal with most basic PDF content but has problems with more complex documents:

Based on a presentation by the Mozilla team, Mozilla has no plans to fully support more complex PDF features that are required for accurate rendering, and it will likely phase out development once its native PDF Viewer (Project Mortar) is complete. Since PDF.js uses the browser’s <canvas> for rendering, results will vary between browsers (e.g. there’s a bug where text can be invisible in Internet Explorer 11).

PSPDFKit for Web vs. PDF.js

PSPDFKit for Web is a hybrid renderer. It can render on the client or server, depending on device capability and power. This allows you to view a 500 MB+ file on your smartphone, even on a slow connection; make notes that are instantly synced to our Instant on-premises server; and continue to mark up the file on either your desktop browser or a native iOS app such as PDF Viewer.

PSPDFKit’s client side uses the same technology we use in iOS and Android, thereby delivering the same high-fidelity rendering and a consistent result regardless of the browser capabilities.

Overview

PDF.js consists of two parts: a low-level PDF renderer, and an example viewer implementation. The low-level API can read values from PDF documents and render pages into canvas elements. In addition to the PDF rendering, PDF.js also comes with an example viewer implementation that makes use of the low-level rendering API. The official API describes the rendering API access, whereas the viewer can currently only be configured with a limited amount of URL parameters.

PSPDFKit for Web as a PDF.js Alternative

In contrast, PSPDFKit for Web implements a rich and highly configurable production-ready viewer. With features like the fully configurable ViewState and extensive CSS customization, we make sure you can provide your users with the best PDF viewer experience. We allow our viewer to be easily embedded in your existing application without the need to handle direct PDF render instructions. A PDF.js-compatible low-level API for a simpler PDF.js replacement is planned for a future version.