API referenceAnnotations

pdfFileLink

Create a Link annotation targeting an external URI

C
int32_t __stdcall pdfWebLinkA(PPDF IPDF, double PosX, double PosY, double Width, double Height, const char* URL);
int32_t __stdcall pdfFileLinkA(PPDF IPDF, double PosX, double PosY, double Width, double Height, const char* AFilePath);
Delphi
function pdfWebLinkA(const IPDF: PPDF; PosX, PosY, Width, Height: Double; const URL: PAnsiChar): Integer; stdcall;
function pdfFileLinkA(const IPDF: PPDF; PosX, PosY, Width, Height: Double; const AFilePath: PAnsiChar): Integer; stdcall;

Purpose. Create a Link annotation targeting an external URI (pdfWebLink) or a local file path (pdfFileLink) instead of an in-document destination.

Parameters.

ParameterDescription
IPDFDocument handle.
PosX, PosY, Width, HeightClickable rectangle.
URL*(WebLink)* Target URI.
AFilePath*(FileLink)* Target local file path.

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

See also. pdfChangeLinkAnnot, pdfFindLinkAnnot.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfFileLinkA(IntPtr IPDF, double PosX, double PosY, double Width, double Height, [MarshalAs(UnmanagedType.LPStr)] string AFilePath);
public static extern int pdfFileLinkW(IntPtr IPDF, double PosX, double PosY, double Width, double Height, [MarshalAs(UnmanagedType.LPWStr)] string AFilePath);
Area
Annotations
Category

Core

Exported names

pdfFileLinkA pdfFileLinkW

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.