Quantcast
Channel: HTML Renderer
Viewing all articles
Browse latest Browse all 693

New Post: Increase render resolution for HtmlRender.RenderToImage

$
0
0
Hi,

I'm rendering an image from a html template.
This works fine. And the result is as expected.

But the resolution of the image is to small.

I tried to increase the resolution of the bitmap to 200DPI.
But it is only the canvas that gets increased. Not the content rendered on it.

Inside the RenderToImage function, i added a resolution change to 200DPI.
var image = new Bitmap(size.Width, size.Height, PixelFormat.Format32bppArgb);
image.SetResolution(200, 200);
Is there a possibility to change the resolution for the rendered content?
var sHTML = System.IO.File.ReadAllText(@"test.html");
var a4Size = new Size(1654, 2339); //669, 894 -> 96DPI ,  1654, 2339 -> 200 DPI
var oImage = HtmlRender.RenderToImage(sHTML, a4Size);
oImage.Save("test.png", System.Drawing.Imaging.ImageFormat.Png);

Viewing all articles
Browse latest Browse all 693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>