+ Reply to Thread
Results 1 to 6 of 6

Thread: print problem

  1. #1
    Barn Loyal todd2006 is an unknown quantity at this point todd2006's Avatar
    Join Date
    Mar 2008
    Posts
    889
    Rep Power
    4

    print problem

    Hi,


    I have this code on the page which displays a image.

    <a href="print.asp?id=<%=ID%>"><img src="/image/imglink.gif" border="0" /></a>

    When a person clicks on the image it opens up print.asp

    What i want to do is when a person clicks on the image i want to print the page print.asp

    i tried window.print but its not working

    can someone tell me what i am doing wrong

    todd

  2. #2
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    On print.asp, just call the window.print in the body onload event:

    Code:
    <body onload="javascript:window.print();">
    
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  3. #3
    Barn Loyal todd2006 is an unknown quantity at this point todd2006's Avatar
    Join Date
    Mar 2008
    Posts
    889
    Rep Power
    4

    I tried it buddy it works

    But my problem is I dont want to display print.asp to the user

    I just want it to be printed is there a way I can make it happen

    also when the page is printed

    It shows the URL at the bottom of the page

    Can i hide that url

    todd

  4. #4
    Wolfmaster Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy's Avatar
    Join Date
    Mar 2008
    Location
    Peoria, IL
    Posts
    2,386
    Blog Entries
    5
    Real Name
    Wolff
    Rep Power
    15

    Printing support in browser basically sux. The URL footer is controled by the Print Setup function of the user's Browser, so I know of no way to suppress this.

    I also don't know of a way to keep the page from displaying.
    Wolffy
    .-- ----- ..-. ..-. -.--
    Opinions expressed are my own and do not necessity reflect those of any sane person. Any code provided is intended to be an example and is provided AS IS. Void where prohibited by law. Not valid in California. Your mileage may vary.

  5. #5
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    I agree with Wolffy and giving a script that kind of control over a browser would be a security issue.
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  6. #6
    Administrator richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere only we know...
    Posts
    3,207
    Blog Entries
    14
    Real Name
    Rich
    Rep Power
    14

    I use this activex control. Means users have to install it onto their machine, but it allows you to control the margins, header, footer etc.

    Linky

    I also don't know of a way to print the page without displaying it. It's just printing whatever is displayed in the browser so if there's nothing there it won't print anything.

    You can open the page and call a JS function onload that prints the page, either using this activex or as shown above and then use window.close to immediately close the window.

    Hope that helps.

+ Reply to Thread

Similar Threads

  1. Print out data on a letterhead format
    By Shem in forum .NET Development
    Replies: 3
    Last Post: May 22nd, 2008, 10:15 AM

Bookmarks

Posting Permissions

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

SEO by vBSEO