AddAnnotationState
Annotations and hotspot links
Description
This page describes AddAnnotationState in PDFlibPas under the "Annotations and hotspot links" topic. API names, parameters, class names, filenames, and literals are kept exactly as they appear in the Delphi library and DLL entry points.
AddAnnotationState records a review status change for an existing annotation on the selected page (ISO 32000-1 §12.5.6.3). It appends a hidden Text annotation whose /IRT entry references the target annotation and whose /State and /StateModel entries carry the review status, matching the review workflow used by Acrobat's comment panel.
Syntax
Delphi
Function TPDFlib.AddAnnotationState(TargetAnnot: Integer; Const Author: WideString; State, StateModel: Integer): Integer;
Parameters
TargetAnnot is the 1-based index of the annotation on the selected page whose status is being set. Author is the reviewer name stored in the /T entry. StateModel selects the state model: 0 = Review, 1 = Marked. State selects the state within the model. For the Review model: 0 = None, 1 = Accepted, 2 = Rejected, 3 = Cancelled, 4 = Completed. For the Marked model: 0 = Unmarked, 1 = Marked.
Return Values
Returns the 1-based index of the newly appended state annotation in the page's annotation list, or 0 when the state or model selector is unknown, when TargetAnnot does not exist, or when the target annotation is not stored as an indirect object.
Remarks
The state annotation is written with the Hidden flag set, so it does not render on the page; PDF viewers with review support surface it in the comment panel instead. Use GetAnnotState and GetAnnotStateModel to read the recorded status back. Requires PDF 1.5; the document version is raised automatically when needed.