SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Zealot cwebmedia's Avatar
    Join Date
    Nov 2002
    Location
    Calgary, Alberta, Canada
    Posts
    180
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JavaScript to Print?

    I've got a client who has a investor presentations that I take from PowerPoint and optimize into jpegs then into a JavaScript slide show.

    What I'd like to do is have a button in there that states, 'Print Current Slide' that would allow them to do just that. Problem is, the JavaScript slideshow is in a popup window and I really don't want to have another when they want to print a slide. Also, the optimized jpegs are smaller and not very good print quality.

    Could I have my button dynamically select a full sized jpeg on the server and auto print that without actually showing it? So clicking on the 'Print Current Slide' button would tell the script what slide they want to print and to search it out in a directory and automatically send that to the printer?

    Keep smiling ...
    It makes people wonder what you're up to ...

  2. #2
    SitePoint Zealot rae's Avatar
    Join Date
    Apr 2003
    Location
    bedroom :P
    Posts
    157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    pf.... I'm not a javascript guru , but what if you open in a popup that is not visible in the monitor... that popup is out of the x,y coordinates of the visible area of the desktop. example
    x = -1000 px
    y = -1000 px
    And then you give that popup window a timeout, after the timeout it's automatically closing (and after printing).... However if you use that method... the window icon on the taskbar is visible but maybe it's ok.
    That's just at the first sight.
    d(o.O)b -- Notice: undefined variable: /me

  3. #3
    SitePoint Zealot cwebmedia's Avatar
    Join Date
    Nov 2002
    Location
    Calgary, Alberta, Canada
    Posts
    180
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well I'd rather not have a popup up at all but if that is necessary than I'll have it popup in plain view with the large image and a 'close window' button.

    I didn't realize that you could put a time limit on them so maybe what I will do is have it so that the command to print is sent, then maybe 20 seconds later, the window closes itself. This would be good as my main concern is having too many windows open at the same time, so, if I can set them to close themselves, that would be nice.

    Keep smiling ...
    It makes people wonder what you're up to ...

  4. #4
    SitePoint Zealot rae's Avatar
    Join Date
    Apr 2003
    Location
    bedroom :P
    Posts
    157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cwebmedia
    if I can set them to close themselves, that would be nice.
    Yes, they can close themselves.
    Any window that made from a "window.open" can close itself.
    You need to make that close function in JS, and write that in the <body onload=...>

    function self_close()
    {
    if (elapsed_time > 20 sec)
    {
    self.close(); .............. or something like that
    }
    }

    And don't forget to buy a lot of paper while you test this print thing!
    d(o.O)b -- Notice: undefined variable: /me

  5. #5
    SitePoint Member SteelValor's Avatar
    Join Date
    Oct 2003
    Location
    New York
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cwebmedia
    I've got a client who has a investor presentations that I take from PowerPoint and optimize into jpegs then into a JavaScript slide show.

    What I'd like to do is have a button in there that states, 'Print Current Slide' that would allow them to do just that. Problem is, the JavaScript slideshow is in a popup window and I really don't want to have another when they want to print a slide. Also, the optimized jpegs are smaller and not very good print quality.

    Could I have my button dynamically select a full sized jpeg on the server and auto print that without actually showing it? So clicking on the 'Print Current Slide' button would tell the script what slide they want to print and to search it out in a directory and automatically send that to the printer?
    Don't know if this will work, but I found it in my Snippets

    <!-- Print -->
    <script>
    function printPage()
    {window.print();
    window.close();}
    </script>

    <form>
    <input type="button" value="Print" onClick="printPage();">
    </form> or <a href="javascript:window.print()">Print this Window</a>


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
  •