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.
set_document_ai_model 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.
If you need to control the number of Layout Analysis and Table Recognition model instances, call set_document_ai_model_count.
model_path = "/path/to/documentai.model"
ComPDFKitConversion::LibraryManager.set_document_ai_model_count(1, 1)
code = ComPDFKitConversion::LibraryManager.set_document_ai_model(model_path, -1)
raise "set_document_ai_model failed: #{code}" unless code == ComPDFKitConversion::ErrorCode::SUCCESS