Mozilla Developing In-Browser PDF Viewer in HTML5, JavaScript

Pulkit Chandna

Google began shipping its Chrome web browser with a built-in PDF viewer almost a year ago, making it the first browser to have such a feature. In fact, it still continues to be the only one. This is quite strange, particularly because of the competitive nature of the browser market. But Mozilla is now getting ready to catch up with Google in this department.

“While traveling to the Firefox 4 launch parties in Seoul and Taipei all the way from California, we killed a lot of time by brainstorming cool things to do with the web platform,” Dr. Andreas Gal, a researcher at Mozilla, wrote on his personal blog. “Like many before us, we were wondering why nobody had implemented a PDF reader in HTML5/JavaScript. The kinds of operations a PDF reader needs to be fast at –render text, draw lines, blit images– need to be fast in browsers too, so browsers are already highly optimized for them.”

It’s clear that Mozilla’s approach to in-browser PDF reader functionality is very different from Google’s. Unlike Mozilla, which is developing its in-browser PDF reader entirely in HTML5 and JavaScript, Google uses a native-code plugin. According to Gal, the more traditional approach used by Google is bit of a security headache as it “enlarges the trusted code base, and because of that Google’s Chrome browser goes through quite some pain to sandbox the PDF renderer to avoid code injection attacks.”

The open-source outfit has been busy developing its browser-native “pdf.js” reader ( demo ) for nearly a month now and expects to have it ready within the next three months.

Around the web