如何在JavaScript或通过休息服务拍摄电脑屏幕的屏幕截图? [英] How to take screen shot of computer screen in javascript or through rest service?

查看:130
本文介绍了如何在JavaScript或通过休息服务拍摄电脑屏幕的屏幕截图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想拍摄屏幕截图(当前显示在计算机屏幕上的内容,即打印屏幕按钮功能)。如果可以通过 JavaScript 实现,那么它会很棒。但如果可以通过休息服务来实现,那么也没关系。

非常感谢帮助。谢谢&问候。



我尝试过的事情:



我试过了javascript(html2canvas,feedback.js,一些纯粹的javascript窗口函数)但它只占用当前浏览器的屏幕截图。



我已经实现了一些C#代码可以拍摄屏幕截图但它无法实现为服务,因为它使用的是System.Windows.Form命名空间的Screen类。



我找不到一种实现我的目标的方法。请帮忙。有点紧急。

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.

推荐答案

您不能使用javascript来执行此操作,因为浏览器中运行的任何代码都无法访问浏览器之外的任何内容。



您无法通过服务执行此操作,因为Windows服务在与用户完全不同的桌面下运行。你会得到一个空白的截图。



你可以从正常的应用程序中做到这一点。如果您的javascript代码需要屏幕截图,此应用程序将截取屏幕截图并显示Web服务器。 javascript可以在Web浏览器外部执行的唯一操作是与Web服务器通信。没有任何迹象表明网络服务器不能在客户机上。
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.


这篇关于如何在JavaScript或通过休息服务拍摄电脑屏幕的屏幕截图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