Solved

JavaScript Print Screen

Posted on 2013-11-14
10
403 Views
Last Modified: 2013-12-06
I have a web page in ASP.NET which uses a 3rd party graphing tool to display some data. My client would like the ability to simply click a button on the page in order to Print Screen and capture the contents of the active window (or a portion of the web page that we might define e.g. the graph). I assume there will be a way of doing this with JavaScript but we would need to avoid any security warnings if possible.
0
Comment
Question by:guswebb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 33

Expert Comment

by:Big Monty
ID: 39648169
just use:

window.print()
0
 
LVL 33

Expert Comment

by:Big Monty
ID: 39648177
to put it in a link:

<A HREF="javascript:window.print()">Click to Print This Page</A>

or a button:

<INPUT TYPE="button" onClick="window.print()">
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 39648278
And if you only want to print specific parts of the page you can use a print stylesheet to hide the parts you don't want printed.

Cd&
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Author Comment

by:guswebb
ID: 39648316
I may not have been sufficiently clear. I want to screen grab i.e. create an image of what is on screen in the currently active window, and have this held in the clipboard so that the image can be pasted in to PowerPoint for example, not simply launch the printer properties window to send this to a physical printer.
0
 
LVL 33

Accepted Solution

by:
Big Monty earned 500 total points
ID: 39648372
nothing in your original post is there a mention of a screen shot, only Print Screen...

to do what you're asking now, you may want to look into html2canvas:

http://html2canvas.hertzen.com/
0
 
LVL 9

Author Comment

by:guswebb
ID: 39648846
I assumed you would be familiar with what Print Screen is (not the same as print screen) not least when in the context of 'capturing the screen contents' or 'a portion of the page e.g. a graph' - my bad, apologies!

That looks like some interesting code which might very well do what I'm looking for. I shall have a play around with this and let you know if it works for my requirement.
0
 
LVL 43

Expert Comment

by:Rob
ID: 39701082
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
0
 
LVL 33

Expert Comment

by:Big Monty
ID: 39701083
The link I sent does exactly what the OP asked, and I can confirm it works, as I've used it before.

I don't really care about the points, but rather it be PAQ'ed so that someone else may find it useful.
0
 
LVL 9

Author Comment

by:guswebb
ID: 39701470
The HTML2 canvas material was very useful, thanks.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question