pdfFindBookmark
Search the outline tree by title text and/or target page;
int32_t __stdcall pdfFindBookmarkA(PPDF IPDF, int32_t DestPage, const char* Title);
int32_t __stdcall pdfFindBookmarkW(PPDF IPDF, int32_t DestPage, const wchar_t* Title);
int32_t __stdcall pdfFindNextBookmark(PPDF IPDF);
function pdfFindBookmarkA(const IPDF: PPDF; DestPage: Integer; const Title: PAnsiChar): Integer; stdcall;
function pdfFindBookmarkW(const IPDF: PPDF; DestPage: Integer; const Title: PWideChar): Integer; stdcall;
function pdfFindNextBookmark(const IPDF: PPDF): Integer; stdcall;
Purpose. Search the outline tree by title text and/or target page; pdfFindNextBookmark continues a previous search from where it left off.
Description. pdfFindBookmarkA's ANSI-to-Wide conversion is a raw per-byte WideChar(Ord(byte)) cast — the same CP_ACP-unaware widening weakness documented for several other A-suffixed text entry points across this SDK (see V05/V06's font/text findings) — non-ASCII title searches via the A entry point should be treated as unreliable; use W for non-ASCII titles. pdfFindNextBookmark calls the same underlying search with an empty title and False for its "is a fresh search" flag, continuing wherever internal search state left off; it returns -1 (not 0) when no further match exists — note this differs from the classic API's 0-on-none-found convention.
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
DestPage | *(FindBookmark only)* Target page to match, or a sentinel to match by title alone (not independently re-verified — consult FindBookmarkH's exact sentinel convention). |
Title | Title text to search for. |
Return value. The matching bookmark's handle; 0 (FindBookmark) or -1 (FindNextBookmark) if no match.
C# (P/Invoke)
public static extern int pdfFindBookmarkA(IntPtr IPDF, int DestPage, [MarshalAs(UnmanagedType.LPStr)] string Title);
public static extern int pdfFindBookmarkW(IntPtr IPDF, int DestPage, [MarshalAs(UnmanagedType.LPWStr)] string Title);
Core
pdfFindBookmarkA
pdfFindBookmarkW
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.