Hello parthas,
Thank you for inaugurating the DocuVieware section
If you want full control over annotations you need to use the
AnnotationManager class.
Here an example that demonstrates some concepts which, I hope, will shed some lights.
It consists to use a custom action in order to asynchronously alter the current page annotations. All page annotations will be iterated, and for each rubber stamp annotation, the text will be switched to "I Love DocuVieware".
Please let me know if there is anything obscure.
Here the JS code to execute in the client-side for such purpose:
Code: Select all
DocuViewareAPI.PostCustomServerAction('DocuVieware1', true, 'MyPageAnnotationsUpdate', null);
Here the C# server-side code to use for such purpose:
Code: Select all
protected void Page_Load(object sender, EventArgs e)
{
DocuVieware1.CustomAction += handleCustomAction;
}
private void handleCustomAction(object sender, CustomActionEventArgs e)
{
if (e.actionName == "MyPageAnnotationsUpdate")
{
if (DocuVieware1.GetDocumentType() == GdPicture11.DocumentType.DocumentTypePDF)
{
GdPicture11.GdPicturePDF gdPicturePDF;
//Getting native PDF
if (DocuVieware1.GetNativePDF(out gdPicturePDF) == GdPicture11.GdPictureStatus.OK)
{
//Using an AnnotationManager object to parse PDF annotations
using (GdPicture11.AnnotationManager annotationManager = new GdPicture11.AnnotationManager())
{
if (annotationManager.InitFromGdPicturePDF(gdPicturePDF) == GdPicture11.GdPictureStatus.OK)
{
//Iterating through all annotation and changing sticky-note text to "I Love DocuVieware"
int annotationCount = annotationManager.GetAnnotationCount();
for (int i = 0; i < annotationCount; i++)
{
GdPicture11.Annotations.Annotation annot = annotationManager.GetAnnotationFromIdx(i);
if (annot is GdPicture11.Annotations.AnnotationRubberStamp)
{
((GdPicture11.Annotations.AnnotationRubberStamp)annot).Text = "I Love\r\nDocuVieware";
}
}
//Now we are done with the annotation manager, let's save annotations into the PDF.
annotationManager.SaveAnnotationsToPage();
//Asking DV to update client page
DocuVieware1.RedrawPage();
}
}
}
}
}
}