PDA

View Full Version : :: getting a window to open then print it ::


babelfish
10-21-2002, 12:10 PM
ok i need to have a script that opens up a page then prints the contents of that page

function displayWindow(theURL,winName,width,height,features) {
var window_width = width;
var window_height = height;
var newfeatures= features;
var window_top = (screen.height-window_height)/2;
var window_left = (screen.width-window_width)/2;
newWindow=window.open(theURL, winName ,'width=' + window_width + ',height=' + window_height + ',top=' + window_top + ',left=' + window_left + ',' + newfeatures);
newWindow.focus();
newWindow.print();
}

i have this but i get access denied when it tries to print it - is there some wierd way it does this? this is for IE only

thanks

ACJavascript
10-21-2002, 04:19 PM
I know of that problem hehe :D

For some reason every time I've tried to do somthing of that sort I have gottin the same error.. From what I've read and experimented with it seems that such a cammand cannot be given from the opener..

Try this
on the page that your opening and trying to print put a function that specifies the printing method.. window.print();

and onload that function..

Now when the window opens it calls the print function and prints the page skiping the error on the opener.. :D


Hope this helps :D:D

babelfish
10-21-2002, 04:31 PM
yeah - that kind of defeats the object tho :( and the fact im opening a pdf page too :( nevermind tho m8 thanks for taking the time to answer :thumbsup: