OCRPage

OCR, rendering, document editing

Description

Renders one page to PNG, invokes OnOCRPage, and applies the returned searchable text layer

Syntax

Delphi

Function TPDFlib.OCRPage(Page: Integer; DPI: Double; Const Language,
  FontName: WideString; MinConfidence: Double): Integer;

Parameters

PageThe one-based page number
DPIThe positive raster resolution sent to the provider
LanguageA provider-defined language hint
FontNameAn embeddable TrueType font name or path, or an empty string for fallback selection
MinConfidenceThe inclusive threshold from 0 through 1

Return values

1The provider result was applied
0The operation failed or was cancelled

Remarks

This method calls OCRPageEx with options zero and appends an owned layer once recognition succeeds

ConfigureTesseractOCR supplies an optional instance-owned engine adapter; application callbacks remain supported

Orientation detection is off by default and can be enabled explicitly during engine configuration, with low confidence reported as a failure

Use OCRPageEx for the existing-text and owned-layer replacement policies

The provider receives PNG bytes only for the requested page

LastErrorCode is 514 when no provider is assigned or the callback or page rendering fails

See also

OCRDocument, OnOCRPage, ApplyOCRTextLayer, LastOCRError