New Web Print Api lands in Firefox 18 - gHacks Tech News

New Web Print Api lands in Firefox 18

Mozilla has just implemented a new web printing api in recent Firefox 18 Nightly builds that aims to improve the print quality in the web browser. It has primarily been added for the web browser's built-in pdf reader pdf.js, but has been implemented to work with all print outs of the browser.

The browser executes a new callback - mozPrintCallback - during the printing process. It can access the printing canvas context and perform "any calls that are normally done to a 2D canvas context". Once done with the rendering the printing proceeds as usual.

Mozilla sees two core benefits over the previous way of printing in the Firefox web browser:

  • The browser does not have to render every page before the printing starts
  • The output gets rasterized later in the printing process

A newly create wiki page over at Mozilla offers additional information about the current WebPrintApi implementation which is mostly interesting to web developers:

  • Points (pt) are used as metrics for printing, use of px is forbidden
  • Custom page printing is supported
  • Only one page size per PrintDocument. The size is defined in the PrintDocument constructor.
  • PrintRenderingContext is similar to CanvasRenderingContext2d.

The page lists several open questions that Mozilla has not decided upon yet. This includes whether the api should support different color spaces than RGB, whether a progress view should be displayed while the pages are drawn, or how (0,0) is defined.

The printing API is an experimental feature right now, which may or may not make its way into a stable Firefox version. I can't really remember when I printed out the last documents, must have been ages ago. What are your takes on the new printing api that aims to improve quality of the output and the printing process? (via Techdows)


We need your help

Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.

We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats or subscription fees.

If you like our content, and would like to help, please consider making a contribution:

Previous Post: «
Next Post: »


  1. Roman ShaRP said on September 30, 2012 at 4:45 pm

    If it won’t broke anything, — let it be, and we’ll see if it delivers quality in comparison. I use printing pretty often — but printing to PDF.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

Please note that your comment may not appear immediately after you post it.

Be polite: we do not allow comments that threaten or harass, or are personal attacks. Please leave politics and religion out of discussions!