From MozillaWiki
Jump to: navigation, search

Some ideas on how to improve the print preview situation for Gecko 1.9.


  • Currently print preview is completely modal, because we can't allow the underlying document to change while we're print previewing it.
  • We don't allow any interaction with the print preview, such as changing margins or scaling.
  • The entire contents of the print preview window, including page shadows and any UI (well, there isn't any, but still...) are defined in Gecko print-related frame code. This is a big problem for anyone who might want to enhance print preview.
  • The print preview presentation doesn't necessarily have the same layout as the print presentation. In many ways it's still a screen presentation.


  • Fix the modality problem by cloning the document (and any subdocuments) and using the clone for printing/print preview.
    • Replace plugins with an image snapshot of the current plugin state
    • This is basically done.
  • Reimplement "print selection" and "print subset of frames" by modifying the clone before we print/print preview.
  • Do away with the print preview presentation. Instead, implement print preview by building the print presentation and then rendering snapshots of it to the screen.
    • Make the print preview window a XUL chrome document containing a list of XUL <page> elements. These elements are leaf elements that simply render pages from some stored print presentation.
    • There will be some API to determine (or possibly set) the properties of each page and how many pages are used by the print presentation; the chrome UI is responsible for creating/destroying page elements as needed.
    • Chrome UI is responsible for rendering page shadows and all other window decorations.
  • Provide a way to reflow (or recreate frames for) the print presentation in response to changes in scale factor, margins, etc.


  • Eliminates the "print preview" presentation, simplifying layout
  • Provides great flexibility to UI implementors
  • Enables new features
  • Guaranteed consistency between print preview and printing