PDF.js was originally created as anextension forFirefox[4] and is included in Firefox since 2012 (version 15),[5][6] and enabled by default since 2013 (version 19).[7][8] It was added toFirefox for Android in 2023 (version 111).[9]
The project was created to provide a way for viewing PDF documents natively in the web browser, which prevents potential security risks when opening PDF documents outside a browser, as the code for displaying the document issandboxed in a browser.[10] Its implementation uses theCanvas element fromHTML5, which allows for fast rendering speeds.[10]
It can be integrated or embedded in a web or native application to enable PDF rendering and viewing, and allows advanced usages such asServer-side rendering.
According to a benchmark byMozilla, PDF.js is performant for viewing most common PDF files, while it may have some issues with large or 'graphics-heavy' documents.[22]
PDF.js supports most of the PDF specifications (including form support orXFA[23]), but some features have not been implemented yet, which may impact rendering behavior depending on the features the document uses.[24]
SeveralPDF/X or optional PDF features that are not supported in PDF.js include:
The PDF.js contributor community also notes that the browser behavior of PDF.js varies with browser support for PDF.js's required features.[28] Performance and reliability will be the best on Chrome and Firefox, which are fully supported and subject to automated testing.