Controlling the Printed Page

Is it possible to control the printed page size and layout in DHTML? In other words, can I control how a DHTML page looks when it is printed and control elements such as page breaks and object placement on a printed page? I have an Automated Letter Generation system that creates large mailings using Microsoft Word’s mail merge facility and I am looking into using DHTML to replace Microsoft Word.

Printing is becoming a major issue with browsers, but unfortunately neither of the major browsers supports printing effectively in version 4.0. However, both Microsoft and Netscape have incorporated considerably more sophisticated printing support in the 5.0 versions of their browsers. For example, IE5 will have a window.print() method that will invoke the print functions, and two new Cascading Style Sheets (CSS) properties: page-break-before and page-break-after that can take values of “auto” (the default), “always” (page always gets broken at indicated point), and “never” (page never gets broken at indicated point).

You can also, at least with IE4+, specify DIVs and other containers in inches rather than pixels. For example, if you set up a DIV as follows:

Lorem Ipsum nunc ....

then the DIV will print at those dimensions upon output.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: