Streaming TIFF blob data

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Phil

    #1

    Streaming TIFF blob data

    Hi I have an issue when trying to stream blob image data from a SQL table to
    a .aspx page. the code I have works for GIF and JPEG but the images can be
    multiple pages and we would like them to open in a TIFF format.

    But since there are invoices with multiple pages, we would like to open as a
    TIFF format in Windows Picture and Fax Viewer. (or default for TIFF on
    client). Basically I need to stream this file to the client and then open in
    this program (or default for TIFF). I initially thought that by streaming and
    opening.. it is essentially placing a copy in the clients temp internet files
    and then opening from there.

    The code I am using is:

    SqlConnection myConn = new
    SqlConnection(C onfigurationSet tings.AppSettin gs["strConnect ion"]);
    SqlCommand myComm = new SqlCommand("Sel ect SX_Image_Data from
    SX_ACCSXDB_Imag es where chrBarCode = '" + Request.QuerySt ring["invoice"] +
    "'",myConn) ;

    myConn.Open();
    try
    {
    byte [] img = (byte[]) myComm.ExecuteS calar();
    MemoryStream ms = new MemoryStream();
    ms.Write(img, 0, img.Length);
    Bitmap bmp = new Bitmap(ms);

    bmp.Save(Respon se.OutputStream , ImageFormat.Tif f);

    }
    catch(Exception )
    {
    Response.Write( "<center><h4>Th e Invoice you are requesting does not
    exist in the system</h4></center>");
    }



    Expand AllCollapse All
Working...