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.

Add and remove annotattion programmatically

Thread ID:

Created:

Updated:

Platform:

Replies:

127943 Dec 20,2016 10:26 AM Jan 12,2017 09:28 AM UWP 10
loading
Tags: SfPdfViewer
Pierre Courtoy
Asked On December 20, 2016 10:26 AM

Hello,

I would like to be able to add and remove an annotation programmatically in an opened SfPdfViewer, so that the viewer is automatically refreshed with the new annotation.

Is it possible to do in UWP ?

Thanks

Aravinth Sampath [Syncfusion]
Replied On December 21, 2016 11:22 AM

Hi Courtoy, 
 
Thank you for using Syncfusion product. 
 
We can able to add and remove annotation programmatically in SfPdfViewer control. We have created simple sample for adding annotation and it can be downloaded from the below link 
 
 
Please try the above sample and revert us with more details on your requirement if your requirement is differed from the provided sample. 
 
Regards, 
Aravinth 


Pierre Courtoy
Replied On January 2, 2017 09:45 AM

Thanks for the support.

I tried the demo but I have a problem.

What I want to do is exactly what is done in the last method of MainPage.xaml.cs => button_Click

But when I try to add a two annotations in this way, there is an ArgumentNullException (in the demo).
Do you know what causes the bug ?

And I would like to be able to highlight and strikethrough text, but when I create an annotation, it uses all the surface I gave, not just the surface where there is text. Is it possible to know where there is text ?

Thanks for your help.

Pierre Courtoy

Aravinth Sampath [Syncfusion]
Replied On January 3, 2017 09:47 AM

Hi Pierre, 
 
Please find the details of your queries from the below table, 
 
Query 
Details 
I tried the demo but I have a problem. 
 
What I want to do is exactly what is done in the last method of MainPage.xaml.cs => button_Click 
 
But when I try to add a two annotations in this way, there is an ArgumentNullException (in the demo). 
Do you know what causes the bug ? 
 
We are unable to reproduce the mentioned issue. We can able to add multiple annotations in a PDF document. Here we have prepared a sample which includes multiple annotations in the single page of a PDF document. Please modify this sample or provide us a sample to reproduce the mentioned issue. This will be helpful for us to look in to this issue. 
And I would like to be able to highlight and strikethrough text, but when I create an annotation, it uses all the surface I gave, not just the surface where there is text. Is it possible to know where there is text ? 
The co-ordinates of the text can be get from the GetTextCoordinates() method of PdfViewerControl. Using the coordinates, we can add highlight annotation to the text. Please find the code snippet to get the coordinates of the particular text. 
 
>>>>>>>>>>>>>>>>>> 
pdfViewer.GetTextCoordinates("1D/Linear BarCodes", 0, out coords); 
>>>>>>>>>>>>>>>>>>>>>>>> 
 
We have prepared a sample using which you add the highlight annotation to the text programmatically. 
 
Please find the sample from the below link, 
 
 
Please let us know if you have any concerns. 
 
Regards, 
Aravinth 


Pierre Courtoy
Replied On January 3, 2017 09:53 AM

Hi Aravinth,

For the bug, I just downloaded again the sample (http://www.syncfusion.com/downloads/support/directtrac/general/ze/PdfViewer_UWP1736746709 ), runs it and clicked on the "Add Annotation" button on the middle of the screen.

Since it adds an annotation programmatically in an open pdf viewer, that is exactly what I'm looking for.

For the way to get the coordinate, thanks for the sample, I will test that.

Pierre Courtoy

Pierre Courtoy
Replied On January 3, 2017 10:47 AM

Hi Aravinth,

I've just tested the GetTextCoordinates but that's not quite what I need.

I need to get the coordinates of a text in a selected zone.
And in the new sample you send, I have the same crash when you click twice on the "Add annotation" button.

Thanks for your help,

Pierre Courtoy

Renaud Laloire
Replied On January 5, 2017 05:03 AM

Hi,

I also have a ArgumentNullException as soon as I add the second annotion with your sample.

Do you have any fix for this ? We need to be able to add more than one annotation at a time.

Cheers,

Renaud

Aravinth Sampath [Syncfusion]
Replied On January 6, 2017 06:01 AM

Hi Pierre, 
 
Please find the details of your queries from the below table, 
 
Queries 
Details 
 
For the bug, I just downloaded again the sample (http://www.syncfusion.com/downloads/support/directtrac/general/ze/PdfViewer_UWP1736746709 ), runs it and clicked on the "Add Annotation" button on the middle of the screen. 
 
Since it adds an annotation programmatically in an open pdf viewer, that is exactly what I'm looking for. 
We were able to reproduce the reported issue, and we have fixed it my modifying the sample. The modified sample can be downloaded from the below link. 
 
 
Please try this sample and let us know if you face any issues, 
 
I've just tested the GetTextCoordinates but that's not quite what I need. 
 
I need to get the coordinates of a text in a selected zone. 
 
Can you please provide us the more details on this requirement? 
 
Are you trying to get the coordinates of the text using text selection or using annotations? 
 
It will be helpful for us to analyze more and assist you better on this. 
 
Please let us know if you have any concerns. 
 
Regards, 
Aravinth 


Pierre Courtoy
Replied On January 6, 2017 06:17 AM

Hi Aravinth,

I've just tested the new sample but I see that you reload the base document before adding the annotation. In my case, I need to be able to load only one time the base document (via url or path) and add annotation multiple times. 

So I need to be able to save multiple times without having to load the base document again.

So the sample can't really help me.


And the second point (getcoordinates) is of less importance for me.

Thanks for your help,

Renaud Laloire
Replied On January 9, 2017 03:52 AM

Same for me : when not reloading the document, I can only add one annotation without crashing. As soon as I add a second one, it crashes.

Syncfusion, can you see thaArgumentNullException  ?

Regards,

Renaud

Aravinth Sampath [Syncfusion]
Replied On January 12, 2017 09:28 AM

Hi Customer, 

A support incident to track the status of reported issue “Issue in adding and removing annotation programmatically without loading multiple times in SfPdfViewer control, has been created individually under your account. Please log on to our support website to check for further updates.  
 
 
Regards, 
Aravinth 


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.

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.

;