October 1, 2001 - Hiding Pages in A Print Template | WebReference

October 1, 2001 - Hiding Pages in A Print Template

Yehuda Shiran October 1, 2001
Hiding Pages in A Print Template
Tips: October 2001

Yehuda Shiran, Ph.D.
Doc JavaScript

When you let your users change the page setup and print settings after the document has been edited for printing, you may end up with unneeded pages. Your original layout required 5 pages, for example, but now the user changes the paper size to a larger one, and the document requires only 4 pages. What do you do with the extra page? Never destroy it. You should not destroy LAYOUTRECTS once they have been created. Hide them instead. A good way to hide LAYOUTRECTS is to move them off the screen by using absolute positioning. You can define, for example, the style class for the DEVICERECT elements to include the left property of -50in. This property is ignored when the position property is unset or set to "static." In this case the pages always start at (0,0). When it is set to "absolute" on a DEVICERECT element, the page for that DEVICERECT element will shift to -50 inches, which is outside the screen area.

To learn more about print templates, read Column 89 (Print Templates, Part I), Column 91 (Print Templates, Part II: TemplatePrinter), Column 92 (Print Templates, Part III: HeaderFooter), and Column 93 (Print Templates, Part IV: User Settings). Download the Microsoft print template loader.