Form fields filled multiple times when annotations are loaded causing text overlays

WebViewer Version: 11.6.1

Do you have an issue with a specific file(s)? No. Happens on any file with form fields.
Can you reproduce using one of our samples or online demos? No.
Are you using the WebViewer server? No.
Does the issue only happen on certain browsers? Happens in Chrome and Edge.
Is your issue related to a front-end framework? No.
Is your issue related to annotations? Yes.

Please give a brief summary of your issue:
After filling form fields and refreshing the page, the fields are filled with extra annotations causing text to be static and uneditable.

Please describe your issue and provide steps to reproduce it:
I created a PDF using IronPDF’s library in C#. The document has a few form fields on it. Some have default text, and some do not. After loading the PDF into the Apryse WebViewer I am able to fill out the document and modify the default text in the fields. Annotations are saved automatically when filling out the form. When I reload the page the form fields have the correct values, but it looks like the annotations are loading multiple times. When I modify a form field it looks like I am editing one annotation, but another annotation is overlaid on the field and is not editable.

Please provide a link to a minimal sample where the issue is reproducible:
Video of the issue is available here:

In the video the PDF is freshly created. There are no annotations yet. The years field defaults to 1, and the date field defaults to today’s date. I change the years to 9, write Test in the print name field and click out of the field. Then I refresh the page to reload the PDF. The fields have the correct values, but when I modify the fields you can see the values are inserted to the document twice. I can edit one, but the other remains and overlays my new text.

Here is the relevant javascript for my webviewer loading process.

        instance.UI.setPrintQuality(3);
        instance.UI.addEventListener('loaderror', err => {
            showPopupError(JSTranslationManager.Error(), err.detail.message);
        });

        docViewer.setDocumentXFDFRetriever(async function () {
            console.log("Retrieving XFDF string");
            var xfdfString = await fileStorageMethods.getAnnotations(actionKeyJson);
            console.log("XFDF string: " + xfdfString);
            return xfdfString;
        });

        annotManager.setCurrentUser(userName);
        if (userName != "Anonymous") {
            annotManager.promoteUserToAdmin(userName)
        }
        if (isReadOnly === true) {
            annotManager.enableReadOnlyMode();
        } else {
            annotManager.disableReadOnlyMode();
        }

        // Load the document. 
        instance.UI.loadDocument(base64ToBlob(binaryData, 'application/pdf'), { filename: fileName })

        docViewer.addEventListener('documentLoaded', async function () {
            console.log("Document loaded");
        });

        const Annotations = instance.Core.Annotations;
        docViewer.addEventListener('annotationsLoaded', () => {
            console.log("Annotations loaded");

            // Confirm how many fields we see on the document to verify we do not have multiple of the same field. 
            const fieldManager = annotManager.getFieldManager();
            const fields = fieldManager.getFields();
            fields.forEach(function (field) {
                field.widgets.map(annot => {
                    console.log("Field: " + annot.fieldName + " has value " + annot.value);
                });
            });
        });

        annotManager.addEventListener('annotationChanged', (annotations, action, { imported }) => {
            console.log("Annotation changed");
            // Again check to see which fields are being loaded
            annotations.forEach(function (annot) {
                if (annot instanceof Annotations.WidgetAnnotation) {
                    console.log(annot.fieldName + " is set to " + annot.value + " and imported = " + imported + " and action = " + action);
                }
            });
            // If the event is triggered by importing then it can be ignored
            // This will happen when importing the initial annotations from the server or individual changes from other users
            if (imported) return;

            annotManager.exportAnnotations()
                .then(function (annotationXml) {
                    fileStorageMethods.saveAnnotation(actionKeyJson, fileRelationshipJson, annotationXml);
                });
        });

        annotManager.addEventListener('fieldChanged', (field, value) => {
            console.log("Field changed: " + field.name);
            annotManager.exportAnnotations()
                .then(function (annotationXml) {
                    fileStorageMethods.saveAnnotation(actionKeyJson, fileRelationshipJson, annotationXml);
                });
        });

Below is the console.log output from the browser during the webviewer loading process.

Build: "7/16/2025|0f5e67641"
Core version: "11.6.1"
Full API: true
UI: "default"
UI version: "11.6.1"
WebViewer Server: false
webviewer.min.js: "11.6.1"

