Overview
Before using OCR, Layout Analysis, Table Recognition, PDF to Searchable PDF, or PDF to OFD, set the DocumentAI model path first.
CPDF_SetDocumentAIModel supports the gpu_id parameter to specify the GPU device index for the AI model. When gpu_id is -1, GPU acceleration is disabled.
Example
CSDKErrorCode code = CPDF_SetDocumentAIModel(CPDF_TEXT("path/documentai.model"), -1);
if (code != e_CErrSuccess) {
return code;
}Set AI Model Instance Count
If you need to control the number of Layout Analysis and Table Recognition model instances, call the following interface:
CPDF_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 4.11 Use Custom AI Models via Callbacks for details. When all capabilities you need are covered by your own callbacks, CPDF_SetDocumentAIModel does not have to be called.