Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
No, automation of Find/Replace is not possible because of the nature of textual content in a non-tagged PDF.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
You can redact it. This leaves a hole, nothing closes up.
Copy link to clipboard
Copied
Not worried about a hole. Where do I find the code to redact the highlighted text?
Thanks.
Copy link to clipboard
Copied
Thanks. Can I write my own plug-in? Where are the resources for that?
Copy link to clipboard
Copied
Not worried about a hole. Where do I find the code to redact the highlighted text?
Thanks.
Copy link to clipboard
Copied
You'll find all the info you need to write a script or a plug-in here:
For the plug-in you'll need to download the SDK and have the appropriate version of the development tools. Plug-ins are written in C++
Here's the reference entry for the redaction JavaScript function:
Copy link to clipboard
Copied
I appreciate the reference, but all I want to do is 'blank out' (delete, redact, it doesn't matter) a 10 to 20 character piece of text that I have already located and highlighted in a PDF using VBA coding inside of Word. If I were manually doing this, I would simply be pressing the Delete button inside the PDF. Maybe I'll try 'SendKeys'. Maybe in the future, Adobe will add a 'delete' method, but I cannot justfify what may end up being a hundred or so lines of code to effect a 'delete.' Thanks anyway for your direction.
Copy link to clipboard
Copied
It’s not just hitting deleting in Acrobat…That will simply strikeout the text with an annotation – no removal.
What you want to do is not something trivial – as you seem to think it is – which is one reason we don’t expose it to automation.
Copy link to clipboard
Copied
I see that now. Even thought the text is highlighted, it's not 'active' in any way. Even when I search when the Edit button is pressed, and the search text is found, it's still not 'active'. It's just highlighted.
But a 'square' is nevertheless 'painted' on the screen, so dimensions of something exists, and a 'white box redaction' over that square would serve my needs.
Who do I contact for paid services to program my need? (Am I allowed to do this via this board?)
Copy link to clipboard
Copied
You are absolutely allowed do that – and Thom Parker (who replied to you previously here) would be an excellent choice.
Copy link to clipboard
Copied
Thanks Leonard
There are a number of ways to search for and redact text. For example the free "Find and Highlight" Acrobat Action on the Actions Exchange searches and highlights text in a PDF.
https://acrobatusers.com/actions-exchange
These highlights could easily be converted to redaction annots by simply adding another script to the Action. (Actually, the script uses the Redact search functionality to find the words in the first place, so a minor change to the existing script would make it a redaction action;)
Scripts can also be executed from VBA. So you could even use your existing VBA script from word. Or you could do this from a custom automation script in Acrobat.
Copy link to clipboard
Copied
You may not need the VBA at all. The Acrobat ribbon in Word allows you to run an action immediately after the file is created.
Copy link to clipboard
Copied
Redaction can be done from JavaScript so it’s described in the JavaScript API Reference.