[英]Is there a way to render an image saved with an activex control in the browser, without sending it to the server?
I have an html page that allows users to click on a link to take a snapshot of any active window . 我有一个html页面,允许用户单击链接以获取任何活动窗口的快照 。 When the user clicks on that button, control is passed to
C# code of an ActiveX
plugin (present in a CAB file), which takes the screenshot, and saves it at some temporary location. 当用户单击该按钮时,控件将传递给
C# code of an ActiveX
插件的C# code of an ActiveX
(存在于CAB文件中),该代码将截取屏幕截图并将其保存在某个临时位置。 My problems are : 我的问题是:
I wish to show the user that snapshot in a dialog box , and ask him to choose a name before sending it to the server. 我希望在对话框中向用户显示该快照 ,并要求他选择一个名称,然后再将其发送到服务器。 The snapshot is saved in a temporary location, and that location is obviously not accessible to the javascript code, and hence I can't construct the dialog box in HTML.
快照保存在一个临时位置,并且该位置显然无法通过javascript代码访问,因此无法使用HTML构造对话框。 Is there any way around it ?
有什么办法解决吗?
I have to upload the image to the server. 我必须将图像上传到服务器。 Most examples I found, use the
<html type="file"/>
technique to upload a file, but that's not an option here, as we have to programmatically upload it. 我发现的大多数示例都使用
<html type="file"/>
技术上传文件,但这不是一个选择,因为我们必须以编程方式上传它。 WebClient.uploadFile()
would do this for me, but on the server side, do I treat it as if the file has been uploaded through the <html type="file"/
> technique, or something special (the receiving end might be in Java) ? WebClient.uploadFile()
会为我执行此操作,但是在服务器端,我是否将其视为已通过<html type="file"/
>技术或某些特殊方式(例如接收端是在Java中)?
If you are able to modify the activex component, you can make it expose the bitmap as a binary and use javascript to get the bytes and render them as a bitmap. 如果您能够修改activex组件,则可以使它以二进制形式公开位图,并使用javascript获取字节并将其呈现为位图。 Like this:
像这样:
if (window.ActiveXObject) {
try {
var excelApp = new ActiveXObject ("Excel.Application");
excelApp.Visible = true;
}
catch (e) {
alert (e.message);
}
}
else {
alert ("Your browser does not support this example.");
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.