L_LTDOC2_API L_INT L_Doc2GetCharacterChoicesExt(hDoc, nDocId, nPageIndex, nCharIndex, ppCharChoices, plChoicesCount)
Gets all recognized characters for the specified recognized page.
Handle to the OCR document.
Document ID created by calling L_Doc2CreateDocument.
A zero-based index of the recognized page containing the character you wish to get its choices are located.
A zero-based index of the character to get its choices.
Address of a pointer to a L_WCHAR variable to be filled with the list of available character's choices (if any are available). Define a variable of type L_WCHAR* and pass its address.
Pointer to a variable to be updated with the number of choices available for the specified character index.
|SUCCESS||The function was successful.|
|< 1||An error occurred. Refer to Return Codes.|
Be sure to call L_Doc2GetRecognizedCharacters before calling L_Doc2GetCharacterChoicesExt.
L_Doc2GetCharacterChoicesExt obtains a list of recognized alternative characters and ligatures for the specified character index (if any are available). The number of alternative character's choices is in plChoicesCount.
Be sure to free the memory associated with ppCharChoices when it is no longer needed, by calling L_Doc2FreeCharacterChoices.
Required DLLs and Libraries
L_INT Doc2GetCharacterChoicesExampleExt(L_HDOC2 hDoc, L_INT nDocId)
RecogOpts.uStructSize = sizeof(RECOGNIZEOPTS2);
RecogOpts.nPageIndexStart = 0;
RecogOpts.nPagesCount = 1;
RecogOpts.SpellLangId = DOC2_LANG_ID_ENGLISH;
nRet = L_Doc2RecognizeExt (hDoc, nDocId, &RecogOpts, NULL, NULL);
if (nRet == SUCCESS)
pRECOGCHARS2 pRecogChars = NULL;
L_INT32 lCharsCount = 0;
nRet = L_Doc2GetRecognizedCharactersExt(hDoc, nDocId, 0, &pRecogChars, &lCharsCount, sizeof(RECOGCHARS2));
if (nRet == SUCCESS)
for (L_INT32 i=0; i<lCharsCount; i++)
L_WCHAR * pCharChoices = NULL;
L_INT nChoicesCount = 0;
nRet = L_Doc2GetCharacterChoicesExt(hDoc, nDocId, 0, i, &pCharChoices, &nChoicesCount);
if(nRet == SUCCESS && nChoicesCount > 0)
wsprintf(szBuffer, TEXT("Character Index: %d\nCharacter Code: %s\nChoices Count: %d"), i, pRecogChars[i].wGuessCode, nChoicesCount);
MessageBox(NULL, szBuffer, TEXT("Character Choices Count"), MB_OK);
nRet = L_Doc2FreeRecognizedCharacters(hDoc, &pRecogChars);
if(nRet != SUCCESS)