API referenceAnnotations

pdfSelectAnnotAPStream

Manage an annotation's /AP appearance-stream dictionary:

C
BOOL32 __stdcall pdfResetAnnotAP(PPDF IPDF, int32_t Handle);
int32_t __stdcall pdfCreateAnnotAP(PPDF IPDF, uint32_t Annot);
BOOL32 __stdcall pdfSelectAnnotAPStream(PPDF IPDF, uint32_t Handle, BOOL32 IsAnnot, TButtonState State, const char* SubState, uint32_t* StreamObj);
Delphi
function pdfResetAnnotAP(const IPDF: PPDF; Handle: Integer): LongBool; stdcall;
function pdfCreateAnnotAP(const IPDF: PPDF; Annot: Cardinal): Integer; stdcall;
function pdfSelectAnnotAPStream(const IPDF: PPDF; Handle: Cardinal; IsAnnot: LongBool; State: TButtonState; const SubState: PAnsiChar; var StreamObj: Cardinal): LongBool; stdcall;

Purpose. Manage an annotation's /AP appearance-stream dictionary: force regeneration of the auto-generated appearance (pdfResetAnnotAP), explicitly (re)build it now rather than lazily at serialize time (pdfCreateAnnotAP), and resolve/select a specific appearance sub-state's stream object — e.g. a checkbox's Off/On /AP /N sub-dictionary entries, or a push-button's Down/Rollover states (pdfSelectAnnotAPStream, shared with the form-field appearance-state model since widget annotations and fields overlap in this object model, same as pdfSetAnnotOrFieldDate above).

Parameters.

ParameterDescription
IPDFDocument handle.
Handle/AnnotDocument-wide annotation handle.
IsAnnot*(SelectAPStream only)* Whether Handle should be resolved as an annotation (True) or a form field (False).
State, SubState*(SelectAPStream only)* The button/appearance state (and, for radio/checkbox groups, the specific export-value sub-state name) to select.
StreamObj*(SelectAPStream only)* Output: the resolved appearance stream's object number.

Return value. pdfResetAnnotAP: True if Handle resolves. pdfCreateAnnotAP: the (re)built appearance's identifying value, or a failure sentinel if Annot doesn't resolve — this chapter did not independently re-verify the exact non-zero success encoding beyond confirming the call path is real, not a stub. pdfSelectAnnotAPStream: True if the target state resolved and StreamObj was filled.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
[return: MarshalAs(UnmanagedType.Bool)]
Area
Annotations
Category

Core

Exported names

pdfSelectAnnotAPStream

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.