LEADTOOLS Support
General
General Questions
How to get an IRasterImage from 14.0 Main Control (ActiveX)
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Tuesday, October 31, 2006 2:47:02 PM(UTC)
Groups: Registered
Posts: 22
Hello all.
I have a .NET project in which I'm using your active X control (LEAD Main 14.0).
I'm using this because the code is being ported from vb 6.0 and much of the functionality has changed (rubberband, GDI+ now, etc). Until I can implement a solution in .NET with the RasterImageView, I'll be using this control. I've ported the code over and everything works. I'll now need to add OCR to my application. I plan to use the .NET OCR classes. I need to know how I can get an IRasterImage from a LEAD Main control 14.0 or any other ideas as far as methods to get the bitmap from a LEAD main control and into the OCR engine.
Here is some code that I've been trying.
Dim ReturnArray as Object
ReturnArray = LEADMain.SaveArray(10, 24, 0)
Dim MyArray() as Byte
MyArray = CType(ReturnArray, Byte())
MsgBox("The contents " & MyArray.Length)
Dim ms as MemoryStream = new MemoryStream(MyArray)
Dim returnImage as Image = Image.FromStream(ms)<--Invalid argument exception
LEADRaster.Image = returnImage
Any ideas??
Thanks in advance.
Bryan James
#2
Posted
:
Wednesday, November 1, 2006 5:54:29 AM(UTC)
Groups: Manager, Tech Support
Posts: 367
Was thanked: 1 time(s) in 1 post(s)
Bryan,
To convert the bitmap from the main OCX to our .NET toolkit, use the RasterImageConverter.FromLeadBitmap Method.
If the Main OCX is called LEADMain, the code will look like this:
IntPtr prtToBitmap = new IntPtr(LEADMain.Bitmap);
Leadtools.IRasterImage img = RasterImageConverter.FromLeadBitmap(prtToBitmap, "LTKRN14N.DLL");
Amin Dodin
Senior Support Engineer
LEAD Technologies, Inc.
![LEAD Logo LEAD Logo](https://www.leadtools.com/images/new-site-images/leadtools-logo-header.png)
LEADTOOLS Support
General
General Questions
How to get an IRasterImage from 14.0 Main Control (ActiveX)
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.