Retrieving annotation through API

Hello All, 

I want to add annotation (rectangle , freeText,  stamp) programmatically using angular code. I have all the annotation data (bounds , type , color, pageIndex)


Thanks,
Mohamed

5 Replies 1 reply marked as answer

AA Akshaya Arivoli Syncfusion Team June 19, 2020 07:14 AM UTC

Hi Mohamed, 

Thank you for contacting Syncfusion support. 

We can add the annotations programmatically using the importAnnotations () API available in PDF Viewer. We have also shared the sample for the same in the below link, 


Please try and if the provided detail does not meet your requirement, revert us with more details about your requirement and the use case. These details will be helpful for us to investigate further and assist you better. 

Regards, 
Akshaya  


Marked as answer

MO Mohamed June 20, 2020 01:53 AM UTC

Hello Akshaya, 
I tried the proposed solution and it;s working on this sample data. But when I try to add my data to it it doesn't work (it gives me this error "
Imported JSON file is not found in the desired location") , So I have a question here , The bounds you provided here are the same bound that I get on annotationAdded event or the exported annotations ? 

Thanks,
Mohamed


AA Akshaya Arivoli Syncfusion Team June 22, 2020 12:53 PM UTC

Hi Mohamed, 

Thank you for your update. 


The  bounds obtained from the annotationAdd event of the PDF Viewer and the bounds obtained in the exportAnnoation() JSON will be the same. We can directly import the exported JSON object. Also the reported error “Imported JSON file is not found in the desired location” will be occurred when the JSON file provided in the importAnnotations() is not available in the mentioned location. Please ensure the bounds of the annotation and the location of the JSON file. 

If you still have concerns, please revert us with the modified sample and more details about your issue. These details will be helpful for us to investigate further and assist you better. 


Regards, 
Akshaya  



SR Sriraman January 4, 2023 05:28 PM UTC

Is there any solution to import the annotations json data now? It seems importAnnotations method is no longer available.



CK Chinnamunia Karthik Chinna Thambi Syncfusion Team January 5, 2023 02:20 PM UTC

Yes, you can import annotations from a JSON file. Kindly find the documentation for it below.


UG Documentation - https://ej2.syncfusion.com/javascript/documentation/pdfviewer/how-to/import-export-annotation-objects/


Kindly try and revert to us if you have any queries.


Loader.
Up arrow icon