Document loaded
Retrieving XFDF string
XFDF string: <?xml version="1.0" encoding="UTF-8" ?><xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve"><pdf-info xmlns="http://www.pdftron.com/pdfinfo" version="2" import-version="4"><ffield type="Tx" name="yearsField" /><ffield type="Tx" name="printNameField1" /><ffield type="Tx" name="dateField1" /><ffield type="Tx" name="emailField1" /><ffield type="Sig" name="sigField1" /><widget field="yearsField" name="f747ea5dd72db0c8-4eac97030e74ebdc" page="1"><rect x1="337.0923" x2="360.3775" y1="531.4691" y2="547.243" /></widget><widget index="-1" field="printNameField1" name="f747ea63d72db0ce-4eac96fd0e74ebd6" page="1"><rect x1="304.7935" x2="509.1024" y1="277.5853" y2="300.8705" /></widget><widget index="-1" field="dateField1" name="f747ea65d72db0d0-4eac96fb0e74ebd4" page="1"><rect x1="304.7935" x2="509.1024" y1="215.241" y2="238.5263" /><apref gennum="0" objnum="29" x="304.7935" y="238.5263" /></widget><widget field="emailField1" name="f747ea6fd72db0da-4eac96f10e74ebca" page="1"><rect x1="304.7935" x2="509.1024" y1="152.8968" y2="176.182" /></widget><widget field="sigField1" name="f747ea7dd72db0e8-4eac96e30e74ebbc" page="1"><rect x1="305.7198" x2="505.7198" y1="347.8721" y2="397.8721" /></widget><widget field="printNameField1" name="f747ea7fd72db0ea-4eac96e10e74ebba" page="1"><rect x1="304.7935" x2="509.1024" y1="277.5853" y2="300.8705" /></widget><widget field="dateField1" name="f747ea81d72db0ec-4eac96df0e74ebb8" page="1"><rect x1="304.7935" x2="509.1024" y1="215.241" y2="238.5263" /><apref gennum="0" objnum="57" x="304.7935" y="238.5263" /></widget></pdf-info><fields><field name="yearsField"><value>9</value></field><field name="printNameField1"><value>Test</value></field><field name="dateField1"><value>07/29/2025</value></field><field name="emailField1"><value></value></field><field name="sigField1"><value></value></field></fields><annots /><pages><defmtx matrix="1,0,0,-1,0,791.03998" /></pages></xfdf>
Annotation changed
yearsField is set to 9 and imported = true and action = add
printNameField1 is set to Test and imported = true and action = add
dateField1 is set to 07/29/2025 and imported = true and action = add
emailField1 is set to  and imported = true and action = add
sigField1 is set to  and imported = true and action = add
printNameField1 is set to Test and imported = true and action = add
dateField1 is set to 07/29/2025 and imported = true and action = add
yearsField is set to 9 and imported = true and action = add
printNameField1 is set to Test and imported = true and action = add
dateField1 is set to 07/29/2025 and imported = true and action = add
emailField1 is set to  and imported = true and action = add
sigField1 is set to  and imported = true and action = add
printNameField1 is set to Test and imported = true and action = add
dateField1 is set to 07/29/2025 and imported = true and action = add
Annotations loaded
Field: sigField1 has value 
Field: emailField1 has value 
Field: dateField1 has value 07/29/2025
Field: printNameField1 has value Test
Field: yearsField has value 9

And here is the XML of the annotations that were loaded into the webviewer.

