Jun 17, 2011 12:21 GMT  ·  By

Mozilla is working on an HTML5-based PDF renderer for the web. When completed, it will allow browsers or any other application that implements it to display PDF files natively, using HTML, JavaScript and nothing else. This is a big development since, so far, the only way to display PDF files in a browser has been through third-party plugins.

Even Google Chrome's implementation still relies on custom code and is, essentially, a plugin, albeit one that's built into the browser.

"Building an HTML5-based PDF renderer would also answer the question of whether the web platform and, in particular, canvas and SVG APIs are complete enough to efficiently and faithfully render PDFs," Mozilla researcher Andreas Gal explained.

The developers have only started working on this, but progress has been good so far, only one month after the project started, and there are only a few things that need to be sorted out before pdf.js becomes a viable alternative, albeit a rather spartan one.

"We have been developing pdf.js in the open (on github.com), albeit quietly, for about a month now. We were waiting on the completion of some major features (Type1 fonts, gradients, etc.) before communicating pdf.js more broadly. We’ve been taken by surprise by the early and intense interest in our work," he explained.

This interest and fast progress is what drove the developers to start pushing the project and talking about it more widely. There is quite some work to be done, but the current target for reaching a workable state is three months.

At that point, the developers hope to be able to render most files found online, though not all features will be supported, obviously.

Once it reaches a good enough state, the project will be released as a Firefox extension which will enable the browser to render PDF files natively, without the need for any plugin.

"Displaying PDFs directly in the browser would definitely improve the user’s experience. There are literally millions (billions?) of PDFs floating around the web, and on many devices loading PDFs switches to a different application," Mozilla explained.

"It’s important to note that we’re not trying to promote PDF to a first-class web citizen like HTML5 is," it added. But the plan is to eventually build the JavaScript and HTML5 PDF renderer into Firefox.

There are quite a lot of benefits to doing this, it completely eliminates any security concerns PDF plugins usually come with, since it's all done with native web code, the browser doesn't have to take any further precautions. The project is open-source, so if it does reach a state where it's a viable alternative, you can expect others to implement it.