API referenceRendering & Viewer

rasCreateAnnotFromControl

rasCreateControl registers a UI control descriptor on

C
int32_t __stdcall rasCreateAnnotFromControl(IPGC CachePtr, const wchar_t* Author, const wchar_t* Comment);
BOOL32 __stdcall rasCreateControl(IPGC CachePtr, PPDFControl Value);
Delphi
function rasCreateAnnotFromControl(CachePtr: IPGC; Author, Comment: PWideChar): Integer; stdcall;
function rasCreateControl(CachePtr: IPGC; Value: PPDFControl): LongBool; stdcall;

Purpose. rasCreateControl registers a UI control descriptor on the page cache (seeding its base control size); rasCreateAnnotFromControl would nominally convert such a control into a real PDF annotation.

Description. rasCreateAnnotFromControl is a deliberate stub — its entire body is a comment explaining the omission ("Viewer-control -> annotation conversion belongs to the interactive rasterizer layer (not yet implemented). Return -1 (error) rather than a fake handle.") followed by Result := -1; Author/Comment are never read. rasCreateControl is genuinely real: it stores the supplied TPDFControl descriptor (C.LastControl, C.HasControl := True) and, if the cache's base control size hasn't been set yet (BaseCtrlW/BaseCtrlH = 0), seeds it from the cache's current viewport size — so a later rasGetBaseControlSize (Zoom, Scroll, Rotate, and Coordinate Mapping) call returns real, non-zero state even before rasInitBaseObjects (Rasterizer and Page-Cache Lifecycle) has run.

Parameters.

ParameterDescription
CachePtrTarget page cache.
Author, Comment*(CreateAnnotFromControl only)* Never read — the function always fails.
Value*(CreateControl only)* The control descriptor to store.

Return value. rasCreateAnnotFromControl: always -1. rasCreateControl: True if CachePtr resolves (NotImplLogB-style failure path otherwise, despite the function being real once a valid cache is supplied).

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int rasCreateAnnotFromControl(IntPtr CachePtr, IntPtr Author, IntPtr Comment);
Area
Rendering & Viewer
Category

Rasterizer/Rendering

Exported names

rasCreateAnnotFromControl

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.