# Error when loading xfdf annotations

**URL:** <https://pdfjs.community/t/error-when-loading-xfdf-annotations/1380>\
**Category:** Technical Support\
**Created:** [February 14, 2022, 6:22pm UTC](https://pdfjs.community/t/error-when-loading-xfdf-annotations/1380 "2022-02-14T18:22:59Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![mpho](https://avatars.discourse-cdn.com/v4/letter/m/47e85d/32.png) [@mpho](https://pdfjs.community/u/mpho)\
**Post date:** [February 14, 2022, 6:22pm UTC](https://pdfjs.community/t/error-when-loading-xfdf-annotations/1380/1 "2022-02-14T18:22:59Z")

</div>

**Which product are you using?**  
PDF.js Express

**PDF.js Express Version**  
8.2.0

**Detailed description of issue**  
Receiving the following error when trying to load annotations using the annotationManager.importAnnotations function:  
Uncaught (in promise) TypeError: fa.getElementsByTagName is not a function  
at x.P\_ (webviewer-core.min.js:2413:431)  
at x.WW (webviewer-core.min.js:2416:203)  
at webviewer-core.min.js:419:260  
at new Promise ()  
at qa.FQ (webviewer-core.min.js:419:197)  
at a. (view-document.php?did=175&mid=97 &id=243&hide=true:597:43)  
at webviewer-core.min.js:609:402  
at Array.forEach ()  
at a.h.trigger (webviewer-core.min.js:609:338)  
at a.Ha.JQ (webviewer-core.min.js:296:191)

**Expected behaviour**  
Annotations to be loaded successfully on the PDF

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

**Link to document**  
Using a local document to test

**Code snippet**  
docViewer.addEventListener(‘documentLoaded’, async () =\> {  
annotationManager.importAnnotations(loadXfdfString(userId, documentId));  
});

const loadXfdfString = function(userId, documentId) {  
return new Promise(function(resolve) {  
fetch(`../core/annotations-load.php?userId=${userId}&documentId=${documentId}`, {  
method: ‘GET’  
}).then(function(res) {  
if (res.status === 200) {  
res.text().then(function(xfdfString) {  
resolve(xfdfString);  
})  
} else{  
alert(‘Failed to load the XFDF file…’);  
}  
});  
});  
};

---

_[View the full topic](https://pdfjs.community/t/error-when-loading-xfdf-annotations/1380)._
