PDF Generation Template Editor
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
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.
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:
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();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:
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);| 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 |
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.
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.
}
}