XFDF too big, lenght exceeded

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}

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:

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

Hello suporte,

We have a section on this at the bottom of this page: PDF.js Express API Errors | Documentation

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

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

wilson.pdf (4.0 MB)

Hello guys, any news on this matter?

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

Hello Tyler, yes.

link follows:

https://api.dattasign.com.br/api/file_view

Thanks

Hello

Any news about this matter?

Thanks

Hello suporte,

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

 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

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:

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

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 (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