Loading Image in the html before converting to image

Apr 5, 2014 at 5:32 PM
In the HTML to be converted to image using HTML renderer, I have a <img src = ""/> tag.
How to load image to the html tag so that the image mentioned in the image tag of the html appears in the image of the converted html.
Developer
Apr 6, 2014 at 8:22 AM
Do you use the methods described here: Generate image from HTML markup?
Apr 7, 2014 at 3:59 PM

Hi Arthur,

Thanks for the reply. I followed the link and was able to use the css. But the texts are shown bold even though i had specified the font-weight as normal.

<html><head><style type='text/css'> .datatable{font-family: 'Arial Narrow', Arial, 'Helvetica Condensed', Helvetica, sans-serif;font-size:10px;font-weight:normal;color:#000;background-color:#ffffff;border:1px solid #7F7F7F; border-spacing: 0;margin:0;padding:0;width:100%;}</style></head><body>

SALARIED SELF EMPLOYED Unknown
No Of Approvals 43648 31479 989
</body></html>

I tried changing the font family to Tahoma etc, then too the fonts are bold.

Can you please let me know, if I am missing something.

Regards & thanks,

Arumairaj Isaac.

Developer
Apr 7, 2014 at 5:17 PM
can you attach the image you get and the code you use to generate it
thx
Apr 8, 2014 at 9:04 AM

Arthur,

Code I used to generate the image

strHTML = "<html><head><style type='text/css'> .datatable{font-family: 'Arial Narrow', Arial, 'Helvetica Condensed', Helvetica, sans-serif;font-size:10px;font-weight:normal;color:#000;background-color:#ffffff;border:1px solid #7F7F7F; border-spacing: 0;margin:0;padding:0;width:100%;}</style></head><body>

SALARIED SELF EMPLOYED Unknown
No Of Approvals 43648 31479 989
</body></html>";

m_Bitmap = new Bitmap(intdatawidth, intdataheight);

PointF point = new PointF(0, 0);

SizeF maxSize = new System.Drawing.SizeF(intdatawidth-10, intdataheight);

HtmlRenderer.HtmlRender.Render(Graphics.FromImage(m_Bitmap),strHTML,point, maxSize);

string imgstroepath = Server.MapPath("~/log/" + strOutputfilename + "2.png");

m_Bitmap.Save(imgstroepath, System.Drawing.Imaging.ImageFormat.Png);

m_Bitmap.Dispose();)

Attached herewith the image that is generated.

In my previous mail also I attached the image.

From the Discussion web page I am not able to attach the attachment. I am using my mail to attach the attachment. Please let me know in case if you are not getting the image.

Regards & thanks,

Arumairaj Isaac.

From: Isaac A
Sent: 07 April 2014 20:28
To: '[email removed]'
Subject: RE: Loading Image in the html before converting to image [HtmlRenderer:541313]

Hi Arthur,

Thanks for the reply. I followed the link and was able to use the css. But the texts are shown bold even though i had specified the font-weight as normal.

<html><head><style type='text/css'> .datatable{font-family: 'Arial Narrow', Arial, 'Helvetica Condensed', Helvetica, sans-serif;font-size:10px;font-weight:normal;color:#000;background-color:#ffffff;border:1px solid #7F7F7F; border-spacing: 0;margin:0;padding:0;width:100%;}</style></head><body>

SALARIED SELF EMPLOYED Unknown
No Of Approvals 43648 31479 989
</body></html>

I tried changing the font family to Tahoma etc, then too the fonts are bold.

Can you please let me know, if I am missing something.

Regards & thanks,

Arumairaj Isaac.

Developer
Apr 8, 2014 at 2:33 PM
but.. but.. you don't use the recommended method described in the wiki (RenderToImage)... :'(
(the text is not bold, what you see is GDI inability to render text into image)
still no attached image... I would use snagy.gy for that

Generate image from HTML markup?
Apr 8, 2014 at 5:01 PM

When I use the below code, the image is not created.

String imgstroepath = @“E:\log\22f39ab2-75dd-4960-a006-44196251d6042.png”;

Image image = Image.FromFile(imgstroepath);

HtmlRender.RenderToImage(image, strHTML, new Point(15, 10));

Regards & thanks,

Arumairaj Isaac.

Apr 8, 2014 at 5:14 PM
Sending the attachment which was missing earlier.

http://snag.gy/AlEQy.jpg