HtmlRenderer C# 未在渲染图像中显示 table 边框

HtmlRenderer C# not showing table border in Rendered Image

在我的 C# 代码中,我使用字符串变量(保存我的 html 代码)呈现 HTML 页面的 JPEG 图像。 html 代码中有一个 table,其边框未在 JPEG 图像中呈现。 我正在使用以下代码生成图像:-

        string sHtml = m_Html; //m_Html contains the html code            
        Image img = HtmlRender.RenderToImage(sHtml); 

经过彻底搜索,我了解到 HtmlRenderer 将我们传递的字符串(作为参数)渲染到 HTML 页面中,然后进行快照。现在,HtmlRenderer 使用的渲染引擎不是很复杂,它不支持 latest/complex CSS queries.So 如果你遇到这个问题,使用简单的 HTML/CSS.

如果仍然无法解决问题,请使用不同的库 'NReco'。如果你只是使用它,NReco 是开源的,如果你想修改它,它是许可的。 NReco 优于 HTML 渲染器。