These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Recognize document text and enter in form field?

sstirler
Registered: Apr 29 2008
Posts: 12

Is there a way for Acrobat to find a sting of text in the documnt (originally created in Word and printed to PDF) and populate a portion of it into a form field?

For example: I have a Word document that has been converted to PDF with this section of text "name: John Smith". I also have a cover sheet to the document which has form fields created in Acrobat 8. I want to find "name: " and enter everthing coming after it into the "name" form field.

I'm somewhat familar with JavaScript and have read much of the Guide, but have yet to come across anything like this.

My Product Information:
Acrobat Pro 8.1.2, Windows
ChrisFreeman
Registered: May 6 2007
Posts: 19
Try looping though all of the words on the page. When you find "name:" grab the following word.

If the current document is pointed to by "this" (replace "this" with pointer to current document if different from "this", such as oDoc)

Number of words on a page:
this.getPageNumWords({nPage:0})

A particular word on page:
this.getPageNthWord({nPage:0, nWord:i, bStrip:false})

Putting it together:
var nTargetPage = 0; // replace with your 0-based target page number
var nCount = this.getPageNumWords({nPage:nTargetPage});
var cWord = "";
for (var i=0; i