# Confirm output of trial form field merger

**URL:** <https://pdfjs.community/t/confirm-output-of-trial-form-field-merger/744>\
**Category:** Technical Support\
**Created:** [May 2, 2021, 2:34am UTC](https://pdfjs.community/t/confirm-output-of-trial-form-field-merger/744 "2021-05-02T02:34:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![scottkemperman](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@scottkemperman](https://pdfjs.community/u/scottkemperman)\
**Post date:** [May 2, 2021, 2:34am UTC](https://pdfjs.community/t/confirm-output-of-trial-form-field-merger/744/1 "2021-05-02T02:34:58Z")

</div>

**7.3.2**

**Detailed description of issue**  
I just want to quickly confirm that the file being generated by the REST merge API for me is mangling the form fields because it’s a trial version, and not just an issue with my usage or the way my PDF forms are working. Basically the merger works great for annotations and inserted stamps / signatures, but for the form fields that I have populated they appear to pasted on the merged file twice and look terrible. I tried putting fields: false for the options to exportAnnotations, but then the default values were in the form locations rather than the new values… See image below what

**Expected behaviour**

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

**Does your issue happen with every document, or just one?**  
Every document done with the forms filled in.

**Link to document**  
See above image

**Code snippet**  
const xfdfString = await viewer.annotManager.exportAnnotations({ links: false, widgets: false });  
pdfUtils.setFile(await viewer.docViewer.getDocument().getFileData()).setXFDF(xfdfString);  
const response = await pdfUtils.merge();  
const mergedFile = await response.getBlob();  
await response.deleteFile();

Thank you, I believe this will be a quick answer.

Scott

---

<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:** [May 2, 2021, 2:35am UTC](https://pdfjs.community/t/confirm-output-of-trial-form-field-merger/744/2 "2021-05-02T02:35:03Z")

</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:
- [Set XFDF using the Express REST API - Body params](https://pdfjs.express/documentation/utils/set#body-params)
- [Merge & extract annotation in PDF.js Express - Getting started](https://pdfjs.express/documentation/annotation/merge-and-extract#getting-started)
- [Advanced customization - Sync the fork](https://pdfjs.express/documentation/ui-customization/advanced-customization#sync-the-fork)

APIs:
- [PDF.js Express Utilities](https://pdfjs.express/api/utils/index.html#__anchor)
- [PartRetrievers.ExternalPdfPartRetriever](https://pdfjs.express/api/PartRetrievers.ExternalPdfPartRetriever.html#__anchor)
- [ExpressUtils(optionsopt) - # async merge() → {Promise.}](https://pdfjs.express/api/utils/ExpressUtils.html#merge__anchor)

Forums:
- [Save annotation, checkbox in a form](https://pdfjs.community/t/save-annotation-checkbox-in-a-form/685/1)
- [Merge Rest API - how to flatten PDF?](https://pdfjs.community/t/merge-rest-api-how-to-flatten-pdf/328/1)
- [Internal server error](https://pdfjs.community/t/internal-server-error/113/1)

---

<div class="post-metadata">

**Author:** ![scottkemperman](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@scottkemperman](https://pdfjs.community/u/scottkemperman)\
**Post date:** [May 2, 2021, 2:36am UTC](https://pdfjs.community/t/confirm-output-of-trial-form-field-merger/744/3 "2021-05-02T02:36:38Z")

</div>

I should also add that when viewed in the WebViewer component before the merge / download is performed, the PDF form fields look as expected:

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

---

<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:** [May 4, 2021, 2:36pm UTC](https://pdfjs.community/t/confirm-output-of-trial-form-field-merger/744/4 "2021-05-04T14:36:12Z")

</div>

Hey there,

How are you loading the document after you merge the annotations? This is not expected behaviour and it looks like the annotations are being loaded twice. Can you please share a code snippet showing what you do with the document after you get `mergedFile`?

Thanks!  
Logan

---

<div class="post-metadata">

**Author:** ![scottkemperman](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@scottkemperman](https://pdfjs.community/u/scottkemperman)\
**Post date:** [May 4, 2021, 4:45pm UTC](https://pdfjs.community/t/confirm-output-of-trial-form-field-merger/744/5 "2021-05-04T16:45:07Z")

</div>

Thanks for the feedback, after fiddling further with the merge / set / export /import for the xfdf data the double loading seems to have dissappeared. However, it’s still a bit frustrating trying to debug my code (building a POC with the trial before can get approved to purchase) for the annotation / form fields because I don’t know what falls under the ‘mangled’ according to the documentation for trial version, vs just a mistake in my code or incorrect understanding of the data - is there a list somewhere of what differences between the trial output of the REST API and the complete version (ie. description of ‘mangled’)?

For example, right now the custom text annotation I added is sometimes displayed with various colored backgrounds, sometimes without, and it seems to be at random for me, without changing the file data?

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

That’s one with the colored background, after reloading my page which only triggers a document reload (no saving, the file data is the same), it looks normal again, with no background color.

Any thoughts on this?

Scott

---

<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:** [June 4, 2021, 5:05pm UTC](https://pdfjs.community/t/confirm-output-of-trial-form-field-merger/744/6 "2021-06-04T17:05:12Z")

</div>

Hi there,

The “mangled” xfdf randomly changes colors of random annotations which is why you are seeing this.

Rest assured that using a real license key will not change colors of annots.

Thanks!  
Logan
