Closed Thread Icon

Topic awaiting preservation: Print Preview Pages that link to <a href="https://ozoneasylum.com/backlink?for=8928" title="Pages that link to Topic awaiting preservation: Print Preview" rel="nofollow" >Topic awaiting preservation: Print Preview\

 
Author Thread
Blaise
Nervous Wreck (II) Inmate

From:
Insane since: Jun 2003

posted posted 10-29-2003 05:34

Hi guys,

I was wondering if there was a cross-browser friendly method to build a javascript function that did print-preview. I basically am required to have a button on my page that prints it off, but ideally I want it to dispaly the print-preview page initially.

Not suprisingly I've found a way for IE to do this it only workd for IE5.5+ however...

code:
function printpreview()
{
var OLECMDID = 7;
/* OLECMDID values:
* 6 - print
* 7 - print preview
* 1 - open window
* 4 - Save As
*/
var PROMPT = 1; // 2 DONTPROMPTUSER
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
WebBrowser1.ExecWB(OLECMDID, PROMPT);
WebBrowser1.outerHTML = "";
}

If anyone knows about this please let me know, I need the info

Cheers,

Blaise

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

posted posted 10-29-2003 14:24

Blaise: Displaying the operating system's print preview is not a common fact. It's not a surprise that you found something to do so only on Windows with IE . Usually the websites provide a printer friendly version of their pages, or better they have a CSS for the print media, so the user don't have to worry about the result 'coz the webmaster worried for him/her in the first place. At worst, if the user absolutely want to see it, he/she can prompt a print preview via the File menu, like in any other aplication. Whatever, I'd be quite surprised if you found a cross-browser way to pop up a print preview process.

I have no printer ATM but if I'm not wrong, when you click on the print button, a control pannel appears to select the number of copies, the layout, the quality ... and even to see the print preview.

Best regards,

Mathieu "POÏ" HENRI

« BackwardsOnwards »

Show Forum Drop Down Menu