SetStructElemScope

Tagged PDF, Accessibility

Description

Sets the /Scope attribute (Table attribute owner) on the structure element currently open on the tag stack. The scope identifies whether a TH (table header) cell applies to a column, a row, or both — required by PDF/UA-1 for tables with header cells. Equivalent to calling AddTagAttribute with Owner=Table, Name=Scope, and the scope name as the value.

Syntax

Delphi

function TPDFlib.SetStructElemScope(const Scope: WideString): Integer;

ActiveX

Function PDFlib::SetStructElemScope(Scope As String) As Long

DLL

int DLSetStructElemScope(int InstanceID, wchar_t * Scope);

Parameters

ScopeThe scope of the header cell. Must be one of the following values (case-sensitive):

Column — the header applies to all cells in the column
Row — the header applies to all cells in the row
Both — the header applies to both the column and the row

Return value

Returns 1 on success. Returns 0 if no document is open or no tag is currently open on the tag stack.

Remarks

Call this function after BeginTag (with tag type TH) and before EndTag. The /Scope attribute is defined in ISO 32000-1 §14.8.5.7.2 (Table attribute owner).

PDF/UA-1 (ISO 14289-1 §7.10) requires that table header cells clearly associate with their data cells. Providing the /Scope attribute is the recommended mechanism when the table layout allows it.

Example

// Tag a column header cell
PDFlib.BeginTag('TH', 'Product Name', '', '');
PDFlib.SetStructElemScope('Column');
PDFlib.DrawText('Product Name', 100, 700);
PDFlib.EndTag;

// Tag a row header cell
PDFlib.BeginTag('TH', 'Row 1', '', '');
PDFlib.SetStructElemScope('Row');
PDFlib.DrawText('Row 1', 72, 680);
PDFlib.EndTag;

See also

AddTagAttribute, SetStructElemBBox, BeginTag, EndTag, SetPDFUAMode