Skip to main content
Participant
January 21, 2025
Answered

Copying Field Accessibility Information

  • January 21, 2025
  • 2 replies
  • 434 views

I wrote a script to rename fields by creating new fields and deleting the old one, but I am having a problem with the accessibility on the fields. Before I run the script the reader reads what is in the tooltip just fine, but after it is not read. It might be that the field is just not tagged? Is there a way I can copy the tag or retag it?

 

Here is the section of my code that copies all the properties of the old field to the new field.

 

var propertiesToCopy = [
        "value", "borderStyle", "strokeColor", "lineWidth", "rotation", "fillColor", "userName",
        "readonly", "doNotScroll", "display", "textFont", "textColor", "textSize", "richText",
        "richValue", "comb", "multiline", "charLimit", "fileSelect", "password", "alignment",
        "buttonAlignX", "buttonAlignY", "buttonFitBounds", "buttonScaleHow", "buttonScaleWhen",
        "highlight", "style", "numItems", "editable", "multipleSelection"
    ];

    propertiesToCopy.forEach(function (prop) {
        try {
            if (prop in oldField) {
                newField[prop] = oldField[prop];
            }
        } catch (e) {
            // Suppress expected errors
        }
    });
Correct answer try67

You will lose all tags associated with the fields in this process. JS has no way to read or write them.

2 replies

JR Boulay
Community Expert
Community Expert
February 8, 2025

[MOVED TO THE ACROBAT DISCUSSIONS]

Acrobate du PDF, InDesigner et Photoshopographe
try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
January 21, 2025

You will lose all tags associated with the fields in this process. JS has no way to read or write them.