pdfCreateAnnotAP
Manage an annotation's /AP appearance-stream dictionary:
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);
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.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
Handle/Annot | Document-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)
public static extern int pdfCreateAnnotAP(IntPtr IPDF, uint Annot);
Object Creation
pdfCreateAnnotAP
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.