Any hint, idea that we can implement this. Currently we are saving annotation in xfdf file and we want to move to realtime collaboration. We want our annotation data to store in realtime db.
I still am not sure what you are asking. How you implement real time collaboration is up to you and is out of scope of this support channel.
At a very high level, realtime collaboration generally works like this:
When a user creates/edits/deletes an annotation in the viewer, the XFDF for that annotation is sent to your server where it is stored in the database. At the same time, that XFDF is sent to any other connected users via WebSocket. There are many many libraries to help you handle this. For an easy implementation, we recommend using Firestore as it handles both data storage and websocket connections.
When a user loads a document, you import the all the XFDF’s for that document from your database and import them into the viewer.
We are having different challenge here right now. Currently we have implemented pdfjs library in our application with xfdf file storage on our server without using any kind of database which is working fine but not having live collaboration feature.
To have that live collaboration feature, we decided to move this functionality from xfdf to google firebase(Firestore) where all the annotations will be saved realtime and multiple users can work together on single document. We are able to achieve that functionality as well. but we are not sure that how can we move existing annoted files into google firebase because we are able to load xfdf annotations but they are getting saved to firebase until we move/add annotations to the file.
It means, we need to do some operations to get it saved to firebase. Due to this, we are not sure how we can save all annoted files into firebase using any api so that we can deploy use real time collaborated pdf features in production and deprecate old xfdf file saving approach.