开发者

Does TextRenderer.DrawText() can be used in WEB Application (C#.NET )?

开发者 https://www.devze.com 2023-02-15 14:15 出处:网络
Hello Everyone Can anyone tell me is it possible to use \"TextRenderer.DrawText()\" in WEB Application (C#.NET 开发者_StackOverflow社区) for text text rendering in GDI and saving the text as image.

Hello Everyone

Can anyone tell me is it possible to use "TextRenderer.DrawText()" in WEB Application (C#.NET 开发者_StackOverflow社区) for text text rendering in GDI and saving the text as image.

Please Help. thanks.


Yes. You can do this with the Generic Http Handler template. Essentially you create a GDI Image in memory, create a memory stream and send it down the http stream from the Http Handler. In the web page you will need an img tag and set your http handler as the image src. This will cause the browser to make a request to the handler, which will render the image and send it down the wire to be rendered in the browser.

This method is often used to watermark images for a website. See this link for some detail: dynamic image (from db) using Generic Handler

0

精彩评论

暂无评论...
验证码 换一张
取 消