Annotation Replies
The annotation replies feature allows you and other users to engage in written discussions directly within the document. ComPDFKit provides a convenient API for accessing replies in the document, along with UI components for viewing and editing replies.
Creating Text Replies
Text replies allow you to add written responses below annotations, commonly used for discussions related to the annotation.
The steps to create a text reply are as follows:
- Obtain the page object.
- Retrieve annotations on the page.
- Create a text reply annotation on the annotation and add the reply content.
Here's an example code for creating a text reply:
// Obtain the page object.
CPDFPage page = document.PageAtIndex(0);
// Retrieve annotations on the page.
CPDFAnnotation annotation = page.GetAnnotations()[0];
// Create a text reply annotation on the annotation and add the reply content.
annotation.CreateReplyAnnotation();
Create State Replies
The status reply feature allows you to mark the status of an annotation, with options for checked and commented states. The status types can be distinguished using the CPDFAnnotationState
enumeration.
The steps to create a status reply are as follows:
- Obtain the page object.
- Retrieve the annotation on the page.
- Create a marked state reply.
- Create a review state reply.
Here's an example code for creating a state reply:
// Obtain the page object.
CPDFPage page = document.PageAtIndex(0);
// Retrieve the annotation on the page.
CPDFAnnotation annotation = page.GetAnnotations()[0];
// Create a marked state reply.
CPDFAnnotation markedReply = annotation.CreateReplyStateAnnotation(CPDFAnnotationState.C_ANNOTATION_MARKED);
// Create a review state reply.
CPDFAnnotation stateReply = annotation.CreateReplyStateAnnotation(CPDFAnnotationState.C_ANNOTATION_ACCEPTED);
Enumeration Types for State Reply Annotations
Name | Description |
---|---|
C_ANNOTATION_MARKED | Checked state, used for checked status replies |
C_ANNOTATION_UNMARKED | Unchecked state, used for checked status replies |
C_ANNOTATION_ACCEPTED | Accepted state, used for commented status replies |
C_ANNOTATION_REJECTED | Rejected state, used for commented status replies |
C_ANNOTATION_CANCELLED | Cancelled state, used for commented status replies |
C_ANNOTATION_COMPLETED | Completed state, used for commented status replies |
C_ANNOTATION_NONE | No state, used for commented status replies |
C_ANNOTATION_ERROR | State error |
Getting All Replies
The Get All Replies feature allows you to retrieve all replies under an annotation, including text replies and status replies. The reply types can be distinguished using the CPDFReplyAnnotationType
enumeration.
The steps to get all replies are as follows:
- Obtain the page object.
- Retrieve the annotation object on the page.
- Retrieve all reply annotations and classify them.
// Obtain the page object.
CPDFPage page = document.PageAtIndex(0);
// Retrieve the annotation object on the page.
CPDFAnnotation annotation = page.GetAnnotations()[0];
// Obtain the status replies of the annotation.
foreach (CPDFAnnotation replyAnnot in annotation.GetReplies())
{
if(replyAnnot.IsMarkedStateAnnot())
{
// Marked state reply.
}
else if(replyAnnot.IsReviewStateAnnot())
{
// Review state reply.
}
else
{
// Text reply.
}
}