Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing from DHTML or IE6

Status
Not open for further replies.

shetlandbob

Programmer
Mar 9, 2004
528
GB
Hi,

I have a web page which I create in a inhouse program (i.e. i generate all the html), it is designed and can be viewed either through the inhouse program which uses DHTML or good ol internet explorer.

I want the page to stay the same when loaded up in DHTML or IE, but when printing it will squash (or decrease the font size) to fit in the width of a A4 sheet (portrait or landscape), and go down onto more sheets if necessary.

Anyone have anyideas how I can do this??? I have looked at using pagebreakbefore or similar but that doesn't really fit? (I have tables that are wider than A4 page)

Thanks in advance
 
Summary:

In general what I am looking for is similar to the "scale to fit paper" option that is in powerpoint for one, think it is often used in printing pictures as well.
 
First, DHTML is a mark-up language and can be used by most browsers, so take that out of the equation and you're left with a couple of solutions. You can create another "printer friendly" page that is formatted the way you want. Or, you could place all the printable data in a block level element like a div or a table and use a CSS style sheet to control the layout.

There's always a better way. The fun is trying to find it!
 
Yeh I am hoping to avoid having to create a "printer friendly" version of my pages.

can anyone point me in the direction for creating a CSS style sheet that would place my html code inside a single table?? I've never used CSS before and time is limited.

Cheers
 
CSS can't force user agents (i.e. browsers) to fit page contents into a single paper sheet. It's user agents area of interests...
Some quotations from CSS2:
Although CSS2 does not specify how user agents transfer page boxes to sheets, it does include certain mechanisms for telling user agents about the target sheet size and orientation.
...
The CSS2 page model specifies how a document is formatted within a rectangular area -- the page box -- that has a finite width and height. The page box does not necessarily correspond to the real sheet where the document will ultimately be rendered (paper, transparency, screen, etc.). The CSS page model specifies formatting in the page box, but it is the user agent's responsibility to transfer the page box to the sheet.

Keep away from blind alley...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top