API referenceAnnotations

pdfInsertBookmark

Insert a new bookmark node — targeting a page directly

C
int32_t __stdcall pdfInsertBookmarkA(PPDF IPDF, const char* Title, int32_t Parent, uint32_t DestPage, BOOL32 Open, BOOL32 AddChildren);
int32_t __stdcall pdfInsertBookmarkExA(PPDF IPDF, const char* Title, int32_t Parent, uint32_t NamedDest, BOOL32 Open, BOOL32 AddChildren);
Delphi
function pdfInsertBookmarkA(const IPDF: PPDF; const Title: PAnsiChar; Parent: Integer; DestPage: Cardinal; Open, AddChildren: LongBool): Integer; stdcall;
function pdfInsertBookmarkExA(const IPDF: PPDF; const Title: PAnsiChar; Parent: Integer; NamedDest: Cardinal; Open, AddChildren: LongBool): Integer; stdcall;

Purpose. Insert a new bookmark node — targeting a page directly (pdfInsertBookmark) or a named destination by handle (pdfInsertBookmarkEx).

Description. Both silently drop AddChildren — the ABI parameter (presumably meant to auto-populate child bookmarks, e.g. mirroring an imported outline substructure) is accepted but never reaches AddBookmark, which has no such parameter at all; passing True has no observable effect. pdfInsertBookmarkEx resolves NamedDest (a named- destination handle, from pdfCreateNamedDest) to a concrete page number via NamedDestPageByHandle once, at insertion time — the resulting bookmark's DestPage is a frozen snapshot; if the named destination's target page is changed afterward, the bookmark does not follow it (there is no live reference maintained between the bookmark and the named destination beyond that one-time page lookup).

Parameters.

ParameterDescription
IPDFDocument handle.
TitleBookmark label text.
ParentParent bookmark handle, or a sentinel for a top-level node (not independently re-verified — consult AddBookmark's own root-detection convention).
DestPage*(plain)* Target page (1-based).
NamedDest*(Ex)* Named-destination handle, resolved to a page number once at insertion time.
OpenWhether the node starts expanded.
AddChildrenAccepted but silently dropped — has no effect.

Return value. The new bookmark's handle; 0 on failure.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfInsertBookmarkA(IntPtr IPDF, [MarshalAs(UnmanagedType.LPStr)] string Title, int Parent, uint DestPage, [MarshalAs(UnmanagedType.Bool)] bool Open, [MarshalAs(UnmanagedType.Bool)] bool AddChildren);
public static extern int pdfInsertBookmarkW(IntPtr IPDF, [MarshalAs(UnmanagedType.LPWStr)] string Title, int Parent, uint DestPage, [MarshalAs(UnmanagedType.Bool)] bool Open, [MarshalAs(UnmanagedType.Bool)] bool AddChildren);
Area
Annotations
Category

Bookmarks

Exported names

pdfInsertBookmarkA pdfInsertBookmarkW

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.