Skip to main content
Pathagoras
Participating Frequently
January 13, 2019
Question

Is there a way to search and replace text in bounding boxes?

  • January 13, 2019
  • 15 replies
  • 4666 views

Adobe properly created a form from a Word document.  It used the text in the original Word document to create nice and accurate fillable fields in the new PDF and all looks correct.

Now I would like to programmatcally change some of the 'titles' that precede the fillable fields. (It was these titles from which the fillable-field names were created) in order to give the title a friendlier name. I know how to cycle through the fillable-field names and change them at will, but is there a way to cycle through the 'titles'? (I can get to these titles chosing to 'Edit PDF' (and showing the bounding boxes, but not sure if this step is needed). I can also manually search for text snippets using CTRL-F, and I successfully replace text that is found one item at a time. Can I automate this 'find' and 'replace' routine.

This topic has been closed for replies.

15 replies

Legend
January 16, 2019

Redaction can be done from JavaScript so it’s described in the JavaScript API Reference.

Pathagoras
Participating Frequently
January 15, 2019

Actually, I don't need to replace it with anything. Can I just delete what was highlighted? 

With this code:

     MyText = "Lewis Carroll"

     Ok = acrAVDoc.FindText(MyText, 0, 1, 1)

'Lewis Carroll' was found and is highlighted in the pdf file. Now I just want to delete it. Possible?

Legend
January 15, 2019

You can redact it. This leaves a hole, nothing closes up.

Pathagoras
Participating Frequently
January 16, 2019

Not worried about a hole. Where do I find the code to redact the highlighted text?

Thanks.

lrosenth
Adobe Employee
Adobe Employee
January 13, 2019

No, automation of Find/Replace is not possible because of the nature of textual content in a non-tagged PDF.

Thom Parker
Community Expert
Community Expert
January 15, 2019

Not strictly true. A plug-in could easily be written to both add and delete text from a run. The hard part is the formatting.

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often