Click here to Skip to main content
15,881,852 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
I want to take the screen shot (what is currently shown in the computer screen i.e. the Print Screen button functionality). If it can be achieved through JavaScript then it will be great. But if can be achieved through Rest Service then also it is okay.
Help is much appreciated. Thanks & Regards.

What I have tried:

I have tried through javascript (html2canvas, feedback.js, some pure javascript window function) but it only take the screen shot of the current browser.

I have implemented some C# code that can take the screen shot but it can't get implemented as a service because it is using the Screen class of System.Windows.Form namespace.

I can't find a way around to achieve my goal. Please help. A bit urgent.
Posted
Updated 10-Apr-16 14:22pm
Comments
PIEBALDconsult 10-Apr-16 22:06pm    
The Web App doesn't even know what Operating System it is running on -- it might not even be a windowing OS.
And your question smells of snoopware, so you're unlikely to get help here.
Member 10048252 11-Apr-16 4:57am    
Sorry for the snoopware feeling. But it was the client's demand. I'll try to convince them to only take the browser screenshot. Thanks.

1 solution

You can not use javascript to do this because any code running in the browser does not have access to anything outside the browser.

You can not do it from a service because Windows Services run under an entirely different desktop from the users. You'll get a blank screenshot.

You can however do it from a normal application. This application would take the screenshots and also expose a web server if your javascript code needs the screenshots. The only thing javascript can do external to the web browser is talk to web servers. There's nothing that says the webserver can't be on the client machine.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 10-Apr-16 20:36pm    
5ed.
—SA
Member 10048252 11-Apr-16 4:54am    
Thank you Dave for the explanation. I also thought that through javascript or service it can't be achieved. I will try to convince the client to take only the browser screenshot.
Sergey Alexandrovich Kryukov 11-Apr-16 10:12am    
You are welcome.

I'm just curious: why a screen shot? Is it a whole screen, not the browser page? What's the purpose? It sounds such a low-tech request...

—SA
Member 10048252 12-Apr-16 5:03am    
Actually in the application there is a 'User Settings' page. There if some error occurs then there must be a provision for taking that screenshot for future reference. Now the client's weird demand was the whole computer screenshot. But after explaining the facts over and over they finally understood it and now they only want the browser screenshot. :-)
Sergey Alexandrovich Kryukov 12-Apr-16 8:48am    
It sounds like behavior of people calculating tax return on paper before entering figures into a computer in order to print a form. :-)

You could always present much more comprehensive exception information in text, without any screenshots.

—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900