PDF Generation Template Editor
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
Before using OCR, Layout Analysis, or 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.
If you need to control the number of Layout Analysis and Table Recognition model instances, call setDocumentAIModelCount.
const modelPath = "/path/to/documentai.model";
sdk.setDocumentAIModelCount(1, 1);
const code = sdk.setDocumentAIModel(modelPath, -1);
if (code !== 0) {
throw new Error(`setDocumentAIModel failed: ${code}`);
}When the conversion work is done, call releaseDocumentAIModel() if a DocumentAI model was loaded.
sdk.releaseDocumentAIModel();