WebAPI/WebPrintAPI: Difference between revisions

Add a note to indicate the content is outdated and no plans exist to implement the proposed API.
(Add a note to indicate the content is outdated and no plans exist to implement the proposed API.)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Outdated}}
= First iteration: WebPrintAPI =
= First iteration: WebPrintAPI =


Line 14: Line 16:
* There is only one page size per PrintDocument.
* There is only one page size per PrintDocument.
* The size of the page is defined within the PrintDocument constructor. If the defined page size doesn't fit the printer's page size, the content get's aligned as specified by the 'scale' property (see below).
* The size of the page is defined within the PrintDocument constructor. If the defined page size doesn't fit the printer's page size, the content get's aligned as specified by the 'scale' property (see below).
* The rendering context used for printing (PrintRenderingContext) is very similar to the CanvasRenderingContext2D.


=== Open Questions ===
=== Open Questions ===
Line 22: Line 25:
* Should there be additional onBeforePrint/onAfterPrint callbacks on the PrintDocument object, or are the window.onBeforePrint/onAfterPrint events enough?
* Should there be additional onBeforePrint/onAfterPrint callbacks on the PrintDocument object, or are the window.onBeforePrint/onAfterPrint events enough?
* This proposal assumes the print page size is passed during the PrintDocument constructor. A different way is to get the page size from the current selected printer's page size. Defining the page size once makes things easier but makes this API on the other side less powerful.
* This proposal assumes the print page size is passed during the PrintDocument constructor. A different way is to get the page size from the current selected printer's page size. Defining the page size once makes things easier but makes this API on the other side less powerful.
* Should there be points2cm, points2inch, inches2points utility functions?
* Lot more... TBD
* Lot more... TBD


Line 170: Line 174:
     // Stuff added compared to CanvasRenderingContext2d.
     // Stuff added compared to CanvasRenderingContext2d.
     // ---
     // ---
 
   
     // back-reference to the printDocument.
     // back-reference to the printDocument.
     readonly attribute PrintDocument printDocument;
     readonly attribute PrintDocument printDocument;
 
   
    // rendering context for preview?
    readonly attribute boolean isPreview;
   
    // dpi resolution. 0.0 = not defined.
    readonly attribute double dpi;
   
     // tell the backend that this page has finished rendering.
     // tell the backend that this page has finished rendering.
     void endPage();
     void endPage();
 
     
     // ---
     // ---
     // From here everything stays the same compared to CanvasRenderingContext2d.
     // From here everything stays the same compared to CanvasRenderingContext2d.
     // ---
     // ---
 
     
     // state
     // state
     void save(); // push state on state stack
     void save(); // push state on state stack
Line 303: Line 313:


Some basic investigation in the Gecko codebase. No code written so far.
Some basic investigation in the Gecko codebase. No code written so far.
[[Category:Web APIs]]
49

edits