Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
  1. #1
    Senior Member
    Join Date
    Aug 2003
    Posts
    194
    Member #
    2782
    A company will have coupons (images) on their website, and I need to script up a command to print an image only. Can anyone help me out on this?

    Thanks in advance.

  2.  

  3. #2
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Are these images on a page of their own (such as a popup)?

    If so, you could just invoke the window.print() statement on the popup page via a link/button click.

  4. #3
    Senior Member
    Join Date
    Aug 2003
    Posts
    194
    Member #
    2782
    Nope - they are on one single page. I would like for the web surfer to click the coupon which would pop-up the print window. Is this not possible without having to create the image as a pop-up first?

  5. #4
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    By "popup the print window" do you mean the Print Dialog which pops up when a user clicks File - Print (in most applications) or do you mean your own popup?

    If it is the latter what you could do is when they click the coupon and the popup is displayed, you could have the chosen image in the HTML but use CSS which is just for the browser (media="screen") to hide the image (display: none and also have CSS which is just for printing (media="print") to display the image (display: block

    That way when they print the popup, they should see the chosen image/coupon.

  6. #5
    Senior Member
    Join Date
    Aug 2003
    Posts
    194
    Member #
    2782
    Well, I found this code online and when I tried it out, it just keeps printing the entire page:

    Code:
    <HTML>
    <Head>
    <Style type='text/css' media='print'>
    
    #above {display : none}
    #below {display : none}
    
    </Style>
    </Head>
    <Body>
    <Span id='above'>
    This is the page content above the image
    </Span>
    <br>
    <img src='1.jpg'>
    <br>
    <Span id='below'>
    This the page content below the image
    </Span>
    <br>
    <br>
    <input type='button' value='Print' onclick="window.print()">
    </Body>
    </HTML>
    any suggestions?

  7. #6
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Try visible: hidden; for both spans.

  8. #7
    Senior Member
    Join Date
    Aug 2003
    Posts
    194
    Member #
    2782
    I added

    Code:
    style='visibility:hidden'
    to the <span> tag, but it still didn't work. Did I misunderstand where you said to put it?

  9. #8
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    No, thats where I meant to put it. Well, I meant replace the display line with the visible line. I do not have a printer nearby to test this, sorry.

  10. #9
    Senior Member
    Join Date
    Aug 2003
    Posts
    194
    Member #
    2782
    Hm. I just doesn't seem to work for me. So I am trying to a different code:

    In header:
    Code:
    <script language="Javascript">
       function PopupPic(sPicURL) {
         window.open( "popup.htm?"+sPicURL, "",  
         "resizable=1,HEIGHT=200,WIDTH=300");
       }
       </script>
    Link for image:
    Code:
    <a href="javascript:PopupPic('images/coupon.jpg')"><img src="images/coupon.jpg" alt="coupon" width="300" height="200" border="0" /></a>
    I believe I need to add the
    Code:
    onload="window.print()"
    command, but I am not sure where.... can you help me out on this one, by chance?

  11. #10
    Senior Member
    Join Date
    Aug 2003
    Posts
    194
    Member #
    2782
    Nevermind. I got it to work.


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search tags for this page

click image to print image html

,

click to print image html

,
html print a specific image on a page
,

html print command from an image

,

javascript print image

,

javascript print image file

,

javascript print image from url

,

javascript send image to printer

,
print command to print a image in javascript
,
print picture with javascript
Click on a term to search for related topics.
All times are GMT -6. The time now is 05:10 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com