I’m looking for a Print preview feature is like in IE File->Print Preview and i want to put it in a button. that means i want to create button, when i select on it, it will show the print preview windows like what current IE does.
I’m currently using IE 7.
thanks in advance.
i’m really wonder how the File-Print Preview work??
how can i call it from PHP or javascript…
More than you can’t… you shouldn’t. The average computer user easily gets confused… if you add such functions like print into your website, people will look for it on EVERY website and then when they can’t see it they’ll think their browser is broken. You should ALWAYS reinforce conventions like encouraging people to use the menus provided. Why anyone would want to add unnecessary “features” into the website is beyond me, it defies every form of logic.
You seem to still be a bit confused. The “print preview” is a browser feature. Javascript works within the web page that is in the window in the browser.
You are wanting to find a way for javascript to bridge from the page to the browser. For security reasons modern browsers do not allow this.
TBH, I don’t understand why you want to do this. As felgall has said, users can do this themselves without any extra effort on your part simply by using their browser controls.
That said, you could use javascript to change the appearance of the page to look like what you hope might possibly be somewhat similar to the actual print view (using different CSS rules?). But doing so would be iffy at best.
So to answer your questions
i’m really wonder how the File-Print Preview work??
That depends on the browser, I imagine they all do it differently.
how can i call it from PHP or javascript…
You can’t.
That option is only available from the browser menu - of course all browsers do have that menu option.
The only option available from JavaScript is to print directly to the default printer.
is it don’t have any function to call and show the print preview? as i plan to create a button to show printpreview of the page.
The only print preview option in the browser is built into the File menu next to the only print option that allows you to select a printer.
The ONLY print option available within a web page itself is the JavaScript window.print() command which prints the web page to the default printer. There is no other print options available from within the web page because the web page has no way of telling what printer(s) the system has available to it.