Iterate over all fields in PDF using JavaScript

I would like to change some properties for all fields in the PDF form in response to a user click a button.

What property or method will return a collection of fields to me so I can iterate over them?

+3
source share
1 answer

If there is a set of fields, I still haven't found it. There is a way to iterate over all fields.

The numFieldsproperty of the doc object sets the number of fields, returns the name of the field with this index, and getField ( fieldName ) returns the field of this name.getNthFieldName(index)

for (var fieldNumber = 0; fieldNumber < numFields; fieldNumber ++)
{
  getField(getNthFieldName(fieldNumber)).value = 'Scripty Was Here';
}
+7
source

Source: https://habr.com/ru/post/1762498/


All Articles