| |
   
Morovia.com Home | Fonts | Components | Labeling | Library | Order | Forum
  Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
Barcode ActiveX Control
 Community Forum : Barcode ActiveX Control
Subject Topic: Use Stream in .NET 2005 Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
teissier
Newbie
Newbie
Avatar

Joined: January 15 2006
Location: France
Posts: 1
Posted: January 15 2006 at 6:37am | IP Logged Quote teissier

Hi all,

I'm coding in .NET 2005.

I have some problem by using the method "ExportImage" with the

Stream objet. I have used a MemoryStream in my code by the method "ExportImage" throw a exception.

Somebody can tell me how to use properly the method "ExportImage" in a Stream objet ?

Thank you very much,

Yves Teissier.

Back to Top View teissier's Profile Search for other posts by teissier
 
glitch
Admin Group
Admin Group
Avatar

Joined: January 25 2003
Location: Canada
Posts: 280
Posted: January 16 2006 at 9:29am | IP Logged Quote glitch

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

Back to Top View glitch's Profile Search for other posts by glitch Visit glitch's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.3281 seconds.