GetPicure() Exception

  • 55 Views
  • Last Post 2 weeks ago
  • Topic Is Solved
jedarc posted this 3 weeks ago

I'm creating a WebService with some services that use FlexiCapture Engine 11.

Since multiple users will be making requests at the same time, then I needed to create a processors pool.

I followed the documentation and am using the OutprocLoader() method.

The problem is that when I run the following code I have an exception on the third line with the GetPicure() method.

IImageDocument imageDoc = document.Pages[0].ReadOnlyImage;
IImage pageBWImage = imageDoc.BlackWhiteImage;
IHandle hBitmap = pageBWImage.GetPicture(null, 0);
System.Drawing.Image preprocessedImage = System.Drawing.Image.FromHbitmap(hBitmap.Handle);
hBitmap.CloseHandle();

 Bad variable type. (Exception from HRESULT: 0x80020008 (DISP_E_BADVARTYPE))

 

How to solve this?

How can I get my image in memory?

 

Does this link say it's impossible on FineReader Engine, but and in FlexiCpture Engine?

Order By: Standard | Newest | Votes
Diana Khammatova posted this 2 weeks ago

As we discussed by email, you can use WriteToFile() method of the Image Object instead of GetPicure() method to get an image in the FlexiCapture Engine 11 because GetPicture() method does not work if the Engine object is created using the OutprocLoader object.

jedarc posted this 2 weeks ago

Many thanks for the response Diana Khammatova.

GetPicture() method does not work if the Engine object is created using the OutprocLoader object

It was very nice to receive your help in locating the same statement in the documentation.

But I would very much like to know more about the reasons for this statement.

I have enumerate each question to facilitate the answer.

  • 1 - Does ABBYY intend to support this feature someday?
  • 2 - What does a processor object created with OutprocLoader object differ from those created without it?
  • 3 - Is there any way to work with WebService that will have multiple simultaneous accesses without multithread?
  • 4 - Is there any way to work with multithread without using the OutprocLoader object? 
  • 5 - Is there an alternative for me to implement this (perhaps in a more complex way, unfortunately) without having to write the file to disk? Do you have any practical examples to help?

 

Diana Khammatova posted this 2 weeks ago

1. We are consulting with our developers about this question at the moment.
2. As you probably know to create the FlexiCaptureProcessor object, you need to use the CreateFlexiCaptureProcessor method of the Engine object. There are three ways to load the Engine object. The OutprocLoader object is more suitable for server solutions. The other methods are more suitable for using in interactive applications which are not intended for simultaneous processing. Please find the comparison table of the three loading methods in the Help → Guided Tour → Advanced Techniques → Programming Aspects → Different Ways to Load Engine.
3. Parallel running processes are possible for OutprocLoader object only.
4. According to the comparison table you can also use InprocLoader object to work in multi-threaded applications.
5. The workaround is to use the other ways of loading Engine, but you should remember that the most optimal method of loading the Engine into a server application is to load it by means of COM into a separate process as an out-of-process server.
In addition to the above, we would like to recommend you the article on how to use ABBYY FlexiCapture Engine in multi-threaded server applications, you can find it in the Help →Guided Tour →Advanced Techniques → Programming Aspects → Using ABBYY FlexiCapture Engine in Multi-Threaded Server Applications.

  • Liked by
  • jedarc
Diana Khammatova posted this 2 weeks ago

As for the first question, there are no plans to implement the feature right now but we passed your wish to our analysts. As we have already mentioned, it's not possible to use GetPicture() method when the Engine object is created via the OutprocLoader object so we recommend you to use WriteToFile() method instead of it.

  • Liked by
  • jedarc
Close