Convert PDF to Searchable PDF
Overview
Searchable PDF conversion adds a hidden text layer to an image-based PDF such as a scanned document using OCR.
Set Transparent Text Layer
Use transparent_text to control whether the text layer is transparent.
Sample
ruby
ComPDFKitConversion::LibraryManager.set_document_ai_model("/path/to/documentai.model", -1)
options = ComPDFKitConversion::ConvertOptions.new
options.enable_ocr = true
options.transparent_text = true
options.languages = [ComPDFKitConversion::OCRLanguage::ENGLISH]
result = ComPDFKitConversion::Conversion.start_pdf_to_searchable_pdf(
input_file_path,
"",
output_file_path,
options
)