简体   繁体   English

浏览器上的Web控件需要的打印屏幕功能

[英]Printscreen function desired from web control on browser

All, 所有,

I have a requirement to enable users of our web page to download jpeg images of the Bing maps that we have put on our forest fire simulation dot net aspx web page. 我需要使我们网页的用户能够下载我们已在森林火灾模拟点网aspx网页上放置的Bing地图的jpeg图像。 The page in question presently displays a Bing map and up to 96 shapes in as many layers which can take up to 20 seconds to load completely. 目前,该页面显示Bing地图和多达96个形状的图层,最多可能需要20秒才能完全加载。 I could put all these shapes on one layer if it would help - but I an not sure that it would and I thought I would ask here first. 如果有帮助,我可以将所有这些形状放在一个图层上-但我不确定是否可以,我想我会先在这里提出。

Apparently, any "complicated" client side actions (like ALT-print screen, print from the web page, mwsnap3, or other third party solutions) will not suffice, so I am told to implement a button on the page that will download (or make available) a jpeg image document/image when it is pressed on the page. 显然,任何“复杂的”客户端操作(例如ALT打印屏幕,从网页上打印,mwsnap3或其他第三方解决方案)都不够用,所以我被告知在页面上实现一个将要下载的按钮(或在页面上按时提供jpeg图像文档/图像。

I started with a great thread at Convert webpage to image from ASP.NET . 我从将网页转换为ASP.NET的图像时介绍了一个不错的话题 ,which is really close to what I want, but the page gets rendered on the browser.ReadyState != WebBrowserReadyState.Complete transition, which fires off before my shapes are loaded on the Bing canvas. ,它确实接近我想要的东西,但是页面在浏览器上呈现。ReadyState!= WebBrowserReadyState.Complete过渡,在将形状加载到Bing画布上之前会触发。 I tried to render the page on the DocumentTitleChanged event (and then tried to change the title when my shaped completed loading), but this did not work either. 我尝试在DocumentTitleChanged事件上呈现页面(然后在完成成形加载后尝试更改标题),但是这也不起作用。

I tried to force the "Print screen" character with javascript (see Is it possible to simulate key press events programmatically? ), but this translated into a comma (decimal 44) and did not work as expected. 我试图用javascript强制使用“打印屏幕”字符(请参见是否可以通过编程方式模拟按键事件? ),但是此结果转换为逗号(十进制44),并且无法正常工作。

I also see that HTLM5 has some support for this ( http://www.nihilogic.dk/labs/canvas2image ) but while this worked in FireFox, it did not work in IE, which is the browser of choice. 我还看到HTLM5对此提供了一些支持( http://www.nihilogic.dk/labs/canvas2image ),但是虽然它在FireFox中有效,但在IE(它是首选的浏览器)中却不起作用。 I also want to run this on mobile devices, which might not support HTML5 for some time either. 我也想在移动设备上运行它,该设备有时可能也不支持HTML5。

I have a few questions: 我有几个问题:

1 - Is there another (simple) way to print the contents of the web page that I am missing? 1-是否有另一种(简单的)方式来打印我所缺少的网页内容?

2 - Is there some other WebBrowser event that I can fire that will make more sense)? 2-是否有其他我可以触发的WebBrowser事件会更有意义)?

3 - Would it help if I stated with some other control then put the maps and shapes on this control for subsequent printing? 3-如果我使用其他控件进行说明,然后将地图和图形放在此控件上以进行后续打印,是否有帮助?

4 - Does this go against the grain of web browsing and is just a bad idea (seems that if I can force a 'print screen' then evil web sites could force a Ctrl-Alt-Delete button sequence)? 4-这是否违背了网页浏览的原则,并且不是一个好主意(似乎如果我可以强制执行“打印屏幕”,那么邪恶的网站可以强制执行Ctrl-Alt-Delete按钮序列)?

Thanks - Steve 谢谢-史蒂夫

It might not be an approach you want to do as it will require you to repeat alot of the functionality you already have in a different way but the only truely full proof way to do this is to get the map as an image from the bing maps static imagery service and use GDI+ to draw onto the map yourself then just serve that image direct to the user. 这可能不是您想要的方法,因为它将需要您以其他方式重复许多已有功能,但是唯一真正完整的证明方法是从bing映射中获取该图像作为图像。静态图像服务,并使用GDI +自己绘制到地图上,然后直接将该图像提供给用户。 Gets round any browser issues but a fair amount of work depending on your requirements: 解决所有浏览器问题,但要根据您的要求进行大量工作:

http://rbrundritt.wordpress.com/2009/02/22/drawing-routes-with-the-ve-web-service/ http://rbrundritt.wordpress.com/2009/02/22/drawing-routes-with-the-ve-web-service/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM