Controlling the Printed Page

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.

See also  What Are International Payments, And How Do They Work?

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist