BeginTagExA

Tagged PDF, Accessibility

Description

The trailing A denotes the ANSI (char) DLL entry point; the ActiveX/COM surface exposes only the Unicode form. Behaviour is identical to BeginTagEx and string arguments are interpreted using the current SetAnsiMode code page

Opens a tagged-PDF structure element on the current page, with an explicit natural-language attribute. Identical to BeginTag but adds a Lang parameter that is written to the structure element's /Lang attribute.

Use this function for content whose language differs from the document's default language (set by SetPDFUAMode or SetDocumentLanguage). ISO 14289-1 §7.2 requires the /Lang attribute to be set on any text segment that is not in the document's primary language.

Tags must be balanced: every BeginTagEx call must be followed by a matching EndTag call. Tags can be nested.

Syntax

Delphi

Function DLBeginTagExA(InstanceID: Integer; TagType, AltText, ActualText, Lang: PAnsiChar): Integer;

DLL

int DLBeginTagExA(int InstanceID, const char * TagType, const char * AltText, const char * ActualText, const char * Lang);

Parameters

TagTypePDF standard structure type: P, H1–H6, Figure, Table, TR, TH, TD, L, LI, LBody, Span, Link, Note, etc. (see ISO 32000-1 §14.8.4).
AltTextAlternative text for images and other non-text content (/Alt attribute). Pass an empty string if not required.
ActualTextReplacement text for content whose visual form differs from its logical meaning (/ActualText attribute). Pass an empty string if not required.
LangBCP 47 language tag for the content in this element, e.g. en-US, fr-FR, zh-Hans. Pass an empty string to inherit the document language. When non-empty, it overrides the document-level language for this element and all its descendants.

Return values

0Failed (no document is open)
1Tag opened successfully

Example

// Document in English with a French citation
PDF.SetPDFUAMode('en-US');
PDF.BeginTag('P', '', '');
PDF.PrintText(50, 750, 'The French motto is:');
PDF.EndTag;
PDF.BeginTagEx('Span', '', '', 'fr-FR');
PDF.PrintText(50, 730, 'Liberté, Égalité, Fraternité');
PDF.EndTag;