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

**URL:** <https://pdfjs.community/t/old-data-to-be-extract-from-xfdf-file-and-to-store-in-firebase-real-time-collaboration/1184>\
**Category:** Technical Support\
**Created:** [November 17, 2021, 5:20pm UTC](https://pdfjs.community/t/old-data-to-be-extract-from-xfdf-file-and-to-store-in-firebase-real-time-collaboration/1184 "2021-11-17T17:20:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jatin.zwt](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@jatin.zwt](https://pdfjs.community/u/jatin.zwt)\
**Post date:** [November 17, 2021, 5:20pm UTC](https://pdfjs.community/t/old-data-to-be-extract-from-xfdf-file-and-to-store-in-firebase-real-time-collaboration/1184/1 "2021-11-17T17:20:23Z")

</div>

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.

> **[PDF.js Express Utility API | Documentation](https://pdfjs.express/documentation/utils)**

Now we want to use collaboration/realtime-collaboration. [PDF.js Express Real-Time Collaboration | Documentation](https://pdfjs.express/documentation/collaboration/overview)

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/1X/ffbcd25c7d423db8d5acd5db201c272f4db306dd.png) [@system](https://pdfjs.community/u/system)\
**Post date:** [November 17, 2021, 5:20pm UTC](https://pdfjs.community/t/old-data-to-be-extract-from-xfdf-file-and-to-store-in-firebase-real-time-collaboration/1184/3 "2021-11-17T17:20:29Z")

</div>

**Hello, I’m Ron, an automated tech support bot 🤖**

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

Guides:
- [Best practices for PDF.js Express - Store annotations](https://pdfjs.express/documentation/learn-more/best-practices#store-annotations)
- [XFDF format - In PDF.js Express Web Viewer](https://pdfjs.express/documentation/annotation/xfdf#in-pdf.js-express-web-viewer)
- [API for Real-time Collaboration With PDF.js Express](https://pdfjs.express/documentation/collaboration/api)

APIs:
- [PDF.js Express Utilities](https://pdfjs.express/api/utils/index.html#__anchor)
- [Core.DocumentViewer - setDocumentXFDFRetriever(retriever)](https://pdfjs.express/api/Core.DocumentViewer.html#setDocumentXFDFRetriever__anchor)
- [Core.Annotations.RedactionAnnotation - new RedactionAnnotation( [options])](https://pdfjs.express/api/Core.Annotations.RedactionAnnotation.html#RedactionAnnotation__anchor)

Forums:
- [Store annotation data from xfdf file to real time collaboration](https://pdfjs.community/t/store-annotation-data-from-xfdf-file-to-real-time-collaboration/1181/1)
- [Extracting and annotations](https://pdfjs.community/t/extracting-and-annotations/297/1)
- [Failed xfdf downloading](https://pdfjs.community/t/failed-xfdf-downloading/1174/1)

---

<div class="post-metadata">

**Author:** ![jatin.zwt](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@jatin.zwt](https://pdfjs.community/u/jatin.zwt)\
**Post date:** [November 18, 2021, 6:38pm UTC](https://pdfjs.community/t/old-data-to-be-extract-from-xfdf-file-and-to-store-in-firebase-real-time-collaboration/1184/4 "2021-11-18T18:38:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Logan](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/logan/32/13_2.png) [@Logan](https://pdfjs.community/u/Logan)\
**Post date:** [November 22, 2021, 8:38pm UTC](https://pdfjs.community/t/old-data-to-be-extract-from-xfdf-file-and-to-store-in-firebase-real-time-collaboration/1184/5 "2021-11-22T20:38:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jatin.zwt](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@jatin.zwt](https://pdfjs.community/u/jatin.zwt)\
**Post date:** [November 23, 2021, 5:25pm UTC](https://pdfjs.community/t/old-data-to-be-extract-from-xfdf-file-and-to-store-in-firebase-real-time-collaboration/1184/6 "2021-11-23T17:25:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jatin.zwt](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@jatin.zwt](https://pdfjs.community/u/jatin.zwt)\
**Post date:** [November 28, 2021, 5:14pm UTC](https://pdfjs.community/t/old-data-to-be-extract-from-xfdf-file-and-to-store-in-firebase-real-time-collaboration/1184/7 "2021-11-28T17:14:21Z")

</div>

Do we have any solution?

---

<div class="post-metadata">

**Author:** ![jatin.zwt](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@jatin.zwt](https://pdfjs.community/u/jatin.zwt)\
**Post date:** [December 7, 2021, 4:19pm UTC](https://pdfjs.community/t/old-data-to-be-extract-from-xfdf-file-and-to-store-in-firebase-real-time-collaboration/1184/8 "2021-12-07T16:19:32Z")

</div>

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