September 13, 2001 - Setting A DEVICERECT Element | WebReference

September 13, 2001 - Setting A DEVICERECT Element

Yehuda Shiran September 13, 2001
Setting A DEVICERECT Element
Tips: September 2001

Yehuda Shiran, Ph.D.
Doc JavaScript

A DEVICERECT element represents a page to be printed or previewed. It usually contains a LAYOUTRECT element for each page, but it also can include elements such as DIV, P, UL, and IMG. These elements can be used to prepare what's called a "boilerplate": a common signature for all pages such as a copyright notice or a logo. All content to be printed or previewed must be included in a DEVICERECT element. A DEVICERECT element must include a style that defines the template's width, height, border, background, and margin. You can get the page width and height through TEMPLATEPRINTER's pageWidth and pageHeight. The only property that can be assigned in script for DEVICERECT is MEDIA (all upper case). When set to "print", pages render at the highest possible resolution. The DEVICERECT element supports the attributes MEDIA (for resolution), ID, and CLASS (for style).

To learn more about print templates, read Column 89 (Print Templates, Part I) and Column 91 (Print Templates, Part II: TemplatePrinter.) Download the Microsoft print template loader.