int32_t __stdcall pdfCreate3DAnnotA(PPDF IPDF, double PosX, double PosY, double Width, double Height, const char* Author, const char* AnnotName, const char* U3DFile, const char* ImageFile);
int32_t __stdcall pdfCreate3DAnnotW(PPDF IPDF, double PosX, double PosY, double Width, double Height, const wchar_t* Author, const wchar_t* AnnotName, const wchar_t* U3DFile, const wchar_t* ImageFile);
function pdfCreate3DAnnotA(const IPDF: PPDF; PosX, PosY, Width, Height: Double; const Author, AnnotName, U3DFile, ImageFile: PAnsiChar): Integer; stdcall;
function pdfCreate3DAnnotW(const IPDF: PPDF; PosX, PosY, Width, Height: Double; const Author, AnnotName, U3DFile, ImageFile: PWideChar): Integer; stdcall;
Purpose. Create a 3D annotation embedding a U3D model file.
Description. Loads U3DFile (Lumas_Load3DModel, which also returns the appropriate /Subtype string for the 3D stream); fails outright if loading returns empty bytes. ImageFile — presumably intended as a 2D poster/preview image shown before the 3D view activates — is accepted by the ABI but never passed to Add3DAnnot, and has no effect whatsoever. There is no fallback poster image generated or attached through this call; if a poster image is required, it must be set through some other mechanism not covered by this entry point (not independently located in this chapter).
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
PosX, PosY, Width, Height | Bounding box. |
Author, AnnotName | /T, annotation name. |
U3DFile | Path to a .u3d model file; required, load failure fails the call. |
ImageFile | Accepted but never read — has no effect. |
Return value. The new annotation's handle; 0 if IPDF is invalid or U3DFile failed to load.
See also. pdfSet3DAnnotProps, pdfGet3DAnnotStream.
C# (P/Invoke)
public static extern int pdfCreate3DAnnot(IntPtr IPDF, double PosX, double PosY, double Width, double Height, [MarshalAs(UnmanagedType.LPStr)] string Author, [MarshalAs(UnmanagedType.LPStr)] string AnnotName, [MarshalAs(UnmanagedType.LPStr)] string U3DFile, [MarshalAs(UnmanagedType.LPStr)] string ImageFile);
public static extern int pdfCreate3DAnnotA(IntPtr IPDF, double PosX, double PosY, double Width, double Height, [MarshalAs(UnmanagedType.LPStr)] string Author, [MarshalAs(UnmanagedType.LPStr)] string AnnotName, [MarshalAs(UnmanagedType.LPStr)] string U3DFile, [MarshalAs(UnmanagedType.LPStr)] string ImageFile);
public static extern int pdfCreate3DAnnotW(IntPtr IPDF, double PosX, double PosY, double Width, double Height, [MarshalAs(UnmanagedType.LPWStr)] string Author, [MarshalAs(UnmanagedType.LPWStr)] string AnnotName, [MarshalAs(UnmanagedType.LPWStr)] string U3DFile, [MarshalAs(UnmanagedType.LPWStr)] string ImageFile);
Object Creation
pdfCreate3DAnnot
pdfCreate3DAnnotA
pdfCreate3DAnnotW
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.