# Multiple annotations inside one pdf is creating an incorrect xfdf object

**URL:** <https://pdfjs.community/t/multiple-annotations-inside-one-pdf-is-creating-an-incorrect-xfdf-object/1054>\
**Category:** Technical Support\
**Created:** [October 8, 2021, 12:58pm UTC](https://pdfjs.community/t/multiple-annotations-inside-one-pdf-is-creating-an-incorrect-xfdf-object/1054 "2021-10-08T12:58:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chats2790](https://avatars.discourse-cdn.com/v4/letter/c/34f0e0/32.png) [@chats2790](https://pdfjs.community/u/chats2790)\
**Post date:** [October 8, 2021, 12:58pm UTC](https://pdfjs.community/t/multiple-annotations-inside-one-pdf-is-creating-an-incorrect-xfdf-object/1054/1 "2021-10-08T12:58:03Z")

</div>

**PDF.js Express Version**  
8.1.0

**Detailed description of issue**  
If I create multiple rectangle annotations over a single pdf then only the first annotation is getting communicated . This was working fine in the previous version(7.3) . Do you think this can be an xfdf issue on your end. Please let me know your feedback on it.

**Expected behaviour**  
If I select more than one table and send xfdf info to server , all selected xfdf should have tag to it having the rect info.

**Does your issue happen with every document, or just one?**  
All documents have this issue.

**Link to document**  
[sample\_schedule-merged.pdf](https://pdfjs.community/uploads/short-url/krQeTsLFJ8ah2HlXAnvjdGIDwCv.pdf) (797.7 KB)

**Code snippet**  
annotManager.on(  
“annotationChanged”,  
(annotations, action, { imported }) =\> {  
if (imported) return;  
if (action === “add” || action === “modify”) {  
this.annotationProcessing = true;  
}  
annotManager.exportAnnotCommand().then((xfdfString) =\> {  
this.XFDFStr = xfdfString;  
this.xmlArr.push(xfdfString);  
this.newXfdf = this.xmlArr.join();  
// newXfdf is the object we are sending to the backend

```
      });
    }
  );
```

---

<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:** [October 8, 2021, 12:58pm UTC](https://pdfjs.community/t/multiple-annotations-inside-one-pdf-is-creating-an-incorrect-xfdf-object/1054/2 "2021-10-08T12:58:08Z")

</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:
- [Rich text](https://pdfjs.express/documentation/annotation/rich-text.8)
- [PDF.js Express Documentation - Annotation](https://pdfjs.express/documentation#annotation-<span-class='plus'></span>)
- [Merge & extract annotation in PDF.js Express - Getting started](https://pdfjs.express/documentation/annotation/merge-and-extract#getting-started)

APIs:
- [Core.Annotations.EllipseAnnotation - new EllipseAnnotation( [initializer])](https://pdfjs.express/api/Core.Annotations.EllipseAnnotation.html#EllipseAnnotation__anchor)
- [Core.Annotations.LineAnnotation - new LineAnnotation( [initializer])](https://pdfjs.express/api/Core.Annotations.LineAnnotation.html#LineAnnotation__anchor)
- [Core.Annotations.PolylineAnnotation - new PolylineAnnotation( [initializer])](https://pdfjs.express/api/Core.Annotations.PolylineAnnotation.html#PolylineAnnotation__anchor)

Forums:
- [How to merge signature annotation with PDF document](https://pdfjs.community/t/how-to-merge-signature-annotation-with-pdf-document/558/1)
- [Change xfdf object result into text highlight annotation on document load](https://pdfjs.community/t/change-xfdf-object-result-into-text-highlight-annotation-on-document-load/846/1)
- [Getting error log on loading a particular pdf](https://pdfjs.community/t/getting-error-log-on-loading-a-particular-pdf/564/1)

---

<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:** [October 12, 2021, 2:17pm UTC](https://pdfjs.community/t/multiple-annotations-inside-one-pdf-is-creating-an-incorrect-xfdf-object/1054/3 "2021-10-12T14:17:39Z")

</div>

Hey there,

You are using `exportAnnotCommand` which only exports new/changed annotations. We no not recommend using this function to export annotations, instead try `exportAnnotations`. We have a guide on this [here](https://pdfjs.express/documentation/annotation/import-export)

Let me know if switching to exportAnnotations works

Thanks!  
Logan
