如何使用c#将Html页面转换为图像 [英] How to Covert Html Page to image using c#

查看:144
本文介绍了如何使用c#将Html页面转换为图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨早安





我正在尝试将我的html表转换为图像格式,

i已经厌倦了谷歌,但大多数回答是为了网址转换,



可以任何帮助链接或代码将HTML转换为图像

i有HTML表格LIke



Hi Good Morning


I am trying to convert my html tables to image format,
i have tired to google but most of answer are for url converting,

Can any help with link or code to convert html to image
i have HTML Table LIke

_sb.Append("<table><thead><tr><th  style='text-align:right;padding:4px;padding-removed12px;font-weight:bold;'>" + HeaderValue + "</th></tr></thead>");





i希望将此表格转换为图片,我会将该图片发送至pdf





Html在字符串构建器中



i want to convert this table to image and i will send that image to pdf


The Html is in string builder

推荐答案

有许多第三方工具可用。



一个这样的例子是iTextSharp,它是一个免费的.NET API,用于PDF相关操作。它有一个iTextSharp.text.html.HtmlParser类,用于解析和转换html为PDF。



我从未使用它,但它似乎是受欢迎的选择,考虑到周围浮动的问题数量。





还有代码项目文章做同样的事情 [ ^ ]



商业图书馆 [ ^ ]



如果您使用的是Visual Studio,请检查< a href =http://nugetmusthaves.com/Tag/PDF> NuGet库 [ ^ ]



其他人 [ ^ ]



以及更多 [ ^ ]





所有发现者5分钟的谷歌搜索。祝你好运。



如果有帮助,请接受解决方案。谢谢。





PS:万一你真的需要图像而不是PDF,这最后一个工具 [ ^ ]让你做那个。
There are numerous third party tools available.

One such example is "iTextSharp" , its a free .NET API for PDF Related operations. It has a iTextSharp.text.html.HtmlParser class for parsing and converting the html to PDF.

I've never used it, but it seems to be popular choice, given the number of questions floating around it.


There are also Code project articles doing the same[^]

And Commercial libraries too[^]

If you're using Visual Studio check NuGet libraries[^]

Some others[^]

And more[^]


All found by 5 minutes of googling. Good luck.

If this helps, please accept the solution. Thank you.


P.S: Just in case you really need the image instead of PDF, this last tool [^] enables you to do that.


使用Html Renderer dll。它支持将html内容转换为图像

https://htmlrenderer.codeplex.com/# [< a href =https://htmlrenderer.codeplex.com/#target =_ blanktitle =New Window> ^ ]





http://amoghnatu.net / 2013/05/13 / converting-html-text-to-image-using-c / [ ^ ]
Use Html Renderer dll. It supports converting html content to image
https://htmlrenderer.codeplex.com/#[^]


http://amoghnatu.net/2013/05/13/converting-html-text-to-image-using-c/[^]


这篇关于如何使用c#将Html页面转换为图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