Pages

Wednesday, 25 July 2012

How to write a dynamically created bitmap file to response output stream


Thumbnail thumbnail = new Thumbnail(url, 800, 600, width, height);
Bitmap image = thumbnail.GenerateThumbnail();
this.Response.Clear();
this.Response.ClearHeaders();
image.Save(this.Response.OutputStream, ImageFormat.Bmp);
this.Response.ContentType = "image/bmp";
this.Response.AddHeader("content-disposition""attachment;filename=Thumbnail.bmp");
HttpContext.Current.ApplicationInstance.CompleteRequest();

No comments:

Post a Comment