Unable to Import Annotations

I am working on a project where annotations need to be imported and exported. I am able to export the annotations just fine like this:

        using var stream = await pdfViewer.ExportAnnotationAsStream();
        using var sr = new StreamReader(stream);

        selectedAnnotation.Json = sr.ReadToEnd();

However, when I import them, nothing happens. I don't see any errors and the rendered document stays the same. Here is my code for importing:

            using var ms = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(selectedAnnotation.Json));
            await pdfViewer.ImportAnnotation(ms);

The example provided in the documentation uses a string to load a network resource. How should I be importing? 

Thank you,

John

3 Replies 1 reply marked as answer

DM Dhivyabharathi Mohan Syncfusion Team February 22, 2021 12:39 PM UTC

Hi John, 
 
We were unable to reproduce the reported issue. We have shared the sample in which we tried to replicate the reported issue.  
 
Sample: 
 
Kindly try it and revert us with sample in which you are facing issue. It will be helpful for us to investigate further and provide details. 
 
Regards, 
Dhivya. 



JO John February 22, 2021 08:39 PM UTC

You are right. The annotations were loading; however they didn't seem to appear because the previous annotation was still there. By using await PDFViewer.DeleteAnnotations(); I was able to clear those.

Thank you,

John

Marked as answer

DM Dhivyabharathi Mohan Syncfusion Team February 23, 2021 08:58 AM UTC

Hi John, 
   
Thank you for your update. We are glad to know that the reported issue is resolved. 

Regards, 
Dhivya. 


Loader.
Up arrow icon