ApplyOCRTextLayerA

OCR, text, document editing

Description

ANSI variant of ApplyOCRTextLayer

Accepts string parameters as ANSI text and otherwise behaves identically to the wide-string entry point

Syntax

Delphi

Function TPDFlib.ApplyOCRTextLayer(Page: Integer; Const ResultJSON,
  FontName: WideString; MinConfidence: Double): Integer;

ActiveX

Function PDFlib::ApplyOCRTextLayer(Page As Long, ResultJSON As String, FontName As String, MinConfidence As Double) As Long

DLL

int DLApplyOCRTextLayer(int InstanceID, int Page, const wchar_t* ResultJSON,
  const wchar_t* FontName, double MinConfidence);
int DLApplyOCRTextLayerA(int InstanceID, int Page, const char* ResultJSON,
  const char* FontName, double MinConfidence);

Return values

1The text layer was added, or no word met the threshold
0Validation or writing failed

Remarks

The complete JSON structure and every word boundary are validated before page content is written

Each word is sized from its box height and horizontally fitted with text scaling, while an isolated graphics state prevents OCR formatting from leaking into later drawing operations

LastErrorCode is 110 for invalid OCR JSON and 307 for a page, font, or text-layer writing failure

LastOCRError provides the detailed reason

See also

OCRPage, OCRDocument, LastOCRError, RenderPageToString