<?xml version="1.0" encoding="UTF-8" ?>
<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve">
    <pdf-info xmlns="http://www.pdftron.com/pdfinfo" version="2" import-version="4">
        <ffield type="Tx" name="yearsField" />
        <ffield type="Tx" name="printNameField1" />
        <ffield type="Tx" name="dateField1" />
        <ffield type="Tx" name="emailField1" />
        <ffield type="Sig" name="sigField1" />
        <widget field="yearsField" name="f747ea5dd72db0c8-4eac97030e74ebdc" page="1">
            <rect x1="337.0923" x2="360.3775" y1="531.4691" y2="547.243" />
        </widget>
        <widget index="-1" field="printNameField1" name="f747ea63d72db0ce-4eac96fd0e74ebd6" page="1">
            <rect x1="304.7935" x2="509.1024" y1="277.5853" y2="300.8705" />
        </widget>
        <widget index="-1" field="dateField1" name="f747ea65d72db0d0-4eac96fb0e74ebd4" page="1">
            <rect x1="304.7935" x2="509.1024" y1="215.241" y2="238.5263" />
            <apref gennum="0" objnum="29" x="304.7935" y="238.5263" />
        </widget>
        <widget field="emailField1" name="f747ea6fd72db0da-4eac96f10e74ebca" page="1">
            <rect x1="304.7935" x2="509.1024" y1="152.8968" y2="176.182" />
        </widget>
        <widget field="sigField1" name="f747ea7dd72db0e8-4eac96e30e74ebbc" page="1">
            <rect x1="305.7198" x2="505.7198" y1="347.8721" y2="397.8721" />
        </widget>
        <widget field="printNameField1" name="f747ea7fd72db0ea-4eac96e10e74ebba" page="1">
            <rect x1="304.7935" x2="509.1024" y1="277.5853" y2="300.8705" />
        </widget>
        <widget field="dateField1" name="f747ea81d72db0ec-4eac96df0e74ebb8" page="1">
            <rect x1="304.7935" x2="509.1024" y1="215.241" y2="238.5263" />
            <apref gennum="0" objnum="57" x="304.7935" y="238.5263" />
        </widget>
    </pdf-info>
    <fields>
        <field name="yearsField">
            <value>9</value>
        </field>
        <field name="printNameField1">
            <value>Test</value>
        </field>
        <field name="dateField1">
            <value>07/29/2025</value>
        </field>
        <field name="emailField1">
            <value></value>
        </field>
        <field name="sigField1">
            <value></value>
        </field>
    </fields>
    <annots />
    <pages>
        <defmtx matrix="1,0,0,-1,0,791.03998" />
    </pages>
</xfdf>
1 Like

Hello, I’m AiRon, an automated tech support bot :robot:
While you wait for one of our customer support representatives, I can help you with your question.


It seems like you’re encountering an issue where form fields are being filled multiple times when annotations are loaded, causing text overlays. This is likely due to the annotations being imported multiple times or not being cleared properly before the document is reloaded.

Some things you can try:

  • Check if the XFDF data is being loaded multiple times. Ensure that the XFDF retrieval function is not being called more than once during the document load process.

  • Verify that the annotations are being cleared or reset before loading new annotations. You might want to use the clearAnnotations() method on the AnnotationManager before loading new annotations.

  • Ensure that the loadDocument call is not inadvertently causing multiple loads or retains old annotations.

  • Review your code to ensure that exportAnnotations() and importAnnotations() are used correctly and not causing duplicates.

  • Consider adding logging around your annotation import/export logic to track when and how often annotations are being processed.



Here are some resources that might help you:


Hopefully, this helps you solve your problem while you wait for a human to get back to you.

1 Like

Hello @edward.boudreaux,

Thank you for posting on our forum.

There may have been an issue with uploading the video file to our forum post, as I am unable to access and download the video file. Would you be able to upload it to a different file sharing service such as Google Drive or Sharepoint and we can take a closer look?

Additionally, to investigate further please provide the following:

  1. Example source input PDF used for testing
  2. Does this issue occur if you use importAnnotations() API rather than the setDocumentXFDFRetriever callback function?
  3. Network panel showing all failed network traffic
  4. Are you able to reproduce the issue on our showcase demo? https://showcase.apryse.com/
  5. WebViewer constructor with all options defined

Best Regards,
Jacob Romano Carlsen
Web Development Support Engineer
Apryse Software Inc.

1 Like

Thanks for your response. The video link probably expired.

I just heard back from Darian in Apryse support on the issue. They are able to recreate the problem, and will get back to me on a resolution soon. I will post their solution here once I receive it.

Here is a new link to the video in case anyone else is verifying whether they have a similar issue.

Regarding your questions, the issue occurs whether using either setDocumentXFDFRetriever or importAnnotations. I made a barebones webviewer initialization to verify that I’m not double loading the annotations myself. I still had the issue. I also verified that the field values were not embedded in the PDF directly. I only get the doubled text when the annotations load through WebViewer.

1 Like

Hello @edward.boudreaux,

Thank you for the update, we have confirmed that we are also tracking your issue on our Support Portal. We will be sure to provide an update on that ticket once we have finished investigating.

Best Regards,
Jacob Romano Carlsen
Web Development Support Engineer
Apryse Software Inc.

1 Like