Click to See Complete Forum and Search --> : Print Image button


mattpont
02-10-2003, 11:29 AM
Hi,

I have a list of thumbnail images. Next to this list is a button. I would like this button to enable the user to print a enlarged version of this image. The enlarged images are stored in another folder to this page.

Is there any way that I can get the browser to print an image when the user clicks on this button.

Your help would be greatly appreciated.

Thanks!

Nevermore
02-10-2003, 01:27 PM
It is possible to print the image without opening a new window, but more complicated. If you have plenty of time (like a week +) PM me and ill do it for you. Otherwise, this script opens it in a new window, prints it, then closes the window.

function openWindow(imagePath)
{
newWindow = window.open(imagePath,"","width=100px,height=100px");
newWindow.focus();
newWindow.print();
newWindow.close();
}
</script>

then in the anchor tag for the button, put the code:

onClick="openWindow('image_Name')"

where image_Name is the path to the image.

You can either change the height/width to match, or you can just leave them - it should always print the whole image.

mattpont
02-11-2003, 04:32 AM
Thanks cijori, that worked just fine.