API referenceAnnotations

pdfFindLinkAnnot

Update an existing Web Link's target URL

C
BOOL32 __stdcall pdfChangeLinkAnnot(PPDF IPDF, uint32_t Handle, const char* URL);
int32_t __stdcall pdfFindLinkAnnot(PPDF IPDF, const char* URL);
const char* __stdcall pdfGetAnnotLink(PPDF IPDF, uint32_t Handle);
Delphi
function pdfChangeLinkAnnot(const IPDF: PPDF; Handle: Cardinal; const URL: PAnsiChar): LongBool; stdcall;
function pdfFindLinkAnnot(const IPDF: PPDF; const URL: PAnsiChar): Integer; stdcall;
function pdfGetAnnotLink(const IPDF: PPDF; Handle: Cardinal): PAnsiChar; stdcall;

Purpose. Update an existing Web Link's target URL (pdfChangeLinkAnnot); search for a Link annotation whose target already matches a given URL (pdfFindLinkAnnot); read a Link's current target URI back out (pdfGetAnnotLink).

Description. pdfGetAnnotLink returns nil (not an empty-string pointer) both when Handle doesn't resolve and when it resolves but carries no URI (e.g. a page-destination Link rather than a URI Action Link) — the two failure modes are indistinguishable from the return value alone.

Parameters.

ParameterDescription
IPDFDocument handle.
HandleDocument-wide annotation handle.
URL*(ChangeLinkAnnot)* New target URL. *(FindLinkAnnot)* URL to search for.

Return value. pdfChangeLinkAnnot: True if Handle resolves. pdfFindLinkAnnot: the matching Link's handle, or 0 if none found. pdfGetAnnotLink: pointer to a transient buffer with the URI, or nil if Handle doesn't resolve or has no URI target.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfFindLinkAnnot(IntPtr IPDF, [MarshalAs(UnmanagedType.LPStr)] string URL);
Area
Annotations
Category

Core

Exported names

pdfFindLinkAnnot

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.