image in web report

Stimulsoft Reports.NET discussion
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

image in web report

Post by Jan »

Hello,

Please add following method in your report code:

Code: Select all

public static Image LoadBitmap(string url)
{
	WebClient cl = new WebClient();
	cl.Credentials = CredentialCache.DefaultCredentials;
	byte [] bytes = cl.DownloadData(url);
        cl.Dispose();

	MemoryStream stream = new MemoryStream(bytes);
        return new Bitmap(stream);
}
Also you need add usings to:

Code: Select all

System.IO
System.Net
After then in BeforePrintEvent of image component:

Code: Select all

Image1.ImageToDraw = LoadBitmap("http://www.stimulsoft.com/Images/Logo/stimulsoft.logo.png");
Thank you.
Attachments
178.Sample.png
178.Sample.png (101.75 KiB) Viewed 3982 times
james
Posts: 6
Joined: Tue May 05, 2009 4:08 am

image in web report

Post by james »

hi dear Jan
thank you very much. i appreciate your kindness.
this code solved my problem.
Post Reply