# XFDF too big, lenght exceeded

**URL:** <https://pdfjs.community/t/xfdf-too-big-lenght-exceeded/1962>\
**Category:** Technical Support\
**Created:** [August 18, 2022, 1:24pm UTC](https://pdfjs.community/t/xfdf-too-big-lenght-exceeded/1962 "2022-08-18T13:24:04Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![suporte](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@suporte](https://pdfjs.community/u/suporte)\
**Post date:** [August 18, 2022, 1:24pm UTC](https://pdfjs.community/t/xfdf-too-big-lenght-exceeded/1962/1 "2022-08-18T13:24:04Z")

</div>

Hello, pdfjsexpress is returning this

HTTP content length exceeded 10485760 bytes.

What can we do to improve that?

Thanks

**Which product are you using?**

**PDF.js Express Version**

**Detailed description of issue**  
{Description here}

**Expected behaviour**  
{Provide a screenshot or description of the expected behaviour}

**Does your issue happen with every document, or just one?**  
{Answer here}

**Link to document**  
{Provide a link to the document in question if possible}

**Code snippet**  
{Provide a relevant code snippet}

---

<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:** [August 18, 2022, 1:24pm UTC](https://pdfjs.community/t/xfdf-too-big-lenght-exceeded/1962/3 "2022-08-18T13:24:09Z")

</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:
- [Merge & extract annotation in PDF.js Express - Getting started](https://pdfjs.express/documentation/annotation/merge-and-extract#getting-started)
- [Extract XFDF using the Express REST API - Response body (success)](https://pdfjs.express/documentation/utils/extract#response-body-(success))
- [XFDF format - In PDF.js Express Web Viewer](https://pdfjs.express/documentation/annotation/xfdf#in-pdf.js-express-web-viewer)

APIs:
- [Core.Math.Rect - exportNormalize()](https://pdfjs.express/api/Core.Math.Rect.html#exportNormalize__anchor)
- [ExternalAnnotationMerger - getTransformFunction()](https://pdfjs.express/api/7.0/ExternalAnnotationMerger.html#getTransformFunction__anchor)
- [Core.Annotations.CustomAnnotation - new CustomAnnotation(type [, initializer])](https://pdfjs.express/api/Core.Annotations.CustomAnnotation.html#CustomAnnotation__anchor)

Forums:
- [Merging XFDF using the Express REST API length exceeded error](https://pdfjs.community/t/merging-xfdf-using-the-express-rest-api-length-exceeded-error/185/6)
- [Error 504 trying to merge xfdf - Urgent](https://pdfjs.community/t/error-504-trying-to-merge-xfdf-urgent/1691/1)
- [Merging XFDF using the Express REST API using URL](https://pdfjs.community/t/merging-xfdf-using-the-express-rest-api-using-url/207/1)

  
  

Share how you are using PDF.js Express in your organization you could win a **$500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free**. Learn more [here](https://utm.guru/ueQNw)

---

<div class="post-metadata">

**Author:** ![tgordon](https://avatars.discourse-cdn.com/v4/letter/t/aca169/32.png) [@tgordon](https://pdfjs.community/u/tgordon)\
**Post date:** [August 18, 2022, 5:41pm UTC](https://pdfjs.community/t/xfdf-too-big-lenght-exceeded/1962/4 "2022-08-18T17:41:44Z")

</div>

Hello suporte,

We have a section on this at the bottom of this page: [PDF.js Express API Errors | Documentation](https://pdfjs.express/documentation/utils/errors)

Best regards,  
Tyler Gordon  
Web Development Support Engineer  
PDFTron

Share how you are using PDF.js Express in your organization you could win a **$500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free**. Learn more [here](https://utm.guru/ueQNw)

---

<div class="post-metadata">

**Author:** ![suporte](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@suporte](https://pdfjs.community/u/suporte)\
**Post date:** [August 18, 2022, 6:08pm UTC](https://pdfjs.community/t/xfdf-too-big-lenght-exceeded/1962/5 "2022-08-18T18:08:29Z")

</div>

Hello @tgordon, thanks for the reply.

We are already sending the url address within the PDF.

im attaching here the PDF file and a print of our code.

Also on this google drive link you can find .txt xfdf

> **[teste.txt](https://drive.google.com/file/d/1nWYLRMJJ-WrL4PEjqHoS72go5M47y3Lf/view?usp=sharing)**
>
> Google Drive file.

[wilson.pdf](https://pdfjs.community/uploads/short-url/qk6tapsuKK8X6K4VwkYHWJdJ0V9.pdf) (4.0 MB)

 ![code](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/1X/e5e672138b7b894fe0e2837aba01ca03a1976a82.png)

---

<div class="post-metadata">

**Author:** ![suporte](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@suporte](https://pdfjs.community/u/suporte)\
**Post date:** [August 22, 2022, 12:19pm UTC](https://pdfjs.community/t/xfdf-too-big-lenght-exceeded/1962/6 "2022-08-22T12:19:57Z")

</div>

Hello guys, any news on this matter?

---

<div class="post-metadata">

**Author:** ![tgordon](https://avatars.discourse-cdn.com/v4/letter/t/aca169/32.png) [@tgordon](https://pdfjs.community/u/tgordon)\
**Post date:** [August 23, 2022, 5:38pm UTC](https://pdfjs.community/t/xfdf-too-big-lenght-exceeded/1962/7 "2022-08-23T17:38:03Z")

</div>

Hello suporte,

Can you provide the URL you are using for this document?

Best regards,  
Tyler Gordon  
Web Development Support Engineer  
PDFTron

Share how you are using PDF.js Express in your organization you could win a **$500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free**. Learn more [here](https://utm.guru/ueQNw)

---

<div class="post-metadata">

**Author:** ![suporte](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@suporte](https://pdfjs.community/u/suporte)\
**Post date:** [August 24, 2022, 2:49pm UTC](https://pdfjs.community/t/xfdf-too-big-lenght-exceeded/1962/8 "2022-08-24T14:49:53Z")

</div>

Hello Tyler, yes.

link follows:

[https://api.dattasign.com.br/api/file\_view](https://api.dattasign.com.br/api/file_view)

Thanks

---

<div class="post-metadata">

**Author:** ![suporte](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@suporte](https://pdfjs.community/u/suporte)\
**Post date:** [August 31, 2022, 7:26pm UTC](https://pdfjs.community/t/xfdf-too-big-lenght-exceeded/1962/9 "2022-08-31T19:26:09Z")

</div>

Hello

Any news about this matter?

Thanks

---

<div class="post-metadata">

**Author:** ![tgordon](https://avatars.discourse-cdn.com/v4/letter/t/aca169/32.png) [@tgordon](https://pdfjs.community/u/tgordon)\
**Post date:** [September 6, 2022, 11:42pm UTC](https://pdfjs.community/t/xfdf-too-big-lenght-exceeded/1962/10 "2022-09-06T23:42:07Z")

</div>

Hello suporte,

Apologies for the delay. I was able to get it working with this code:

```javascript
 data.append('xfdf', xfdf);
    await fetch('https://api.dattasign.com.br/api/file_view').then( async (resp) => {
      data.append('file', await resp.blob())
      const response = await fetch('https://api.pdfjs.express/xfdf/merge',
        {
          method: 'post',
          body: data
        }).then(resp => resp.json());
  
      const { url, key, id } = response;

```

After converting the response to a blob it worked.

Best regards,  
Tyler Gordon  
Web Development Support Engineer  
PDFTron

Share how you are using PDF.js Express in your organization you could win a **$500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free**. Learn more [here](https://utm.guru/ueQNw)

---

<div class="post-metadata">

**Author:** ![suporte](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@suporte](https://pdfjs.community/u/suporte)\
**Post date:** [September 8, 2022, 2:06pm UTC](https://pdfjs.community/t/xfdf-too-big-lenght-exceeded/1962/11 "2022-09-08T14:06:17Z")

</div>

Hello @tgordon,

We did test this solution, but did not work.

The problem isnt the File, **the problem is the XFDF is larger than the size that HTTP allows**

XFDF follows:

> **[teste.txt](https://drive.google.com/file/d/1nWYLRMJJ-WrL4PEjqHoS72go5M47y3Lf/view)**
>
> Google Drive file.

---

<div class="post-metadata">

**Author:** ![suporte](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@suporte](https://pdfjs.community/u/suporte)\
**Post date:** [September 15, 2022, 4:54pm UTC](https://pdfjs.community/t/xfdf-too-big-lenght-exceeded/1962/12 "2022-09-15T16:54:22Z")

</div>

@tgordon Hello mate, sorry for disturbing, any news about this?

---

<div class="post-metadata">

**Author:** ![tgordon](https://avatars.discourse-cdn.com/v4/letter/t/aca169/32.png) [@tgordon](https://pdfjs.community/u/tgordon)\
**Post date:** [September 15, 2022, 10:02pm UTC](https://pdfjs.community/t/xfdf-too-big-lenght-exceeded/1962/13 "2022-09-15T22:02:06Z")

</div>

Hello suporte,

Apologies for the late reply, we have been experimenting to see if we could get this large XFDF to merge in the API. I think the limitation of the HTTP size results in this merge to be impossible. I tried posting the XFDF to a secret GitHub gist and fetching it, then fetching the file, then putting those blobs into the merge API however it still resulted in a 413 error.

I think the workaround here would be to export the annotations in chunks, say you have 10000 annotations, you would export 1000 at a time, then make multiple calls to merge them.

I have attached the code I have been testing with, that includes the XFDF GitHub gist link  
[index 2.js.zip](https://pdfjs.community/uploads/short-url/xt3CMrpOGJjPk5fYq430nk2Ae1Y.zip) (1.1 KB)

Best regards,  
Tyler Gordon  
Web Development Support Engineer  
PDFTron

Share how you are using PDF.js Express in your organization you could win a **$500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free**. Learn more [here](https://utm.guru/ueQNw)

---

<div class="post-metadata">

**Author:** ![vicente](https://avatars.discourse-cdn.com/v4/letter/v/858c86/32.png) [@vicente](https://pdfjs.community/u/vicente)\
**Post date:** [October 29, 2022, 3:03am UTC](https://pdfjs.community/t/xfdf-too-big-lenght-exceeded/1962/14 "2022-10-29T03:03:08Z")

</div>

Hello, @tgordon!

You PDF.js Express team could do for xfdf as you already do for the file process. For example, for xfdf larger than 5.5mb, it would send the xfdf via URL.

What do you think of this update?

Best regards,  
Vicente!

---

<div class="post-metadata">

**Author:** ![tgordon](https://avatars.discourse-cdn.com/v4/letter/t/aca169/32.png) [@tgordon](https://pdfjs.community/u/tgordon)\
**Post date:** [November 2, 2022, 11:41pm UTC](https://pdfjs.community/t/xfdf-too-big-lenght-exceeded/1962/15 "2022-11-02T23:41:54Z")

</div>

Hello vicente,

We don’t currently have this on our roadmap but we will add it to the backlog for our product team to review.

Best regards,  
Tyler Gordon  
Web Development Support Engineer  
PDFTron

Share how you are using PDF.js Express in your organization you could win a **$500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free**. Learn more [here](https://utm.guru/ueQNw)
