Loading AI tools
PDF viewer in JavaScript included in Mozilla Firefox From Wikipedia, the free encyclopedia
PDF.js is a JavaScript library that renders Portable Document Format (PDF) files using the web standards-compliant HTML5 Canvas. The project is led by the Mozilla Corporation after Andreas Gal launched it (initially as an experiment) in 2011.
![]() | |
![]() PDF.js in Firefox 100, with a table of contents displayed on the sidebar | |
Original author(s) | Andreas Gal |
---|---|
Developer(s) | Mozilla |
Initial release | 2 July 2011[1] |
Stable release | |
Repository | |
Written in | JavaScript, CSS, HTML |
Platform | JavaScript engine, web browser |
Size | 3.94 MB[1] |
Type | PDF viewer |
License | Apache License 2.0[3] |
Website | mozilla |
PDF.js was originally created as an extension for Firefox[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 to Firefox 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 is sandboxed in a browser.[10] Its implementation uses the Canvas element from HTML5, which allows for fast rendering speeds.[10]
PDF.js is also used in Thunderbird,[11] ownCloud,[12] Nextcloud,[13][14] and is available as a browser extension for Google Chrome/Chromium,[15] Pale Moon[16][17] and SeaMonkey.[17][18]
It can be integrated or embedded in a web or native application to enable PDF rendering and viewing, and allows advanced usages such as Server-side rendering.
Many web applications, including Dropbox,[19] Slack,[20] and LinkedIn Learning[21] integrate PDF.js to enable previewing PDF documents.
According to a benchmark by Mozilla, 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 or XFA[23]), but some features have not been implemented yet, which may impact rendering behavior depending on the features the document uses.[24]
Several PDF/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.