Hello everyone,
I have come across an issue while using the Syncfusion PdfViewerControl. It appears that the WPF version of the PdfViewerControl does not have functions like ClearAnnotations or ClearAllAnnotations to clear the annotations. Instead, annotations can only be deleted using the DeleteAnnotation function.
However, similar functionality has already been implemented in Xamarin. I was wondering if Syncfusion has plans to add this feature to the WPF version? Alternatively, it would be helpful to have a function to retrieve all annotations so that we can call the DeleteAnnotation function and achieve a similar clearing operation.
Thank you.
Hello everyone,
I have encountered an issue while using shape annotations in my program. When I use ink annotations, the program works fine, and it also works fine when I use shape annotations. However, when I delete the shape annotations and then try to use them again, they fail to work, while ink annotations continue to work normally.
I triggered the issue in the following sequence:
I am not sure what caused this issue. The relevant source code has been uploaded to the attachment. Please help me resolve this issue. Thank you.
Rhyme,
|
Queries |
Response |
|
|
1. I have come across an issue while using the Syncfusion PdfViewerControl. It appears that the WPF version of the PdfViewerControl does not have functions like ClearAnnotations or ClearAllAnnotations to clear the annotations. Instead, annotations can only be deleted using the DeleteAnnotation function. |
At present, we don’t have support for removing all the annotations in the document, using a single API in our WPF PdfViewerControl. However, we can achieve this by using the PdfLoadedDocument instance programmatically. With the LoadedDocument property we can remove all the annotations in the document by iterating over the pages and then clearing the annotations collection. We have attached simple sample and code snippet below to remove all annotation in the document using LoadedDocument.
Regarding API to delete all annotations in the document in WPF PdfViewer, similar to Xamarin PdfViewer. We will analyze and update further on July 30, 2023.
|
|
|
2. I have encountered an issue while using shape annotations in my program. When I use ink annotations, the program works fine, and it also works fine when I use shape annotations. However, when I delete the shape annotations and then try to use them again, they fail to work, while ink annotations continue to work normally. |
We have already resolved this reported issue in our latest release. Please upgrade to the latest version, v22.1.34, to get the reported issue resolved. Package link: https://www.nuget.org/packages/Syncfusion.PdfViewer.WPF/22.1.34 |
Manigandan, thank you for your quick reply and problem solving
Rhyme, we have logged a feature request for “Removing all the annotations in the document, using a single API in our WPF PdfViewerControl”. We do not have any immediate plans to implement these features. At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technological feasibility, and customer interest. We will let you know when this feature is implemented.
You can now track the status of this feature request here,
Hello, Manigandan:
I encountered some issues with clearing ink. After drawing any shape, I used the method you provided to clear the ink, and it worked well. However, after repeating this operation for about half an hour, the ink could not be cleared anymore. Could it be that my frequent operations caused it to not be cleared properly?
Please find below a screenshot of the error log that may be related to this issue:
Rhyme, From the stack trace you provided the reported issue is not occur while clearing the annotations, It occurs when you click the hyperlink within the document. The exception was raised due to pdfviewer try to start the invalided link associated with the hyperlink clicked. However, there is a solution to resolve this issue by manually handling the hyperlink events using the PdfViewer_HyperlinkClicked event. In this event, we can handle the hyperlink manually by setting "e.handled" as true and preventing any further exceptions from being thrown. Please find the code snippet and attached sample for your reference.
|
pdfViewer.HyperlinkClicked += PdfViewer_HyperlinkClicked;
private void PdfViewer_HyperlinkClicked(object sender, Syncfusion.Windows.PdfViewer.HyperlinkClickedEventArgs e) { e.Handled = true; } |
Thank you, Manigandan. I will try to fix it using the method you provided.
Most welcome, please try and let us know if you need any assistance.