Search in PDF and add rectangle to text

New Here ,
Oct 22, 2019

Copy link to clipboard

Copied

Hi all! Would really appreciate some help figuring out the proper code to help me at work. 
The idea is to be able to automatically search for phrases in a PDF document containing dollar signs (i.e "$24.7 million...."), or percents ("45% of sales") and then add in a red rectangle around that phrase. Can anyone give me a little guidance on how to do this? I am very new to the world of writing code so I would really appreciate the help with this. 
Thanks so much in advance! 

TOPICS
Acrobat SDK and JavaScript, Comment review and collaborate PDF, Edit and convert PDFs, How to

Views

97

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Search in PDF and add rectangle to text

New Here ,
Oct 22, 2019

Copy link to clipboard

Copied

Hi all! Would really appreciate some help figuring out the proper code to help me at work. 
The idea is to be able to automatically search for phrases in a PDF document containing dollar signs (i.e "$24.7 million...."), or percents ("45% of sales") and then add in a red rectangle around that phrase. Can anyone give me a little guidance on how to do this? I am very new to the world of writing code so I would really appreciate the help with this. 
Thanks so much in advance! 

TOPICS
Acrobat SDK and JavaScript, Comment review and collaborate PDF, Edit and convert PDFs, How to

Views

98

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 22, 2019 0
Adobe Community Professional ,
Oct 24, 2019

Copy link to clipboard

Copied

Hi,

 

This looks like an advanced search with with the ability to highlight the keywords punched in the search.

 

Have you tried any of the action tools freely available for download ?

 

Check the Adobe Tools and the Adobe Actions exchange page.

 

And also the Adobe for legal professionals.

 

There are various action tools that allow you to do something similar through extraction of pages and comments.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 24, 2019 0
New Here ,
Oct 24, 2019

Copy link to clipboard

Copied

Yes I was able to find some actions to search and highlight the text. However I was looking for a way to add a red box around the text, not highlight it. We usually do this individually and free drawn with the comment feature. I was hoping there was a way to automatically do it to the searches phrase. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 24, 2019 0
Adobe Community Professional ,
Oct 26, 2019

Copy link to clipboard

Copied

 

You've already found your solution, i.e. the Action that searches and highlights text. I imagine you found this at the Acrobat User's Actions Exhange?  All you need to do is replace the hight annoation with a rectangle.

 

There are a couple of differnet ways to do this. First, though, here's how that Actio works. It uses the Redact search tool to place Redact Annotations on the searched words, then it replaces the Redact Annotations with Highlights.

 

1. Edit the JavaScript part of the action to replace the Redacts with "Squares".

2. Or, just run some code in the Console window to replace the Highlights with Squares.

 

Here's some example code that will convert all highlight annotations into squares. Note: the outline color of the square is the same as the highlight. 

 

this.getAnnots().forEach(function(a){if(a.type == "Highlight")a.type="Square";});

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 26, 2019 0
Most Valuable Participant ,
Oct 25, 2019

Copy link to clipboard

Copied

It is possible, although identifying an entire phrase (as opposed to just the number with the symbol) is very complicated.

Either way it requires a custom-made script that will identify the matches and then add a Square comment around them.

I've developed very similar tools for my clients so if you're interested in hiring someone to create it for you feel free to contact me privately via [try6767 at gmail.com] and we could discuss it further.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 25, 2019 0