PDFium Delphi Component Docs

InspectPdfUaUnicodeCoverage method

Component: TPdf  ·  Unit: PDFium
Reports object-scoped PDF/UA Unicode and ActualText extraction coverage

Syntax

function InspectPdfUaUnicodeCoverage: TPdfUaUnicodeCoverageReport; overload;
function InspectPdfUaUnicodeCoverage(const Options: TPdfUaUnicodeCoverageOptions): TPdfUaUnicodeCoverageReport; overload;

Description

The method scans each PDFium text page once and groups explicit characters by their originating native text object

A character is covered by a non-zero direct Unicode mapping or by printable ActualText attached to that exact text object, so replacement text cannot mask adjacent content

Artifact characters and PDFium-generated characters are counted separately and excluded from semantic coverage

Each stored TPdfUaUnicodeObjectCoverage records the page, PageObjectIndex when available, MCID, the FirstCharacterIndex, direct and replacement counts, mapping failures and bounded ActualText evidence with its ActualTextApplied and ActualTextTruncated flags

The default options store only uncovered objects, cap evidence at 1000 objects and cap each ActualText excerpt at 256 characters whilst aggregate counts continue across the whole document

Completed is False when required PDFium APIs are unavailable, a page cannot be loaded or native character state cannot be read; already collected counts and evidence remain available

Options and result

MemberPurpose
IncludeCoveredObjectsStores covered object evidence as well as uncovered evidence
MaxReportedObjectsCaps stored object evidence without stopping aggregate counting
MaxActualTextCharactersPerObjectCaps each stored replacement excerpt whilst preserving character counts
DirectUnicodeCharacterCount, ActualTextCharacterCountCount the two successful semantic extraction paths
SemanticCharacterCount, ArtifactCharacterCount, GeneratedCharacterCountSplit all scanned characters into semantic, Artifact and PDFium-generated totals
UncoveredTextObjectCountCounts scanned text objects with at least one Unicode map error or missing direct Unicode mapping, the objects whose extraction a repair pass must fix
CoveredTextObjectCount, ActualTextObjectCount, InvalidActualTextObjectCount, PagesScannedObject-level coverage totals and scan progress of the TPdfUaUnicodeCoverageReport
UnicodeMapErrorCharacterCount, MissingUnicodeCharacterCountCount native mapping errors and zero Unicode values
UnresolvedTextObjectCharacterCountCounts explicit semantic characters whose source object cannot be resolved
ReportLimitReachedIndicates that additional matching objects were counted but not stored
IsCoveredReturns True only for a completed scan with no mapping, missing Unicode or unresolved-object failures

Example

var Report: TPdfUaUnicodeCoverageReport;
Report := Pdf1.InspectPdfUaUnicodeCoverage;
if Report.Completed and not Report.IsCovered then
  ShowMessage(IntToStr(Report.UncoveredTextObjectCount) + ' text objects need repair');

See Also

ValidatePdfUa, InspectPdfUaLanguageCoverage, PDF standards helpers