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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Getting Text and Location of annotations of a page

Thread ID:

Created:

Updated:

Platform:

Replies:

118923 Apr 23,2015 03:38 PM UTC Apr 27,2015 01:20 PM UTC WinRT 4
loading
Tags: PDF
Ric Silva
Asked On April 23, 2015 03:38 PM UTC

i have this code to add annotations to a pdf page

                    ....
                    var page = pdfDocument.Pages[pagn];
                    ....
                    string pdfAnnotationMsg = "Test Annotation 123";
                    PdfPopupAnnotation popupAnnotation = new PdfPopupAnnotation(new RectangleF((float)x, (pageHeight * 1.325f) - (float)y - VertOff2, 5, 5), pdfAnnotationMsg);
                    popupAnnotation.Border.Width = 1;
                    popupAnnotation.Open = false;
                    popupAnnotation.Border.HorizontalRadius = 1;
                    popupAnnotation.Border.VerticalRadius = 1;
                    popupAnnotation.Icon = PdfPopupIcon.Comment;
                    page.Annotations.Add(popupAnnotation);


the annotation gets added correctly but now im trying to access to its content and location 
i have this variable :

PdfLoadedAnnotationCollection annotationCollection = pdfDocument.Pages[0].Annotations;

and its count number shows the correct ammount of annotations, but if i use
annotationCollection[0].Text
i get a exception:

"A first chance exception of type 'System.NullReferenceException' occurred in Syncfusion.Pdf.WinRT.DLL"
Exception

how do i properly get the Text and Location from the diferent Annotations ? 

Ric Silva
Replied On April 23, 2015 03:47 PM UTC

forgot to mention im using version 12.2.0.36 

Abirami Selvan [Syncfusion]
Replied On April 24, 2015 12:25 PM UTC

Hi Ric ,

Thank you for using syncfusion product .

We are unable to reproduce the issue “Getting null reference exception when load the annotation text” .We have attached the sample which we have tried to reproduce the exception in below link :

http://www.syncfusion.com/downloads/support/forum/118923/PdfAnnotationSample1637495340.zip

 

Please modify the sample or provide us the input document which you have tried to  reproduce this issue . It will help us to proceed further in this issue .

And we are able to reproduce the issue “Getting empty bounds when load the annotation location” . We will update the complete details regarding this issue on 28th April ,2015.

 

Thanks ,

Abirami.


Ric Silva
Replied On April 24, 2015 02:35 PM UTC

ok i solved the problem some how eheh

i was loading the file to the viewer this way 

pdfViewer.DocumentLoaded += (sender, e) =>
                {
                    try
                    {
                        pdfViewer.ViewMode = PageViewMode.FitWidth;

                    }
                    catch (Exception e1)
                    {
                        Debug.WriteLine(e1.Message);
                    }
                };
                pdfViewer.LoadDocument(pdfDocument);

i replaced it with:

pdfViewer.LoadDocument(pdfDocument);
pdfViewer.ViewMode = PageViewMode.FitWidth;

and for some reason my annotation code started working

Abirami Selvan [Syncfusion]
Replied On April 27, 2015 01:20 PM UTC

Hi Ric,

We are happy to know that the issue fixed in your side.

Please let us know if you need further assistance.

Thanks,

Abirami.


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.

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

;