System.Drawing.Image.FromStream and PDF.

  • Thread starter Thread starter Hung Tran
  • Start date Start date
H

Hung Tran

Hi

I use the same code to store jpg/gif and pdf into SQL database.

The code below should display them, it works with jpg/gif but not pdf, I
get "invalid parameter used" error.

Any Idea ?

Hung Tran

----------------------------------

System.IO.MemoryStream MyStream;

MyStream = new System.IO.MemoryStream((byte[]) dr["Document"]);

System.Drawing.Image img = System.Drawing.Image.FromStream(MyStream);

System.Web.HttpContext.Current.Response.ContentType =
dr["DocType"].ToString();

img.Save(System.Web.HttpContext.Current.Response.OutputStream,
img.RawFormat);

thumbnail.Save(System.Web.HttpContext.Current.Response.OutputStream,
img.RawFormat);
 
Back
Top