Printing support in Sciter.

Sciter is getting print and print preview support. At the moment architecture and core functionality is established. Here is a screenshot of one of test pages demonstrating print preview:

Print preview widget
Print preview widget

Print preview is implemented as a native behavior that by default is assigned to any <frame type="pager"> element. Print Preview by its nature is a frame containing other document, that is why <frame> is used. The <frame> element may contain page-template="page.htm" DOM attribute that contains URL of so called page template document.

Here is an example of such page template.

<html>
  <head>
    <title></title>
    <style>
          section#content-box  { size:*; }
          text#header { border-bottom: 1px solid gray; }
          text#footer { border-top: 1px solid gray; }
          
          :root[page-parity=odd] text#footer  { text-align:left; }
          :root[page-parity=even] text#footer { text-align:right; }
          :root[page-parity=odd] #content-box 
          { 
            margin-left:10pt;
            margin-right:20pt;
          }
          :root[page-parity=even] #content-box
          {
            margin-left:20pt;
            margin-right:10pt;
          }
        </style>
  </head>
<body>
  <text #header>Header....</text>
  <frame #content-box />
  <text #footer>Page <span #page-no /></text>
</body>
</html>

<frame #content-box /> here defines area where source document will be printed. Such page template may contain arbitrary markup and styles and is accessible/modifiable by script on the host page.
It is possible to style the template for even/odd pages, even for the page with particular number.

Print Preview Schema
Print Preview Schema