L_Doc2GetUserDictionary

✎ NOTE

User words and dictionaries are no longer supported in the LEADTOOLS OCR Module - OmniPage Engine.

#include "ltdoc2.h"

L_LTDOC2_API L_INT EXT_FUNCTION L_Doc2GetUserDictionary(hDoc, pUDOpts, uStructSize)

Gets the name of the current User dictionary and its default section.

Parameters

L_HDOC2 hDoc

Handle to the OCR document.

pUSERDICTIONARY2 pUDOpts

Pointer to a USERDICTIONARY2 structure to be updated

L_UINT uStructSize

Size in bytes, of the structure pointed to by pUDOpts, use sizeof(USERDICTIONARY2) to calculate this value.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

Gets the name of the current User dictionary and its default section to be used in the recognition process.

To set a User dictionary and its default section, call the L_Doc2SetUserDictionary function.

To recognize a page, call the L_Doc2Recognize function.

Required DLLs and Libraries

See Also

Functions

Topics

Example

L_INT Doc2GetUserDictionaryExample(L_HDOC2 hDoc) 
{ 
   L_INT nRet; 
   USERDICTIONARY2 UDOpts; 
 
   ZeroMemory(&UDOpts, sizeof(USERDICTIONARY2)); 
   nRet = L_Doc2GetUserDictionary(hDoc, &UDOpts, sizeof(USERDICTIONARY2)); 
   if (nRet == SUCCESS) 
   { 
      L_TCHAR szBuffer[1024]; 
 
      ZeroMemory(szBuffer, sizeof(szBuffer)); 
      wsprintf(szBuffer, TEXT("User Dictionary Name = %s\nDefault Section Name = %s\n"), 
               UDOpts.pszFileName, 
               UDOpts.pszDefSection); 
 
      MessageBox(NULL, szBuffer, TEXT("User Dictionary Info"), MB_OK); 
 
      if (L_Doc2GetUserDictionaryState(hDoc)) 
         MessageBox(NULL, TEXT("The current user dictionary is changed."), TEXT("Notice!"), MB_OK); 
      else 
         MessageBox(NULL, TEXT("The current user dictionary is not changed."), TEXT("Notice!"), MB_OK); 
 
      L_CHAR szSection[DOC2_MAX_SECTION_NAME_LENGTH]; 
      ZeroMemory(szSection, sizeof(szSection)); 
      nRet = L_Doc2GetUserDictionarySection(hDoc, szSection, DOC2_MAX_SECTION_NAME_LENGTH, TRUE); 
      if (nRet == SUCCESS) 
      { 
         ZeroMemory(szBuffer, sizeof(szBuffer)); 
         wsprintf(szBuffer, TEXT("First Section in the current User Dictionray = %s\n"), szSection); 
 
         MessageBox(NULL, szBuffer, TEXT("First Section"), MB_OK); 
 
         L_WCHAR * pwcItem = (L_WCHAR *)GlobalAllocPtr(GHND, 512 * sizeof(L_WCHAR)); 
         if (pwcItem) 
         { 
            L_UINT32 uMask = 0; 
            nRet = L_Doc2GetUserDictionarySectionItem(hDoc, szSection, pwcItem, 512 * sizeof(L_WCHAR), &uMask, TRUE); 
            if (nRet == SUCCESS) 
            { 
               L_TCHAR szItem[512]; 
 
               ZeroMemory(szItem, sizeof(szItem)); 
               WideCharToMultiByte(0, 0, pwcItem, -1, (LPSTR) szItem, 512, NULL, NULL); 
 
               ZeroMemory(szBuffer, sizeof(szBuffer)); 
               wsprintf(szBuffer, TEXT("1st Section Item in the 1st section of the current User Dictionray = %s\n"), szItem); 
 
               MessageBox(NULL, szBuffer, TEXT("First Section Item"), MB_OK); 
            } 
            else 
               return nRet; 
 
            GlobalFreePtr(pwcItem); 
         } 
         else 
            return nRet; 
      } 
      else 
         return nRet; 
   } 
   else 
      return nRet; 
   return SUCCESS; 
} 
Help Version 20.0.2020.4.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS OCR Module - OmniPage Engine C API Help