2 Replies Latest reply on Feb 21, 2011 11:05 PM by jeanmed

    javascript and search




      I need to search a text in a pdf file.
      I have 2 text fields from who i get the values, after a cacul, need to search this value in my opened file.


      I can not find the function or method to search the document that value.


      The seach.query(); open's a new window. I need just tu search directly.


      Thanks for you help


      my PDF : http://www.allienys.com/sample/search.pdf
      "test with 50 and 100 for 0.5"



        • 1. Re: javascript and search
          maxwyss Level 4

          The Search object is essentially an interface to the search plug-in in Acrobat / Reader.


          If you want to do things within the document, you would have to do it the way plug-in developers have to do it to find something in a document. You parse the document page per page using getPageNthWord() and the word's location using getPageNthWordQuads(). With this information, you can do some further evaluation whether found words fit together (keep in mind that you can not expect to have a logical string of words, representing text as we read it, in a PDF). As a result, you can highlight the found word(s).


          You should have a closer look at the Acrobat JavaScript documentation for the above mentioned methods, and also follow the links. It is not thaat complicated, but you have to be sure what you want to find. It has been successfully done in the past. This procedure is also the first step if you want to programmatically add links or fields over a given piece of text (such as item numbers or so).




          Max Wyss.

          1 person found this helpful
          • 2. Re: javascript and search
            jeanmed Level 1

            Thanks for your help, it's very clear.

            I am going to try it.