Skip to content
ComPDF
DemoFAQ
New Release

Open-Source PDF SDK & AI Document Processing

Get the full self-hosted SDK and AI document processing on GitHub. One-click deploy to quickly build your document workflows.

Convert PDF to Searchable PDF

Overview

To make a searchable PDF by adding invisible text to an image based PDF such as a scanned document using OCR.

Set Transparent Text Layer

When outputting a searchable PDF, you can use the following option to control the hidden text layer:

  • transparent_text: Whether to output a transparent text layer.

Sample

The following example demonstrates how to convert a PDF document to a searchable PDF file.

c++
LibraryManager::SetDocumentAIModel("path/documentai.model");

ConvertOptions opt;
opt.enable_ocr = true;
opt.languages = {OCRLanguage::e_English};
opt.transparent_text = true;
CPDFConversion::StartPDFToSearchablePdf("scan.pdf", "password", "path/output.pdf", opt);