OCRDocument
OCR, rendering, document editing
Description
Runs the OnOCRPage provider pipeline over a page range while retaining only one raster page at a time
Syntax
Delphi
Function TPDFlib.OCRDocument(Const PageRange: WideString; DPI: Double;
Const Language, FontName: WideString; MinConfidence: Double): Integer;Parameters
| PageRange | A page-range expression such as 1-3,7, or an empty string for every page |
|---|---|
| DPI | The positive raster resolution sent to the provider |
| Language | A provider-defined language hint |
| FontName | An embeddable TrueType font name or path, or an empty string for fallback selection |
| MinConfidence | The inclusive threshold from 0 through 1 |
Return values
The number of pages processed before completion, failure, or cancellation
A successful call returns the number of pages selected by PageRange
Remarks
This method calls OCRDocumentEx with options zero, preserving append behavior on every selected page
Configure the optional supplied adapter with ConfigureTesseractOCR or keep using an application-owned callback
Use OCRDocumentEx with options 3 to skip native or foreign hidden text while replacing owned-only OCR layers
GetOCRDiagnosticsJSON describes the last attempted page, while the integer return value counts processed pages
Each PNG is released after its callback and before the next page is rendered, so peak raster memory follows the largest page rather than the page count
Operation progress and cooperative cancellation use the normal PDF Library for Delphi progress lifecycle