THotPDF.ApplyLoadedOCRTextLayer Method
Renders selected pages, invokes a caller-supplied OCR engine, validates the recognised words and atomically commits an invisible searchable text layer
Declaration
function ApplyLoadedOCRTextLayer(
const PageIndices: array of Integer;
const Engine: IHPDFOCREngine;
const Options: THPDFOCRTextLayerOptions;
out Info: THPDFOCRTextLayerInfo): boolean;
Parameters
PageIndicessupplies zero-based page indices, with an empty array selecting all loaded pages and duplicates removedEngineis the synchronous recogniser and must not benilOptionscontrols rendering, confidence, existing-text handling, optional-content grouping, budgets and cancellationInforeceives status, diagnostics, counters and resource totals for every outcome
Result
Returns True for a committed layer or a successful run with no accepted words
Returns False for invalid options, engine failure, exhausted budgets, cancellation or commit failure without publishing a partial object graph
The engine runs on the calling thread and receives each page bitmap only for the duration of its Recognize call
Set ReplaceExistingOCRTextLayer to replace marked HotPDF OCR streams on recognised pages whilst retaining other content streams; pages with an empty accepted result keep their existing layer