1 Reply Latest reply on Feb 14, 2012 3:06 AM by Bernd Alheit

    How to distinguish a text in acrobat professional 8.0?

    skpoojar

      Hi all,

       

      I am new to this forum.

       

      First, let me explain my problem:

      sample image.jpg

      I have a acrobat file which looks like as shown above. There is some text which corresponds to each number. I am interested to extract the numbers which have some particular text( ex:N/A) embedded in that text. With this, I am able to get 17 and 21. But, number 19 is also coming, though it does not has N/A in it. I mean, as there is N/A outside the box but before next question number, it appears like it is also associated with number 19.

      My code is as follows:



      var NA_Pattern1 = /N\/A\"/g;
      var NA_Pattern2 = /N\/A/g;
              var my_pattern = /Y/g;

      var Page_variable,Word_variable,k,l,number_of_pages;

      var Prev_label,Present_label,count;
      var word1,word2;
      var Total_Qstn_Strng;


              Prev_label = 0;
      k = 0;
      count = 0;


      number_of_pages = k ;
      var Qstn_num = 1;
      Total_Qstn_Strng = "";

      for( Page_variable = 0 , l = 0 ; Page_variable < this.numPages ; Page_variable++ )
       
      {
        if ( this.getPageLabel( Page_variable ) == Checklist_Pages[ l ] )
        {
         //Get the number of words present in the page
        l++;
        Number_of_Words_in_a_Page = this.getPageNumWords( Page_variable );
      Word_variable = 0;
          do
         
          {
            word1 = this.getPageNthWord( Page_variable , Word_variable , false );
           Word_variable ++ ;
           word2 = this.getPageNthWord( Page_variable , Word_variable , false );
           Total_String = word1 + word2;
          }
          while ( !NA_Pattern2.test( Total_String ) );

        for(  ; Word_variable < Number_of_Words_in_a_Page ;Word_variable ++  )

         {
           word1 = this.getPageNthWord( Page_variable , Word_variable , false );
          if ( (word1 == Qstn_num ))
           {
            Word1 = this.getPageNthWord( Page_variable , Word_variable , false );
            Total_String = "";
         
            while( (Qstn_num + 1) !=  Word1 && !(my_pattern.test(Word1)) )
         
            {
             Total_String = Total_String + Word1;
             Word_variable ++;
             if ( Word_variable == Number_of_Words_in_a_Page )
             {
              break;
             }
             Word1 = this.getPageNthWord( Page_variable , Word_variable , false );
            }

           
           if( NA_Pattern2.test(Total_String) || NA_Pattern1.test(Total_String))
            {
             Total_Qstn_Strng = Total_Qstn_Strng + "," +  Qstn_num );
            }
            Qstn_num ++;
            Word_variable --;   
           }

         }
        }

      }

      app.alert(Total_Qstn_Strng);

       

      Thanks in advance,

      Shivaraj