| Posted: January 16 2006 at 9:29am | IP Logged
|
|
|
The .Net class MemoryStream does not provide IStream interface. Consequently the ExportImage does not accept it as a parameter.
We use ADODB.Stream object because it provides a standard IStream interface. In theory the ExportImage can take any Stream object. If you are programming in C++, you may refer to http://www.morovia.com/support/article.aspx?id=10027.
The ADODB.Stream.Open takes 5 optional parameters. You can use the follwing statement
Stream.Open(Type.Missing, (ConnectModeEnum)0, (StreamOpenOptionsEnum)0xffffffff, "", "" );
For more information about passing optional parameter in C#, see kb article http://support.microsoft.com/?kbid=305814.
The most convenient way is to use in a scripting language such as VBScript. The V3.2 comes with an IIS sample written in VBScript:
' The Stream object is available in MDAC 2.5 and above versions. You can download the most ' recent MDAC at http://www.microsoft.com/data/mdac/ Set objStream = Server.CreateObject("ADODB.Stream") objStream.Open objStream.Type = adTypeBinary
' Export the Image to Stream object. ' After transfer completes, the Position must set to 0 before Calling Response.BinaryWrite ' otherwise an "unknown type" is reported. objBarcode.ExportImage objStream, 1 objStream.Position = 0 ' BinaryWrite the image data to the client browser Response.BinaryWrite objStream.Read
|