spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column95


Print Templates, Part VI: Interactive Margin Settings

Developer News
OpenOffice 3.2 Lands Amid Critical Changes
Red Hat, IBM Firmly in KVM Virtualization Camp
Red Hat Talks Up Open Source Cloud Plans

In this column we conclude 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 covered 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 Column 94 (Print Templates, Part V: Re-pagination), we explained how to re-paginate a document following a change in its zoom factor. In this column, we'll explain how to change the page margins interactively. This column is an extension of Column 94. There, we explained how to re-paginate a page due to a change in its zoom factor. Here, we introduce another way to trigger re-pagination: changing the page margins. When the user makes the page margin wider, there will be a need to lay out the document across more pages. The interactive nature of this column is achieved by four markers, each assigned to handle one of the four margin lines: top, bottom, right, and left. The user can change a margin simply by dragging the relevant marker along a horizontal or vertical line. We'll show you how to define the three event handlers for the mousedown, mousemove, and mouseup events. 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, re-pagination due to a change in the zoom factor, etc.

The only way to call TemplatePrinter and HeaderFooter is through C++ code. Luckily, someone in Microsoft wrote an application to which you can feed your own print templates and the documents you want to print. This application comes with sample print templates that our columns are based on. In this column we introduce a GUI to change the page margins in template8.html.

In this column you will learn:

You can see the full code listing of template8 on Page 8. Load it from the enclosed zipped file.

Next: How to write the print template

More Resources from Doc JavaScript
Columns Popular Columns Tips Tools
Latest Columns
41-50 | 31-40 | 21-30
11-20 | 1-10
Working with Windows
JavaScript and Frames
Bookmarklets
Random Tips
Personalized Tips
RSS Channels
Menu Builder
Rollover Builder
Rotation Builder
Reference Tip Categories (want one?)
Links
For Your Site
Did you learn something? Do you like this site? Please link to us!

http://www.internet.com


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

webref The latest from WebReference.com Browse >
Search Engine Optimization: Selecting and Embedding Keywords · Are Google's Language Translation Web Services Ready for Prime Time? · Installing and Using Meeplace, the Business Review CMS
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
IBM DB2 10 for z/OS: Justifying the Upgrade · Living La Vida Colo: Choosing the Right Colocation Facility · FTC Concerns over Social Media Privacy Linger


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

URL: http://www.webreference.com/js/column95/index.html