Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: DHTML
Expertise: Beginner
Jan 29, 1999

Controlling the Printed Page

Question:
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.

Answer:
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.
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap