Old data to be extract from XFDF file and to store in firebase | Real Time Collaboration

We use license version of pdfjs express plus - 8.0.1

Before few’s month we have saved annotation at server side by file name pdf_file_name.xfdf and load/updated as needed in pdf_file_name.pdf.

Now we want to use collaboration/realtime-collaboration. PDF.js Express Real-Time Collaboration | Documentation

So we want to store our old annotation data from pdf_file_name.xfdf to firebase(By using pdf js collaboration).

We want our old data to be extract from XFDF file and to store in firebase/realtimedatabase

Please reply and don’t close this

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

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.

Hi there,

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.

Logan

Hey there,

Thanks for your response.

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.

Let me know if you still have any doubt.

Thanks

Do we have any solution?

Please let me know any solution for above comments, I would like to know can we convert XFDf annotation to google fierbase db annotation ?