Skip to content
ComPDF

Overview

Searchable PDF conversion adds an invisible or visible text layer to an image-based PDF, such as a scanned document, using OCR.

Set Transparent Text Layer

When outputting a searchable PDF, use transparent_text to control whether the text layer is transparent.

Sample

c
CPDF_SetDocumentAIModel(CPDF_TEXT("path/documentai.model"), -1);

COCRLanguage languages[] = {e_CENGLISH};

CConvertOption option = CPDF_DefaultConvertOption();
option.enable_ocr = true;
option.languages = languages;
option.language_count = 1;
option.transparent_text = true;

CPDF_StartPDFToSearchablePDF(CPDF_TEXT("scan.pdf"), CPDF_TEXT("password"), CPDF_TEXT("path/output.pdf"), option, NULL);