pdfLineAnnot
Create a Line annotation between two points with optional end
int32_t __stdcall pdfLineAnnotA(PPDF IPDF, double x1, double y1, double x2, double y2, double LineWidth, TLineEndStyle lStart, TLineEndStyle lEnd, uint32_t FillColor, uint32_t StrokeColor, TPDFColorSpace CS, const char* Author, const char* Subject, const char* Content);
BOOL32 __stdcall pdfSetLineAnnotParms(PPDF IPDF, uint32_t Handle, int32_t FontHandle, double FontSize, PLineAnnotParms Parms);
BOOL32 __stdcall pdfSetLineAnnotPoints(PPDF IPDF, uint32_t Handle, PFltPoint P1, PFltPoint P2);
function pdfLineAnnotA(const IPDF: PPDF; x1, y1, x2, y2, LineWidth: Double; lStart, lEnd: TLineEndStyle; FillColor, StrokeColor: Cardinal; CS: TPDFColorSpace; const Author, Subject, Content: PAnsiChar): Integer; stdcall;
function pdfSetLineAnnotParms(const IPDF: PPDF; Handle: Cardinal; FontHandle: Integer; FontSize: Double; Parms: PLineAnnotParms): LongBool; stdcall;
function pdfSetLineAnnotPoints(const IPDF: PPDF; Handle: Cardinal; P1, P2: PFltPoint): LongBool; stdcall;
Purpose. Create a Line annotation between two points with optional end decorations (pdfLineAnnot); adjust an existing Line annotation's caption/ leader-line/measurement details (pdfSetLineAnnotParms) or endpoints (pdfSetLineAnnotPoints) after creation.
Description. pdfLineAnnot's creator call notably drops lStart/lEnd at creation time too — AddLineAnnot is called without either end-style argument; the line-end decorations must be applied afterward via pdfSetAnnotLineEndStyle (below) rather than at creation. pdfSetLineAnnotParms requires a non-null Parms pointer (a caption/ leader-line/measurement-ratio struct) and an associated font (FontHandle/ FontSize) for the caption text. pdfSetLineAnnotPoints requires both P1 and P2 non-null.
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
x1,y1,x2,y2 | *(creator only)* Line endpoints. |
LineWidth | Stroke width. |
lStart, lEnd | Accepted by the creator's ABI but dropped — use pdfSetAnnotLineEndStyle after creation instead. |
FillColor, StrokeColor | Packed colors (CS dropped, always RGB). |
Handle | *(Parms/Points only)* The Line annotation to modify. |
FontHandle, FontSize, Parms | *(Parms only)* Caption font and detail struct. |
P1, P2 | *(Points only)* New endpoints. |
Return value. pdfLineAnnot: the new handle; 0 on failure. pdfSetLineAnnotParms/Points: True if Handle resolves and required pointers are non-null; False otherwise.
See also. pdfSetAnnotLineEndStyle, pdfSetAnnotLineDashPattern.
C# (P/Invoke)
public static extern int pdfLineAnnotA(IntPtr IPDF, double x1, double y1, double x2, double y2, double LineWidth, TLineEndStyle lStart, TLineEndStyle lEnd, uint FillColor, uint StrokeColor, TPDFColorSpace CS, [MarshalAs(UnmanagedType.LPStr)] string Author, [MarshalAs(UnmanagedType.LPStr)] string Subject, [MarshalAs(UnmanagedType.LPStr)] string Content);
public static extern int pdfLineAnnotW(IntPtr IPDF, double x1, double y1, double x2, double y2, double LineWidth, TLineEndStyle lStart, TLineEndStyle lEnd, uint FillColor, uint StrokeColor, TPDFColorSpace CS, [MarshalAs(UnmanagedType.LPWStr)] string Author, [MarshalAs(UnmanagedType.LPWStr)] string Subject, [MarshalAs(UnmanagedType.LPWStr)] string Content);
Core
pdfLineAnnotA
pdfLineAnnotW
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.