spacer
Yehuda Shiran September 25, 2001
Converting Dimensions for Printing
Tips: September 2001

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

The behavior templatePrinter has all the properties to define the content area, the master page, the header, and the footer. These properties reflect the values you enter in the Page Setup dialog box and the Print Dialog box. All dimensions are stored in templatePrinter as inches. The style object, on the other hand, expects dimensions to be in 1/100th of an inch. Therefore, you need to divide the templatePrinter's settings by 100 before storing them in the style object. You also need to append the "in" dimension to every numeric value. Let's see a few examples. In these examples, assume there is a templatePrinter element with ID="printer", the master page's style object is oMasterStyleClass, and the content's style object is oContentStyleClass.

Let's start with the master page's width and height:

oMasterStyleClass.style.width = printer.pageWidth/100 + "in";
oMasterStyleClass.style.height = printer.pageHeight/100 + "in"; 
The margins of the content with respect to its container master page are set next:

oContentStyleClass.style.marginTop = printer.marginTop/100 + "in"; 
oContentStyleClass.style.marginLeft = printer.marginLeft/100 + "in";

People who read this tip also read these tips:

Look for similar tips by subject:

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
DiVitas's Mobile UC Now Available on the Latest Devices · Review: FON Fonera 2.0n · Chip Market Recovering From '08 Collapse