#include "mdivwctl.h"
enum MiLANGUAGES
{
miLANG_CHINESE_SIMPLIFIED = 2052,
miLANG_CHINESE_TRADITIONAL = 1028,
miLANG_CZECH = 5,
miLANG_DANISH = 6,
miLANG_DUTCH = 19,
miLANG_ENGLISH = 9,
miLANG_FINNISH = 11,
miLANG_FRENCH = 12,
miLANG_GERMAN = 7,
miLANG_GREEK = 8,
miLANG_HUNGARIAN = 14,
miLANG_ITALIAN = 16,
miLANG_JAPANESE = 17,
miLANG_KOREAN = 18,
miLANG_NORWEGIAN = 20,
miLANG_POLISH = 21,
miLANG_PORTUGUESE = 22,
miLANG_RUSSIAN = 25,
miLANG_SPANISH = 10,
miLANG_SWEDISH = 29,
miLANG_SYSDEFAULT = 2048,
miLANG_TURKISH = 31
};
enum MiFILE_FORMAT
{
miFILE_FORMAT_DEFAULTVALUE = -1,
miFILE_FORMAT_TIFF = 1,
miFILE_FORMAT_TIFF_LOSSLESS = 2,
miFILE_FORMAT_MDI = 4
};
enum MiCOMP_LEVEL
{
miCOMP_LEVEL_LOW = 0,
miCOMP_LEVEL_MEDIUM = 1,
miCOMP_LEVEL_HIGH = 2
};
BOOL OCRImageFile( CString sImgFilePath, CString sOutFilePath )
{
IDocument *pDoc = new IDocument;
pDoc->CreateDispatch( "MODI.Document" );
pDoc->Create( sImgFilePath );
pDoc->OCR( miLANG_ENGLISH, 0, 0 );
FILE *fpOut = fopen( sOutFilePath, "wt" );
IImages images = pDoc->GetImages();
long num = images.GetCount();
for( int i = 0; i < num; i++ )
{
IImage image = images.GetItem(i);
ILayout layout = image.GetLayout();
fprintf( fpOut, " --< page %d of %d begin >--\n", i + 1, num );
fprintf( fpOut, layout.GetText() );
fprintf( fpOut, " --< page %d of %d end >--\n", i + 1, num );
}
pDoc->Close(0);
pDoc->ReleaseDispatch();
delete pDoc;
fclose( fpOut );
return (num > 0) ? TRUE : FALSE;
}
|