Set DocumentAI Model
Overview
Before using OCR, Layout Analysis, Table Recognition you need to set the DocumentAI model path first.
SetDocumentAIModel supports an optional gpuID parameter used to specify the GPU device index for the AI model. When gpuID is -1, GPU acceleration is disabled.
Set AI Model Instance Count
If you need to control the number of Layout Analysis and Table Recognition model instances, call the corresponding interface to set the model instance counts.
Use Your Own AI Engine (SDK v4.1.0+)
This option is available only in SDK v4.1.0 or later. You can skip SetDocumentAIModel and plug in your own OCR, Layout Analysis, or Table Recognition engine through the callbacks on ConvertCallback. See 3.11 Use Custom AI Models via Callbacks for details.
Sample
go
modelPath := "***"
compdf.SetDocumentAIModelCount(1, 1)
compdf.SetDocumentAIModel(modelPath, 0)