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

search with regex and add screentip to certain text of a PDF document

gavin2u
Registered: Jul 3 2009
Posts: 76
Answered

Hi, guys

I wanna search text with regex pattern in a PDF document, when matched text found in the document, add screen tip to it

screen tip is like title property in html code, as follows,

Quote:

link text

after add it successfully, the screen tip would display once i point to the text with mouse.

so, you see, HOW could i search with regex, and add the screen tip? is there any way.

OR,

Is there any alternative way to display my screen tips when i point to it?

thanks in advance :)

-
gavin

My Product Information:
Acrobat Pro 9.0, Windows
gavin2u
Registered: Jul 3 2009
Posts: 76
just now, when i select a part of text in my PDF document, i right click on it, and in the content menu, i find a menu item: Underline text(Comment).

i believe this would be an alternative method, but how could i access it using javascript?

BTW, the screen tip would be the best way, hope there be any solution.

Any help would be greatly appreciated.

-
gavin
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Look at the Annotation object in the reference files.

(ps - did you get my PM?)

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

gavin2u
Registered: Jul 3 2009
Posts: 76
try67 wrote:
Look at the Annotation object in the reference files.(ps - did you get my PM?)
Annotation object?

k, i will check it out later. thanks for ur reply :)

PM, mmm, i have just read it, however, i could not get access to blogspot.com from China. :(

Would you please send the content directly using PM? thanks so much.

-
gavin
gavin2u
Registered: Jul 3 2009
Posts: 76
I now could add annotation using js.

but, how could i search the certain text, and add the very annotation to it?

var annot = this.addAnnot({type: "Square",page: 59,rect: [100,100,200,150],author: "refer key",name: "annot0001",popupOpen: false,popupRect: [100,100,200,150],contents: "Hi World!",strokeColor: color.red,fillColor: ["RGB",1,1,.855],noteIcon: "Key",opacity: 1.0,width: 0});

the above is an example of adding annotation, and successfully and tooltip to some rect area.
and also i could convert it to underline annotation.

so, now, the problem is Searching with Regex.

var myRegex = /\d{1,3}\.\t/;

.... so, what is next?

I look forward to any response, and thanks for try67 reply again. :)
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
There is annotation type of 'Underline' you can use instead of 'Square'

George Kaiser

gavin2u
Registered: Jul 3 2009
Posts: 76
gkaiseril wrote:
There is annotation type of 'Underline' you can use instead of 'Square'
yep, i mentioned this in my reply above:

gavin2u wrote:
the above is an example of adding annotation, and successfully and tooltip to some rect area.
and also i could convert it to underline annotation.
actually, i now use underline annotation instead of square. thx. :)