DMXzone Cyber Monday with 30% discount starts now! Use promo code: DMXCM15
Auto Window Print
January 11, 2002 by Marcellino Bommezijn


How can i initialize the print function in JavaScript for a printable page, so that the user doesn't need to click a print-button ?


Just put this little script in your page and it will initialize the print pop-up automatically.

if (window.self) window.print();

Marcellino Bommezijn

Marcellino BommezijnMarcellino Bommezijn is one of the managers at He is a contributor on the tutorials section.

Owner of Senzes Media ( which provides professional services and web applications for mid-sized companies.

ActiveContent CMS is the ASP.NET Content Management solution that is used for building professional and rich-featured websites.

See All Postings From Marcellino Bommezijn >>

Place your comment about Auto Window Print

You must me logged in to write a comment
RE: Ironic
August 15, 2007 by andre brandtzæg

Hi Chris.
I was looking for a script for printing a html page automatickly in landscape.
And My question for u is, do u know the script?
If so, could u please post it here.


Print after page is loaded
November 9, 2003 by Steve Davis

It seems there is no way to just dump something to the printer without going through the print dialogue box.

If you want to print the whole page, putting the script at the bottom is not the ideal way to do it as anything not loaded will not print.

Better is <body onLoad="self.print()">   I think we all know the use of onLoad...

RE: RE: Print In Landscape
April 28, 2003 by kim footohi
Does anyone know how to use the landscape orientation for the print() function?
RE: Print In Landscape
August 5, 2002 by Billie Bacay
See all 11 Comments