最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Iterating over all fields in a PDF form with JavaScript - Stack Overflow

programmeradmin1浏览0评论

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

Which property or method will return me the collection of fields so that I can iterate over them?

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

Which property or method will return me the collection of fields so that I can iterate over them?

Share Improve this question asked Aug 31, 2010 at 17:10 BellBell 18.7k4 gold badges25 silver badges25 bronze badges 2
  • please put some code to be clear – Topera Commented Aug 31, 2010 at 17:24
  • I don't have any code, because I don't have anywhere to start from in the absence of a collection to iterate over. – Bell Commented Aug 31, 2010 at 17:38
Add a comment  | 

1 Answer 1

Reset to default 19

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

The numFields property of the doc object gives the number of fields, getNthFieldName(index) returns the name of the field with that index and getField(fieldName) returns the field of that name.

for (var fieldNumber = 0; fieldNumber < numFields; fieldNumber ++)
{
  getField(getNthFieldName(fieldNumber)).value = 'Scripty Was Here';
}
发布评论

评论列表(0)

  1. 暂无评论