Increase render resolution for HtmlRender.RenderToImage

Jul 2, 2014 at 12:40 PM
Edited Jul 2, 2014 at 12:40 PM
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);
Developer
Jul 4, 2014 at 8:37 AM
Sorry, there is no way to do it now.
It needs proper support in the library.
Jan 30, 2015 at 11:28 PM
I used a graphics object, and then set graphics.ScaleTransform( XRes/SCREENRES, YRes/SCREENRES ) before the RenderGdiPlus call. Image was scaled up and looked nice, not magnified. Only issue was HtmlRender returns unscaled height, so you need to scale that up by the y factor. Other than that your library looks great so far!