New Web Print Api lands in Firefox 18

Martin Brinkmann
Sep 29, 2012
Firefox
|
1

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)

Advertisement

Tutorials & Tips


Previous Post: «
Next Post: «

Comments

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

    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

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.