OCRDocumentEx
OCR, rendering, document editing
Description
Runs OCRPageEx over a page range, retaining one raster page at a time
Syntax
Delphi
Function TPDFlib.OCRDocumentEx(Const PageRange: WideString; DPI: Double;
Const Language, FontName: WideString; MinConfidence: Double;
Options: Integer): Integer;
ActiveX
Function PDFlib::OCRDocumentEx(PageRange As String, DPI As Double,
Language As String, FontName As String, MinConfidence As Double,
Options As Long) As Long
DLL
int DLOCRDocumentEx(int InstanceID, const wchar_t* PageRange, double DPI,
const wchar_t* Language, const wchar_t* FontName, double MinConfidence,
int Options);
int DLOCRDocumentExA(int InstanceID, const char* PageRange, double DPI,
const char* Language, const char* FontName, double MinConfidence,
int Options);
Parameters
| PageRange | A page-range expression such as 1-3,7, or an empty string for every page |
|---|---|
| DPI | The finite positive raster resolution |
| Language | A provider-defined language hint |
| FontName | An embeddable TrueType font or an empty string for fallback selection |
| MinConfidence | The inclusive word-confidence threshold from 0 through 1 |
| Options | The layer policy bitmask from ApplyOCRTextLayerEx, applied independently to every selected page |
Return values
The number of pages processed before completion, failure, or cancellation, including pages skipped by the existing-text policy and pages with no accepted words
A fully completed call returns the number of selected pages; earlier successful pages remain committed if a later page fails
Remarks
Each PNG is released before the next page is rendered, so peak raster memory follows the largest page rather than the page count
Use options 3 to retain native or foreign hidden text and refresh pages whose only text comes from owned OCR layers
Progress and cooperative cancellation use the normal operation lifecycle; provider cancellation leaves the current page's OCR result unapplied
GetOCRDiagnosticsJSON describes the last attempted or skipped page rather than an aggregate report for all pages
See also
OCRDocument, OCRPageEx, ConfigureTesseractOCR, GetOCRDiagnosticsJSON, LastOCRError