We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Change freetextannotation text automatically upon edit

Thread ID:

Created:

Updated:

Platform:

Replies:

146052 Jul 17,2019 09:17 PM UTC Jul 18,2019 04:44 PM UTC WPF 3
loading
Tags: PdfViewer
Jean Philippe Gagliardi
Asked On July 17, 2019 09:17 PM UTC

Hi, I would like to add text programatically inside a free text annotation. 

Jean Philippe Gagliardi
Replied On July 17, 2019 09:18 PM UTC

In particular, when the annotation loses focus, I would like to check if the text of the annotation contains a specific sub string and if not, I would like to add it programatically inside the annotation. 

Jean Philippe Gagliardi
Replied On July 17, 2019 09:22 PM UTC

I really do not have a clue how to do this.

Thank you

note: Sorry for multiple replies, I had a hard time with a (word or url not accepted in this forum thing...) my post was much longer...

Aravindh Sathiyamoorthy [Syncfusion]
Replied On July 18, 2019 04:44 PM UTC

Hi Jean, 
 
We do not have support to add the annotations directly in the UI through code behind. To view the changes in UI, we need to save and reload the PdfLoadedDocument object in the PdfViewerControl as mentioned in the below code snippet.  
 
  
RectangleF rectangle = new RectangleF(left, top, width, height);  
PdfRectangleAnnotation rectangleAnnot = new PdfRectangleAnnotation(rectangle, "Rectangle annotation");  
rectangleAnnot.Border.BorderWidth = 4;  
rectangleAnnot.Border.BorderStyle = PdfBorderStyle.Solid;  
PdfViewerControl.LoadedDocument.Pages[0].Annotations.Add(rectangleAnnot);  
PdfViewerControl.LoadedDocument.Save(“output.pdf”); 
PdfViewerControl.Unload(true); 
PdfViewerControl.Load(“output.pdf”); 
  
We created a sample for the same and it can be downloaded in the below link,  
 
 
Kindly let us know whether the above details fulfil your requirement. 
 
Regards, 
 
Aravindh Sathiyamoorthy. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon