pdfInsertBookmarkEx
Insert a new bookmark node — targeting a page directly
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);
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.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
Title | Bookmark label text. |
Parent | Parent 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. |
Open | Whether the node starts expanded. |
AddChildren | Accepted but silently dropped — has no effect. |
Return value. The new bookmark's handle; 0 on failure.
C# (P/Invoke)
public static extern int pdfInsertBookmarkExA(IntPtr IPDF, [MarshalAs(UnmanagedType.LPStr)] string Title, int Parent, uint NamedDest, [MarshalAs(UnmanagedType.Bool)] bool Open, [MarshalAs(UnmanagedType.Bool)] bool AddChildren);
public static extern int pdfInsertBookmarkExW(IntPtr IPDF, [MarshalAs(UnmanagedType.LPWStr)] string Title, int Parent, uint NamedDest, [MarshalAs(UnmanagedType.Bool)] bool Open, [MarshalAs(UnmanagedType.Bool)] bool AddChildren);
Bookmarks
pdfInsertBookmarkExA
pdfInsertBookmarkExW
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.