简体   繁体   English

如何将Div内容转换为图像?

[英]How to Convert a Div content to image?

I have a div and inside it exists one gridview and few other divs. 我有一个div,并且在其中存在一个gridview和其他几个div。 Now I want to convert its contents to an image and store it on the server. 现在,我想将其内容转换为图像并将其存储在服务器上。 I don't want to send it to client. 我不想发送给客户。 How can I do it? 我该怎么做?

页面内容将在浏览器中处理,浏览器在客户端,因此您现在不希望在服务器端看到它,在服务器端我们只有html和脚本...因此,ddrace给出的链接可能有用,或者您可以开发Windows应用程序并在其上放一个Web浏览器,然后在浏览器中加载页面并将浏览器的图像保存到服务器

You're going to have to use a piece of middleware to do this. 您将必须使用一块中间件来执行此操作。 I have used this one in the past: http://www.winnovative-software.com/Html-To-Pdf-Converter.aspx . 我过去曾经使用过此工具: http : //www.winnovative-software.com/Html-To-Pdf-Converter.aspx I know it says "to PDF", but one of it's features is that it can render the result to an image and save it in various image formats. 我知道它说“到PDF”,但是它的功能之一是可以将结果呈现为图像,并以各种图像格式保存。

In your web application, have the middleware components bring the web-page down that has your control etc on it, and save it as an image on the server. 在Web应用程序中,使中间件组件关闭具有控件等内容的网页,然后将其另存为服务器上的映像。

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

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