API referenceCore SDK

pdfCreateStructureTreeEx

Open the document-root structure element with an explicit root

CategoryTagged PDF / structure tree

Purpose — Open the document-root structure element with an explicit root tag.

Description — Fails immediately if a structure tree already exists (StructElemCount > 0) — this can only be called once per instance, as the very first structure operation. On success it also opens the root element onto the open-tag stack (equivalent to an implicit pdfOpenTag(RootTag)), so pdfSetTagID/pdfSetStructElemTitle called immediately after this apply to the root element.

Declarations

C
BOOL32 __stdcall pdfCreateStructureTreeEx(PPDF IPDF, TPDFBaseTag RootTag);
Delphi
function pdfCreateStructureTreeEx(const IPDF: PPDF; RootTag: TPDFBaseTag): LongBool; stdcall; external 'LumasPdf.dll';

TPDFBaseTag (from Lumas.Pdf.Types; a subset of the ISO 32000 standard structure types):

Delphi
TPDFBaseTag = (btArt, btArtifact, btAnnot, btBibEntry, btBlockQuote,
               btCaption, btCode, btDiv, btDocument, btFigure, btForm,
               btFormula, btH, btH1, btH2, btH3, btH4, btH5, btH6, btIndex,
               btLink, btList, btListElem, btListText, btNote, btP, btPart,
               btQuote, btReference, btSection, btSpan, btTable,
               btTableDataCell, btTableHeader, btTableRow, btTOC, btTOCEntry,
               btCL, btLabel, btRuby, btWarichu, btAbbr, btCallout, btDek,
               btEm, btLineNum, btReason, btRedaction, btSidebar, btStrong,
               btSub, btSup);

Parameters

ParameterTypeDescription
IPDFPPDFInstance handle with an open content stream (the root element also gets an MCID-tagged marked-content region on the current page).
RootTagTPDFBaseTagStructure type for the root element — typically btDocument, but any tag is accepted.

Return valueTRUE on success; FALSE if a structure tree already exists, there's no open content stream to write the opening BDC operator into, or the handle is invalid.

See alsopdfOpenTag (V12 tagged-PDF chapter), pdfSetTagID

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
[return: MarshalAs(UnmanagedType.Bool)]
Area
Core SDK
Category

Object Creation

Exported names

pdfCreateStructureTreeEx

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.