Print Templates, Part V: Re-pagination

Posted by Andy | External References

In this column we continue our series on print templates. Print templates first appeared in Internet Explorer 5.5, and were later improved in Internet Explorer 6. In column 89, Print Templates, Part I, we showed you how to assemble a print template with two out of the four elements of print templates: LayoutRect and DeviceRect. In Column 91 (Print Templates, Part II: TemplatePrinter) we added the TemplatePrinter element. In Column 92 (Print Templates, Part III: HeaderFooter), we cover the fourth and last element of print templates, HeaderFooter. In Column 93, (Print Templates, Part IV: User Settings) we taught you how to reflect the user settings in the document layout. In this column, we’ll explain how to re-paginate a document following a change in its zoom factor. In previous columns, we always dealt with a single static pagination, after which we ended up with a single document format. When the user can change the zoom factor, the number of pages may go up or down, and what to do with the excess pages, if there are any, is not that trivial. We’ll show you how to hide unused pages from previous pagination. We’ll also show you how to set the different event handlers to support such a capability. This column also combines several capabilities we have presented before, such as dynamic page assembling, printing with and without preview, adding headers and footers, updating the total number of pages in all pages, page formatting according to user settings, etc.

Read more

Print Templates, Part IV: User’s Settings

Posted by Andy | External References

In this column we continue our series on print templates. Print templates first appeared in Internet Explorer 5.5, and were later improved in Internet Explorer 6. In column 89, Print Templates, Part I, we showed you how to assemble a print template with two out of the four elements of print templates: LayoutRect and DeviceRect. In Column 91 (Print Templates, Part II: TemplatePrinter) we added the TemplatePrinter element. In Column 92 (Print Templates, Part III: HeaderFooter), we cover the fourth and last element of print templates, HeaderFooter. In this column we draw your attention to the way you can use the Page Setup and Print Dialog settings to format the document for printing. In previous columns of this series we used default style definitions to format the document (e.g. page width, top margin, right margin, and background color.) In this column we’ll show you how to overwrite the default definitions with the user’s settings. The user can set his preferences in either the Page Setup dialog box, or the Print Dialog box. This column also combines several capabilities we have presented before, such as dynamic page assembling, printing with and without preview, adding headers and footers, updating the total number of pages in all pages, etc.

Read more

Print Templates, Part II: TemplatePrinter

Posted by Andy | External References

Having created a print template for previewing your Web pages, you’re now probably wondering how to actually print them. Our own Doc JavaScript once again comes to the rescue by introducing you to the TemplatePrinter element.

Read more

Print Templates, Part I

Posted by Andy | External References

In this tutorial 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 tutorial we’ll touch upon two of these four: LayoutRect and DeviceRect. We’ll discuss the other two in a future tutorial. We’ll also show you how to use the onLayoutComplete event and the event property contentOverflow.

Read more