且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将ASP div保存为C#中的图像?

更新时间:2023-02-15 11:15:01

LMGTFY [ ^ ]


您需要使用的是某种HTML到PNG助手,将您的HTML内容转换为PNG格式(或任何其他图像格式)。您可以实现各种方法,例如将HTML内容写入画布,然后将该画布内容另存为图像......还有更多可用选项。



查看以下选项,(其他选项搜索, html to png converter

HTML2Canvas [ ^ ]

html to png - CloudConvert [ ^ ]



您不能指望浏览器根据HTML内容生成图像,这不是软件的功能之一。 :-)



对于C#,您需要使用库,我到目前为止使用的大多数库都是付费的,并且在免费版中不提供太多。
What you need to use is some sort of HTML to PNG helper, that converts your HTML content to PNG format (or any other image format). There are various methods that you can implement, such as writing the HTML content to a canvas and then saving that canvas content as an image... Much more options available.

Have a look at the following options, (for other options search for, "html to png converter")
HTML2Canvas[^]
html to png - CloudConvert[^]

You cannot expect the browser to generate the image based on the HTML content, that is just not one of the features of the software. :-)

As for C#, you would need to use libraries, and most of the libraries that I have used until now are all paid, and in the free edition don't offer much.


参考这些

html2canvas将DOM保存为图像 [ ^ ]

如何使用HTML2canvas将img保存到用户的本地计算机 [ ^ ]

将div保存为图像 [ ^ ]
refer these
html2canvas save DOM as image [^]
How to save img to user's local computer using HTML2canvas[^]
Save div as image [^]