本文介绍了使用HtmlRenderer将HTML转换为图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 您好, 我正在尝试使用HtmlRenderer将HTML转换为图片,其中包含2张图片,其中一张图片位于另一张图片的顶部,我尝试使用以下代码 位图m_Bitmap =新位图(700,900); PointF point = new PointF(0,0); SizeF maxSize = new System .Drawing.SizeF(800,1000); string html =< html>< head>< / head>< body> Test< img style = \position:absolute ;左:199px;顶部:293px; \src = \file:/// C:/Users/crakhuc/Desktop/Small.jpg \> < / body>< / html>; HtmlRenderer.HtmlRender.Render(Graphics.FromImage(m_Bitmap),html,point,maxSize); m_Bitmap.Save(@C :\ Test.png,ImageFormat.Png); 问题是第二张图片不是第一张图片它出现在第一张图片的底部 Hello, I am trying to convert HTML to image using HtmlRenderer which contain 2 image in which one image is on the top of another I tried following code Bitmap m_Bitmap = new Bitmap(700, 900); PointF point = new PointF(0, 0); SizeF maxSize = new System.Drawing.SizeF(800, 1000); string html = "<html><head></head><body> Test<img style=\"position: absolute; left: 199px; top: 293px;\" src=\"file:///C:/Users/crakhuc/Desktop/Small.jpg\"></body></html>"; HtmlRenderer.HtmlRender.Render(Graphics.FromImage(m_Bitmap),html,point, maxSize); m_Bitmap.Save(@"C:\Test.png", ImageFormat.Png);Problem with this is that second image dont come on top of first it comes at bottom of first image推荐答案 这篇关于使用HtmlRenderer将HTML转换为图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-13 13:42