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>