简体   繁体   English

如何将 div 及其内容保存为服务器上的图像?

[英]How to save div and its content as an image on the server?

Actually I am developing a customizable mugs, t-shirts web application.实际上,我正在开发一个可定制的杯子、T 恤 Web 应用程序。 So when user make any changes in the design i want to capture the whole div and want to save it on the server as an image.因此,当用户对设计进行任何更改时,我想捕获整个 div 并将其作为图像保存在服务器上。 I googled it but I end up with nothing.我用谷歌搜索,但最终一无所获。 Everyone is saying use CANVAS.每个人都说使用 CANVAS。 But I am adding elements using jquery in the div.但我在 div 中使用 jquery 添加元素。 So i don't know how to change it to canvas.所以我不知道如何将其更改为画布。

My Mark Up我的标记

<div id="imgs" style="background-color:#222222; color:#fff; width:300px; height:200px">
 // Dynamic Images //Dynamic Content
</div>

I want to save this div as an Image.我想将此 div 保存为图像。

Here is my the link of my customizable printing website这是我的可定制打印网站的链接

Please help me.请帮我。 Thanks谢谢

There's no real EASY way to do this.没有真正简单的方法可以做到这一点。 However, if you're adventurous... * Create a Windows Forms application * Embed a browser in the application and have it browse to a URL that contains your div * Have the application take a screenshot of itself.但是,如果您喜欢冒险... * 创建一个 Windows 窗体应用程序 * 在应用程序中嵌入一个浏览器并让它浏览到包含您的 div 的 URL * 让应用程序对其自身进行截图。 * Save it to disk. * 将其保存到磁盘。

Then when the user makes changes, have your server open up the Win Forms application that you created in a separate process.然后,当用户进行更改时,让您的服务器打开您在单独进程中创建的 Win Forms 应用程序。

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

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