API referenceImport & Output APIs

pdfOpenTagEx

Open a new structure element (push it onto a real

C
BOOL32 __stdcall pdfOpenTagA(PPDF IPDF, TPDFBaseTag Tag, const char* Lang, const char* AltText, const char* Expansion);
BOOL32 __stdcall pdfOpenTagExA(PPDF IPDF, TPDFBaseTag Tag, const char* Lang, const char* AltText, const char* Expansion, const char* Attributes);
Delphi
function pdfOpenTagA(const IPDF: PPDF; Tag: TPDFBaseTag; const Lang, AltText, Expansion: PAnsiChar): LongBool; stdcall;
function pdfOpenTagExA(const IPDF: PPDF; Tag: TPDFBaseTag; const Lang: PAnsiChar; const AltText, Expansion: PAnsiChar; const Attributes: PAnsiChar): LongBool; stdcall;

Purpose. Open a new structure element (push it onto a real open-tag stack) and emit the corresponding marked-content operator into the current page's content stream — the fundamental primitive behind tagged-PDF/PDF-UA accessibility structure trees. pdfOpenTagEx nominally adds custom attribute-dictionary support beyond the base form.

Description. Both are genuinely real and substantial (not a stub cluster at all, unlike what the "deferred, undocumented" history might suggest): OpenStructTagEx computes a real MCID (marked-content ID, counted per-page among already-registered structure elements), registers a full structure-element record (tag name, MCID, page index, parent linked via the current top of the open-tag stack — real parent/child structure-tree nesting, not a flat list), pushes the new element's index onto the stack, and emits the literal content-stream operator /<TagName> <</MCID n>> BDC. Tag (a TPDFBaseTag ordinal) is mapped to one of 52 real standard PDF/PDF-UA structure type names (Art, H1-H6, P, Span, Table, TD, Figure, Formula, etc. — the complete ISO 32000/PDF-UA vocabulary) via a fixed lookup table; any out-of-range ordinal silently falls back to 'Span' (a safe generic default, not a failure). MAJOR VERIFIED FINDING: pdfOpenTagEx's entire reason for existing — its Attributes parameter — is silently dropped. The wrapper's call to OpenStructTagEx is byte-for-byte identical to the plain pdfOpenTag's call, right down to hardcoding the underlying method's final Act (attributes) argument as the literal empty string ''Attributes is never read at all. This is not merely "attributes are accepted but unused at serialization" — the internal storage array for this data, FStructAct, is real and presumably would be consumed at serialization if populated (its sibling field, FStructAlt, IS populated by AltText and genuinely serialized) — but there is no exported function anywhere in this entire SDK that ever supplies a non-empty value for it. pdfOpenTagEx is, in practice, a complete functional duplicate of pdfOpenTag — the "Ex" gives no additional capability.

Parameters.

ParameterDescription
IPDFDocument handle.
TagStandard structure-type ordinal (0..51); out-of-range silently becomes Span.
LangElement language tag (/Lang); stored, always ANSI-only (no Lang parameter has a wide-string form in any of the four functions in this chapter — only AltText/Expansion get W variants).
AltTextAlternate description text (/Alt) — genuinely stored and serialized.
ExpansionAbbreviation expansion text (/E) — genuinely stored and serialized.
Attributes*(Ex only)* Accepted but never used — pdfOpenTagEx is functionally identical to pdfOpenTag.

Return value. True if a current content stream is available (i.e. a page is open) to emit the BDC operator into.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
[return: MarshalAs(UnmanagedType.Bool)]
Area
Import & Output APIs
Category

Core

Exported names

pdfOpenTagExA pdfOpenTagExW

String variants

The …A form takes UTF-8, …W takes UTF-16; a bare name aliases the ANSI form.

See working code

Worked examples — complete programs in ten languages.