#include "ltdoc2.h"
L_LTDOC2_API L_INT L_Doc2DestroyDocument(hDoc, nDocId)
Destroys the document associated with the specified document ID.
Handle to the OCR document.
Document ID created by calling L_Doc2CreateDocument.
| Value | Meaning |
|---|---|
| SUCCESS | The function was successful. |
| < 1 | An error occurred. Refer to Return Codes. |
After document processing is complete and the document is no longer needed, destroy it by calling L_Doc2DestroyDocument.
When calling L_Doc2DestroyDocument, the activated settings collection for this document are deleted as well. This means you can no longer use that settings collection or document ID anymore.
To create a new document, call L_Doc2CreateDocument.
Required DLLs and Libraries
L_INT Doc2DestroyDocumentExample(L_TCHAR* pszSettingFile){L_INT nRet ;L_HDOC2 hDoc = NULL;L_INT nDocId = -1;nRet = L_Doc2StartUp(&hDoc, NULL);if (nRet != SUCCESS)return nRet;L_INT nSId;L_Doc2CreateSettingsCollection(hDoc, -1, &nSId);nRet = L_Doc2CreateDocument(hDoc, &nDocId, nSId);if (nRet != SUCCESS){L_Doc2ShutDown(&hDoc);return nRet;}nRet = L_Doc2LoadSettingsExt(hDoc, nDocId, pszSettingFile);if(nRet != SUCCESS){L_Doc2ShutDown(&hDoc);return nRet;}DOC2_FILLMETHOD fm;nRet = L_Doc2GetFillMethodExt(hDoc, nDocId, &fm);if (nRet == SUCCESS){if (fm != DOC2_FILL_HANDPRINT){nRet = L_Doc2SetFillMethodExt(hDoc, nDocId, DOC2_FILL_HANDPRINT);if(nRet != SUCCESS){L_Doc2ShutDown(&hDoc);return nRet;}}}else{L_Doc2ShutDown(&hDoc);return nRet;}nRet = L_Doc2SaveSettingsExt(hDoc, nDocId, pszSettingFile);if (nRet == SUCCESS)MessageBox(NULL, TEXT("The engine saved the updated settings to a file."), TEXT("Notice!"), MB_OK);else{MessageBox(NULL, TEXT("The engine couldn't save the updated settings to a file."), TEXT("Error!"), MB_OK);L_Doc2ShutDown(&hDoc);return nRet;}//...//...//...L_Doc2DeleteSettingsCollectionExt(hDoc, nDocId, nSId);L_INT nNewSId = -1;L_Doc2CreateSettingsCollection(hDoc, -1, &nNewSId);L_Doc2SetActiveSettingsCollectionExt(hDoc, nDocId, nNewSId);//...//...//...L_Doc2DestroyDocument(hDoc, nDocId);nRet = L_Doc2ShutDown (&hDoc);if(nRet != SUCCESS)return nRet;return SUCCESS;}