How to read text from AnnotationText?

Discussions about annotation support.
Post Reply
bhattarai
Posts: 4
Joined: Fri Feb 12, 2016 10:50 am

How to read text from AnnotationText?

Post by bhattarai » Fri Feb 12, 2016 10:54 am

I added the annotation with following command.

GdViewer.AddTextAnnotationInteractive(message, textColor, "Arial", System.Drawing.FontStyle.Regular, 12, true, backgroundColor, backgroundColor, 1, 0);

I would like to read the text that is inside the textannotation and save it somewhere else for another purposes.

What I tried?

Code: Select all

 AnnotationManager oAnnotationManager = new AnnotationManager();
  var result = oAnnotationManager.InitFromGdPicturePDF(oGdPicturePDF);
int annotationIdx = GdViewer.GetSelectedAnnotationIdx(); //Here the selected annotation is AnnotationText
 if (annotationIdx >= 0)
{
 var selectedAnnotation = oAnnotationManager.GetAnnotationFromIdx(SelectedAnnotIdx);
selectedAnnotation.Height = height + (height / 10);
//from here I don't know what to do. I can change the height but I would like to be able to read the text inside

}
So yeah... I could not go far.

I know about Annotation Editor. But could not find how to use it. Any help?

bhattarai
Posts: 4
Joined: Fri Feb 12, 2016 10:50 am

Re: How to read text from AnnotationText?

Post by bhattarai » Fri Feb 12, 2016 2:37 pm

Sorry for asking. Got the answer.

Code: Select all

int annot_idx = GdViewer1.GetSelectedAnnotationIdx();
if (annot_idx != -1) {
	GdPicture.Annotation annot = GdViewer1.GetAnnotationFromIdx(annot_idx);
	if (annot.GetAnnotationType == GdPicture.Annotation.GdPictureAnnotationType.AnnotationTypeText) {
		AnnotationText text_annot = (AnnotationText)annot;

		String diwas = text_annot.Text;
	}
}

David
Posts: 66
Joined: Mon Feb 08, 2016 3:12 pm

Re: How to read text from AnnotationText?

Post by David » Mon Feb 15, 2016 9:47 am

Hi,

Thank you for letting us know you have found the solution!

Regards,

David

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest