Print Templates, Part I - Doc JavaScript | WebReference

Print Templates, Part I - Doc JavaScript

Print Templates, Part I

In this column we introduce the subject of print templates. Print templates first appeared in Internet Explorer 5.5, and were later improved in Internet Explorer 6. We'll first show you what the benefits of print templates are and why they are so important. Then, we'll guide you through the development of two identical print templates. One is statically created by assembling a fixed number of pages in which the source is rendered. The other variation is more sophisticated in that it supports any number of pages, because page containers are created on the fly, until the source document is exhausted.

Print templates rely heavily on DHTML behaviors, first introduced by Internet Explorer 5. We'll help you to refresh your knowledge on this subject. Print templates are based on four behaviors: DeviceRect, LayoutRect, HeaderFooter, and TemplatePrinter. In this column we'll touch upon two of these four: LayoutRect and DeviceRect. We'll discuss the other two in a future column. We'll also show you in this column how to use the onLayoutComplete event and the event property contentOverflow.

In this column you will learn:

You can also see the full code listing of the static print template, as well as the dynamic print template, or load them from the enclosed zipped file.

Next: How to create print templates with behaviors

Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: July 30, 2001
Revised: July 30, 2001