System.Drawing.Image.FromStream and PDF.

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);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top