PDFiumVCL Docs

Language property

Ten wpis API zachowuje identyfikatory, sygnatury, bloki kodu i terminy PDF w oryginalnej postaci.
Component: TPdf  ·  Unit: PDFium
Natural language identifier declared in the document catalog.

Syntax

property Language: WString; // read / write

Description

Language reads and writes the document catalog’s /Lang entry (PDF 1.7 spec section 14.9.2). The string follows RFC 3066 / BCP 47 language tag syntax — en, en-US, zh-Hans, ja-JP, etc. Screen readers and accessibility tools (PDF/UA, JAWS, NVDA) use this tag to choose the correct pronunciation engine when reading tagged text aloud.

Returns an empty string when Active is False or when the document does not declare /Lang. Assigning a new value updates the catalog immediately but the change is only persisted by the next SaveToFile / SaveToStream call. Span-level language overrides on individual text structure elements (set through the /Lang entry on a structure element dictionary) are not exposed by this property.

Language is independent of the encoding used for text content — PDFium always decodes character data to UTF-16, regardless of language. The tag is purely metadata, mainly relevant for tagged / PDF-UA accessible documents and for indexing engines that route extracted text through language-specific tokenisers.

Remarks

Example

if Pdf1.Language = '' then
begin
  Pdf1.Language := 'en-US';
  Pdf1.SaveToFile('tagged.pdf');
end
else
  Label1.Caption := 'Document language: ' + Pdf1.Language;

See Also

IsTagged, MetaText, Title, StructureElements