pdfRichMediaAnnot
Create a RichMedia annotation embedding an external media file
int32_t __stdcall pdfRichMediaAnnotA(PPDF IPDF, double PosX, double PosY, double Width, double Height, int32_t AType, const char* FileName);
int32_t __stdcall pdfRichMediaAnnotW(PPDF IPDF, double PosX, double PosY, double Width, double Height, int32_t AType, const wchar_t* FileName);
function pdfRichMediaAnnotA(const IPDF: PPDF; PosX, PosY, Width, Height: Double; AType: Integer; const FileName: PAnsiChar): Integer; stdcall;
function pdfRichMediaAnnotW(const IPDF: PPDF; PosX, PosY, Width, Height: Double; AType: Integer; const FileName: PWideChar): Integer; stdcall;
Purpose. Create a RichMedia annotation embedding an external media file (Flash/video/3D, per AType).
Description. If FileName resolves to an existing file, its bytes are read and embedded along with its base filename; if the file doesn't exist, the annotation is still created via RichMediaAnnotH but with empty content data (data=''), rather than failing the call outright — the existence check only controls whether content gets attached, not whether annotation creation itself succeeds.
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
PosX, PosY, Width, Height | Bounding box. |
AType | Rich-media content-type selector, passed through as-is. |
FileName | Path to the media file; a non-existent path silently yields an empty-content annotation rather than a failure. |
Return value. The new annotation's handle; -1 if IPDF is invalid.
C# (P/Invoke)
public static extern int pdfRichMediaAnnotA(IntPtr IPDF, double PosX, double PosY, double Width, double Height, int AType, [MarshalAs(UnmanagedType.LPStr)] string FileName);
public static extern int pdfRichMediaAnnotW(IntPtr IPDF, double PosX, double PosY, double Width, double Height, int AType, [MarshalAs(UnmanagedType.LPWStr)] string FileName);
Core
pdfRichMediaAnnotA
pdfRichMediaAnnotW
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.