Results 1 to 4 of 4

Thread: Javascript to Trigger Print/Save Images

  1. #1
    Join Date
    Dec 2006
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Javascript to Trigger Print/Save Images

    Is it possible to request a print or save operation for an image on the page via Javascript, just as if the user has right-clicked on the image and selected the "Print Image" or "Save Image As" opitons? I want the printer and save-as dialogs to come up.

    The only approach for printing an image I have seen is to have javascript open a new browser window containing just the image and triggering a window.print() followed by a window.close() - but this sounds a bit clunky to me.

    What I was hoping was that the image object actually had print() and save() methods that could be used from Javascript, but I haven't read anything that supports that hope.

    Thanks for any ideas.

  2. #2
    Join Date
    Dec 2006
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Is no-one going to offer any thoughts on this? I would have expected someone at least to tell me "NO - NOT POSSIBLE" - which is what I am currently thinking.

    If what I am looking for is possible, I would really appreciate a push in the right direction.

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Would; "I doubt that it is possible", help? I always hesitate to say no, a thing isn't possible, because one can never be 100% sure of something like that in a case like this. I can say there is no common, widely used, javascript method for that.

    For printing you could probably have a button or link that activates an alternate stylesheet that sets the print display property of everything else on the page to 'none' and then prints the page (which in this case would then be just the image). But, how to get the print display back to normal after that without having it possibly interfere with the printing process if that took some time for the user to follow through on . . .

    For saving, you could perhaps have a link to the image that has its mime type or something like that set a certain way that would cause most browsers to put up the save/open prompt.

    In the end, it would be much easier to just have a pop-up division with or just have instructions as, most folks have this functionality already built into the browser. All you really need to do is instruct those who do not, as yet, know how to use it.
    Last edited by jscheuer1; 12-15-2006 at 08:37 PM. Reason: spelling
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Dec 2006
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for the feedback. I am thinking you are right, and that in the end the way to go is just providing on-screen instructions for printing/saving images for those who don't know how.

    Some of our users are very web-challenged, and we get a lot of help-desk calls about really 'basic' stuff. We thinking obvious buttons for printing/saving the image would make it easier for them, but instructions will have to be enough.

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
  •