Set DocumentAI Model
Overview
Before using OCR, Layout Analysis, Table Recognition, PDF to Searchable PDF, or PDF to OFD, you need to set the DocumentAI model path first.
SetDocumentAIModel supports an optional gpu_id parameter used to specify the GPU device index for the AI model. When gpu_id is -1, GPU acceleration is disabled.
Example
LibraryManager::SetDocumentAIModel("path/documentai.model", -1);Set AI Model Instance Count
If you need to control the number of Layout Analysis and Table Recognition model instances, call the following interface:
LibraryManager::SetDocumentAIModelCount(1, 1);The first parameter indicates the number of Layout Analysis model instances, and the second parameter indicates the number of Table Recognition model instances.
Use Your Own AI Engine (SDK v4.1.0+)
This option is available only in SDK v4.1.0 or later. If you prefer to run OCR, Layout Analysis, or Table Recognition with your own model or a third-party service instead of the bundled DocumentAI model, the SDK exposes callback hooks on CConvertCallback that let you supply the results as JSON. See 3.11 Use Custom AI Models via Callbacks for details. When all three capabilities you need are covered by your own callbacks, SetDocumentAIModel does not have to be called.