PDFium Delphi Component Docs

ResolvePdfUaEffectiveLanguage function

Unit: PDFium
Resolves the effective natural language of one content position through the ISO 14289 declaration cascade

Syntax

function ResolvePdfUaEffectiveLanguage(const CatalogLanguage: WString;
  const Elements: TPdfStructureElements; ElementIndex: Integer;
  const MarkedContentLanguage: WString; HasMarkedContentLanguage: Boolean;
  out Resolution: TPdfUaLanguageResolution): Boolean;

Parameters

CatalogLanguageWString
ElementsTPdfStructureElements
ElementIndexInteger
MarkedContentLanguageWString
HasMarkedContentLanguageBoolean
ResolutionTPdfUaLanguageResolution

Return Value

Boolean

Description

ResolvePdfUaEffectiveLanguage applies the ISO 14289 language cascade to one content position and fills Resolution with the winning declaration

When HasMarkedContentLanguage is True the marked-content /Lang value wins and Resolution.Source is pulsMarkedContent

Otherwise the element at ElementIndex and its ancestors are walked through ParentIndex until one carries a non-empty Language; Resolution.Source is then pulsStructure and StructureElementIndex records the declaring element

When no structure element declares a language, a non-empty CatalogLanguage applies with Source pulsCatalog

Each candidate is validated with IsPdfUaLanguageTagValid and the outcome is stored in Resolution.DeclarationValid

The function returns Resolution.IsCovered, which is True only when a declaration was found and it is a well-formed tag

When no candidate exists, Resolution keeps Source pulsNone with an empty Language and the result is False

Remarks

Example

Covered := ResolvePdfUaEffectiveLanguage(Pdf.Language, Elements, I, '', False, Resolution);

See Also

IsPdfUaLanguageTagValid, TPdf.InspectPdfUaLanguageCoverage, TPdf.Language, TPdf.StructureElements