Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9

Thread: printing

  1. #1
    New Coder
    Join Date
    Aug 2003
    Posts
    82
    Thanks
    0
    Thanked 0 Times in 0 Posts

    printing

    Hello

    Need to print a document like a invoice. Does it take client side only?

    thanks

  • #2
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    You can generate the page with ASP and then have the user hit print. You can even go as far as using javascript to open the print dialog up but you can't go any farther than that, there is no way to automatically cause something to print; at least with a web browser. (good thing too)
    OracleGuy

  • #3
    New Coder
    Join Date
    Aug 2003
    Posts
    82
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So I can never have clients printing the invoices of this intranet?
    What about that javascript code. With that I could build a client invoice page and have that print dialog open for the client. What do you think? Can you show me that code?
    thanks

  • #4
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    Yeah so your ASP page builds the page and sends it to the client and then you can use the following code to bring up the print dialog box for them to print it.

    Code:
    <script type="text/javascript">
      window.onload = PrintPage;
      
      function PrintPage()
      {
        window.print();
      }
    </script>
    OracleGuy

  • #5
    New Coder
    Join Date
    Aug 2003
    Posts
    82
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I did something like that using FSO too, where .txt file is formatted automatically (using spaces for formatting instead of tables, etc.) and opened by the browser, and then the user can print to their heart's content.

    Then I delete it on Session_End using the global.asa file...

    ... it seems to work pretty well, allowing that you've made the user login using cookies or a session variable.

    Seems like the above solution worked ok for you too though, and mine was more of a successful intranet experiment than anything else!
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #7
    New Coder
    Join Date
    Aug 2003
    Posts
    82
    Thanks
    0
    Thanked 0 Times in 0 Posts
    didn't get you, whammy

  • #8
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ahh! Well as long as you have it working, great.

    I didn't implement any specific JavaScript/CSS- controlled printing on this stuff, just made sure it was downloaded locally as a text file. I could tell you how to do it, but really it depends on your needs and I'd need to know more of what you're trying to accomplish with your end result.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #9
    New Coder
    Join Date
    Oct 2003
    Location
    19° 26' N, 99° 7' W
    Posts
    53
    Thanks
    0
    Thanked 0 Times in 0 Posts
    last month I found myself trying to print an invoice as well...
    The results were not what we expected since it was hard to format the tables in order to make it look as the invoice they were using before coming from a print shop.
    We ended up using a pdf component to generate a pdf document and then print from there...
    It worked out great!


  •  

    Posting Permissions

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