An experimental API for printing has landed in Firefox 18. The API’s creation was driven by the needs of pdf.js and was designed by Robert O’Callahan and Julian Viereck and implemented by Julian and I.
- How do you print a pdf with hundreds of pages?
- How do you get high quality output?
mozPrintCallback – A new callback for canvas that is executed during the printing process. This callback can access the printing canvas context and perform any calls that are normally done to a 2D canvas context. When the callback is finished with rendering it must call printState.done() to tell the printing code to advance. The benefits of this approach are: 1) we don’t have to try and render every page before print, 2) the output gets rasterized later in the printing process where it should be. (This is not available for all platforms yet).
As I mentioned above, this is still experimental and currently only available in the Nightly (FF18) version of Firefox. However, we plan to propose it as a standard since we think it has many interesting use cases outside of pdf.js. We’d love to hear your thoughts. Is this useful? Is there anything you’d change or add? Please share your feedback here via comments or in the mailing list.