int32_t __stdcall pdfHighlightAnnotA(PPDF IPDF, TAnnotType SubType, double PosX, double PosY, double Width, double Height, uint32_t Color, const char* Author, const char* Subject, const char* Comment);
int32_t __stdcall pdfHighlightAnnotW(PPDF IPDF, TAnnotType SubType, double PosX, double PosY, double Width, double Height, uint32_t Color, const wchar_t* Author, const wchar_t* Subject, const wchar_t* Comment);
function pdfHighlightAnnotA(const IPDF: PPDF; SubType: TAnnotType; PosX, PosY, Width, Height: Double; Color: Cardinal; const Author, Subject, Comment: PAnsiChar): Integer; stdcall;
function pdfHighlightAnnotW(const IPDF: PPDF; SubType: TAnnotType; PosX, PosY, Width, Height: Double; Color: Cardinal; const Author, Subject, Comment: PWideChar): Integer; stdcall;
Purpose. Create one of the 4 text-markup annotation types — Highlight, Underline, StrikeOut, Squiggly — selected by SubType.
Description. SubType is mapped via MarkupSubtypeName, which only explicitly recognizes 3 values — atUnderline→'Underline', atStrikeOut→'StrikeOut', atSquiggly→'Squiggly' — and silently maps every other TAnnotType value, not just atHighlight, to 'Highlight'. Passing an unrelated type (e.g. atLine, atText) does not fail — it silently creates a Highlight annotation instead. This function sets a bounding-box-derived quad, not a precise glyph-following quad; use pdfSetAnnotQuadPoints (Annotation Appearance and Properties) afterward for exact text coverage.
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
SubType | atUnderline/atStrikeOut/atSquiggly for those specific kinds; any other value (including but not limited to atHighlight) silently produces Highlight. |
PosX, PosY, Width, Height | Bounding box (auto-derives an initial quad from this box). |
Color | Packed color (always RGB — no CS parameter exists on this function at all). |
Author, Subject, Comment | /T, /Subj, /Contents. |
Return value. The new annotation's handle; 0 on failure.
See also. pdfSetAnnotQuadPoints.
C# (P/Invoke)
public static extern int pdfHighlightAnnotA(IntPtr IPDF, TAnnotType SubType, double PosX, double PosY, double Width, double Height, uint Color, [MarshalAs(UnmanagedType.LPStr)] string Author, [MarshalAs(UnmanagedType.LPStr)] string Subject, [MarshalAs(UnmanagedType.LPStr)] string Comment);
public static extern int pdfHighlightAnnotW(IntPtr IPDF, TAnnotType SubType, double PosX, double PosY, double Width, double Height, uint Color, [MarshalAs(UnmanagedType.LPWStr)] string Author, [MarshalAs(UnmanagedType.LPWStr)] string Subject, [MarshalAs(UnmanagedType.LPWStr)] string Comment);
Core
pdfHighlightAnnotA
pdfHighlightAnnotW
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.