Uniquely identifying each user

Hi.  I am using the server side Blazor PDF Viewer.  Multiple users access the same document which is loaded from a memory stream.  In order to save/restore a unique set of annotations for each user, I need a uniqueId for each user.  After some experimenting, it seems that Load() and ImportAnnotations() both provide "uniqueId" in jsonObject.  However, ExportAnnotations() does not.  "hashId" seems to be unique to the particular document loaded from memory stream.  Is "elementId" unique to each user (browser)?

I am thinking that you should add "uniqueId" to jsonObject in ExportAnnotations().  I could work around this for now if "elementId" is unique to each user.  Is that the case?

Your thoughts?

Regards,

Arthur


5 Replies

DM Dhivyabharathi Mohan Syncfusion Team December 17, 2021 07:59 AM UTC

Hi Arthur, 
 
Syncfusion PDF Viewer will generate the unique hash id for each document using the MD5 algorithm based on the document contents. The hash id will be unique for each document. If we load the same document without any changes, then the same hash id will be generated. The hash id will differ once, we modify the original document. And the elementId is not unique for each document. It defines the id of the PDF Viewer component. And there is no possibility to set unique id for each user. However, you can change the author for each the annotations based on the user and the annotations are having its uniqueId. You can achieve this as a workaround solution using the author property of the annotations. Based on the author’s name, you can perform the export annotation actions. Please revert to us, if you need further assistance. 
 
Regards, 
Dhivya. 



AB Arthur Butler December 17, 2021 08:38 AM UTC

Thank you.  I want each user to have a separate set of annotations and not be able to see the other user's annotations.  There are three variables here.  Please correct me if my understanding is wrong,

hashId => unique for each document

uniqueId => unique value generated each time Load() is called, but is the same in future calls to ImportAnnotations

elementId => id of the PDF Viewer component


It would be helpful if uniqueId was also available in ExportAnnotations.  Here is how I am currently keeping track of a user in my app:


  1. In the Blazor app, I set DocumentPath to be the filename and the user_id, e.g. test.pdf|1234
  2. In the server app, in Load(), I extract the user_id from the path, save this in a dictionary with the lookup value of uniqueId, then load the file into a memory stream.
  3. In ImportAnnotations, I use uniqueId to find the user_id.  Then, I load the user and document specific annotations from the database.  Because uniqueId is not provided in ExportAnnotations, I also add user_id to the dictionary with the lookup value of elementId
  4. In ExportAnnotations, I use elementId to find the user_id.  Then I save the user and document specific annotations to the database.
This seems to work okay.

Regards,

Arthur






DM Dhivyabharathi Mohan Syncfusion Team December 20, 2021 09:25 AM UTC

Hi Arthur, 
 
Currently we do not have support to pass the uniqueId property in the exportAnnotation method. We will check and provide the further details on December 22, 2021. 
 
Regards, 
Dhivya. 



DM Dhivyabharathi Mohan Syncfusion Team December 22, 2021 12:11 PM UTC

Hi Arthur, 
 
We have logged this as a feature to pass the unique Id property in the JSON Object of the exportAnnotation server web action method and the feature implementation will be included in our upcoming weekly NuGet release on January 12, 2022. You can track the status using the below feedback link, 
 
 
 
Regards, 
Dhivya. 



DM Dhivyabharathi Mohan Syncfusion Team January 12, 2022 01:17 PM UTC

Hi Arthur, 
  
The feature implementation was included in our latest weekly NuGet release v19.4.0.42. Kindly upgrade to that version to get the feature available. 

 
Packages:     


 


 
Regards, 
Dhivya. 


Loader.
Up arrow icon