OCR Variable Types

Top  Previous  Next

The most important variable type used by DTWAIN to denote an OCR engine is the DTWAIN_OCRENGINE handle type.

 

For most OCR functions, you will need the DTWAIN_OCRENGINE handle as a parameter to a function.  The DTWAIN_OCRENGINE is a 32-bit LONG integer type when using DTWAIN32.DLL and DTWAIN32U.DLL, and a 64-bit long type when using DTWAIN64.DLL and DTWAIN64U.DLL.

 

For example, the following code initializes the OCR interface, and outputs the information for each found DTWAIN_OCRENGINE engine.

 

DTWAIN_ARRAY OCR;

DTWAIN_OCRENGINE theEngine;

LONG numChars;

char buffer[100];

//...

DTWAIN_InitOCRInterface( );

DTWAIN_EnumOCRInterfaces( &OCR );

LONG nCount = DTWAIN_ArrayGetCount( OCR );

 

for (LONG i = 0; i < nCount; ++i )

{

  DTWAIN_ArrayGetAtLong( OCR, i, &theEngine );

   numChars = DTWAIN_GetOCRVersionInfo( theEngine, buffer, 99 );

   printf( "OCR Engine %d: %s\n", i, buffer );

}

 

DTWAIN_ArrayDestroy( OCR );