Mozilla’s standards based PDF reader


Firefox could natively render most PDFs online soon

Andreas Gal, researcher at Mozilla, has revealed Mozilla is working on a web-standards-based PDF reader, pdf.js (see Github for the latest code). He told .net that the idea was born on a recent business trip to Asia. "Chris Jones and I were discussing what platform capabilities might be missing from HTML5. We were wondering why Google Chrome embedded a native code PDF renderer to display PDFs and why nobody had implemented a PDF reader in HTML5/JavaScript yet," he recalls. "If you can do anything you want with HTML5, why would you have to use native code? We wanted to see whether doing this in JavaScript and HTML5 resulted in competitive performance and visual quality."

The main challenge was that PDF is a substantial specification. Gal says he and Jones were warned it could take a substantial time investment before they could get anything to render. "Fortunately, this turned out to be a less severe issue than we thought," says Gal. "HTML5 offers great high-level APIs for graphics and text rendering, so we didn't have to deal with any of those low-level problems, which greatly reduced what we had to implement. We already render a substantial subset of PDF, and our codebase is still below 5000 lines of code."

Short-term, Gal's blog post suggests the aim is to use pdf.js to render PDFs 'natively' within Firefox, but longer term aims are for a more open approach. "We are targeting HTML5, and any modern browser that supports it. As of today, [pdf.js] works in Firefox and Chrome," he says, adding that Safari and IE9 "both seem to be missing WebGL typed arrays at the moment". Gal hopes they'll catch up with the spec, otherwise a slower workaround might have to be devised for them.

Thank you for reading 5 articles this month* Join now for unlimited access

Enjoy your first month for just £1 / $1 / €1

*Read 5 free articles per month without a subscription

Join now for unlimited access

Try first month for just £1 / $1 / €1

The Creative Bloq team is made up of a group of design fans, and has changed and evolved since Creative Bloq began back in 2012. The current website team consists of seven full-time members of staff: Editor Georgia Coggan, Deputy Editor Rosie Hilder, Deals Editor Beren Neale, Senior News Editor Daniel Piper, Digital Arts and Design Editor Ian Dean, Tech Reviews Editor Erlingur Einarsson and Ecommerce Writer Abi Le Guilcher, as well as a roster of freelancers from around the world. The 3D World and ImagineFX magazine teams also pitch in, ensuring that content from 3D World and ImagineFX is represented on Creative Bloq.