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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

window.print()

Status
Not open for further replies.

AP81

Programmer
Apr 11, 2003
740
AU
Is there a way to specify a paper size when you call the window.print() function?

The problem I am having is I am printing something designed for A3 size paper. The printer prints the document itself OK, but also prints the default writing on the top and bottom of the page:

e.g.
Website Name Date


document here


Page 1 of 1 Date/Time

As a result of this I end up printing ink onto the printer roller (the website name /Date, .etc.). I know I can turn off these in the printer settings, but it really isn't a feasible option.

Any ideas?




------------------------------------
There's no place like 127.0.0.1
------------------------------------
 
You can't control printer options with Javascript. That has to be done on the client computer. You can add page breaks where you want, but that's about as far as you can go with formatting pages.

Lee
 
Actually, using CSS print styles you can control many aspects of printing. I don't think paper size is one of them, though I could be wrong.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
I suspect that the "default writing" you are seeing is stuff that is added by the browser. I very much doubt if you can control this at all with CSS or JavaScript.

You'd have to go into the page setup for your browser to turn off things added by the browser.

Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
the only way you can control printer settings is by using ActiveX controls, and, as we've discussed several times before, this is not an ideal solution. ActiveX is not widely supported (only IE). As tsdragon stated, you could have some control over the way your webpage displays on paper when it's printed, but you can not control paper size.

*cLFlaVA
----------------------------
[tt]I already made like infinity of those at scout camp...[/tt]
beware of active imagination: [URL unfurl="true"]http://www.coryarthus.com/[/url]

[banghead]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top