View Single Post
Old Nov 22nd, 2007, 9:50 PM   #1
MiKuS
Programmer
 
Join Date: Jun 2007
Posts: 93
Rep Power: 2 MiKuS is on a distinguished road
Printing lightwindow content

for those who don't know what lightwindow is:
http://www.stickmanlabs.com/lightwindow/

Now, my aim is to load up an image, and have a print button somewhere on the lightwindow, so user can print out a single image.

My first thought was to have lightwindow load up an external html file with a link, which when clicked runs the following javascript:
javascript:window.print();

The problem with this is that it prints both the page in the background and the lightwindow.

Now I figured out how i can solve this:
consider index.html as the page running lightwindow
consider image1.html as the page linking the target image with a link, linking to itself.


on index.html, assign the class "lightwindow page-options" to the anchor and have the link pointing to image1.html as per:
<a href="coupon1.html" title="Image One" params="lightwindow_width=407,lightwindow_height=330" class="lightwindow page-options"><img src="image1.html"></a>

and then on image1.html consider the following code:

<body onload="javascript:window.print();">
<p><img src="image1.png"/></p>
<p><br><a href="image1.html" class="print">Print This Coupon</a></p>
</body>

The above solutions works, but i don't like the way it works - I feel there is an easier way I'm missing.

Does anybody know any other ways I could go about this?
MiKuS is offline   Reply With Quote