SetStructElemTitle
Tagged PDF & Accessibility
Description
Sets the /T (title) entry on the structure element currently being built on the tag stack. The title is a human-readable label that characterises the specific element — for example Chapter 1, Summary Table, or Figure 3: Quarterly Sales — rather than merely repeating the element type.
Syntax
Delphi
function TPDFlib.SetStructElemTitle(const Title: WideString): Integer;ActiveX
Function PDFlib::SetStructElemTitle(Title As String) As LongDLL
int DLSetStructElemTitle(int InstanceID, const wchar_t *Title);
int DLSetStructElemTitleA(int InstanceID, const char *Title);Parameters
| Title | A human-readable text string identifying this specific element instance. Pass an empty string to clear a previously set value. |
|---|
Return value
Returns 1 on success, 0 if no structure element is currently open or no document is selected.
Remarks
The /T entry is defined in ISO 32000-1 §14.7.2 Table 324. It is written as a PDF text string in the structure element dictionary.
Title serves a distinct purpose from the other text properties on a structure element:
- /T (Title) — A descriptive label for the element as used in navigation and tagging panels. Suitable for section headings, table captions, figure captions.
- /Alt (see SetStructElemAltText) — A complete textual substitute for the element for assistive technology when the element cannot be rendered.
- /ActualText (see SetStructElemActualText) — An exact Unicode replacement for glyph sequences whose extracted text would be incorrect.
PDF viewers use /T to label elements in the Tags navigation panel. Accessibility tools and remediation software use it as a landmark title for document navigation. For heading elements (H1–H6), the element content itself serves as the heading text; /T is more useful for non-text elements (Table, Figure, Form) or containers (Sect, Div) that need a descriptive label.
Example
// Tag a data table with a title for navigation and accessibility tools
PDFlib.BeginTag('Table', '', '');
PDFlib.SetStructElemTitle('Table 2: Annual Revenue by Region');
// ... table rows and cells ...
PDFlib.EndTag;
// Tag a document section
PDFlib.BeginTag('Sect', '', '');
PDFlib.SetStructElemTitle('Chapter 3: Implementation');
// ... section content ...
PDFlib.EndTag;See also
BeginTag, SetStructElemAltText, SetStructElemActualText, SetStructElemID, GetPDFUADiagnostics