4 Replies Latest reply on Jun 11, 2009 3:31 AM by ReinhardF

    Not able to Retrieve the Fields in the adobe forms


      Hi All,


      I'm facing an issue with adobe forms automation.I'm using QTP as a primary tool to automate this.

      I have installed acrobat professional as well.


      I'm able to retrieve the text from the adobe forms but not able to retrieve the adobe fields and his values.Did anyone faced the same issue ?

      Can anyone suggest me a possible solution for this.


      I'm having problem in this section of the code..


      possibly,I'm looking to automate the adobe forms by putting my own entries and capture the values i want from the relevant fields.



      '''''Adobe fields







      The below code searches for any open pdf document in the desktop and captures all the text elements of the PDF..i wanted to capture all the FIELDs also..but it as not capturing it.


      /,,,Code ..../


      Option Explicit
      Dim bFound, i,AFormAut
      Dim AcroApp, AcroAVDoc,acroPDDoc, acroRect, PDTextSelect,nElem
      Dim formapp,acroform,field,myfield

      Set AcroApp = CreateObject( "AcroExch.App" )
      Dim bCaseSensitive, bWholeWordsOnly, bReset
      bCaseSensitive = True
      bWholeWordsOnly = False
      bReset = False
      For i = 0 To AcroApp.GetNumAVDocs - 1
      Set AcroAVDoc = AcroApp.GetAVDoc( i )
      If AcroAVDoc.IsValid Then
      bFound = AcroAVDoc.FindText( "$100,000", _
      bCaseSensitive, bWholeWordsOnly, bReset )

      'Print the title of the PDF
      Print "PDF Title ---> " & AcroAVDoc.GetTitle()

      Print "'FORM CDR ' exists? ---> " & bFound
      'Call acroapp.Unlock()

      Set acroPDDoc = acroAVDoc.GetPDDoc()
      Print "File Name ---> " & acroPDDoc.GetFileName()
      Print "Number of Pages ---> " & acroPDDoc.GetNumPages()
      Set acroRect = CreateObject( "AcroExch.Rect" )
      acroRect.Bottom = 100 : acroRect.Top = 1100
      acroRect.Left = 0 : acroRect.Right = 1100
      Set PDTextSelect = acroPDDoc.CreateTextSelect( 0, acroRect )
      If PDTextSelect Is Nothing Then
      Print "Unable to Create TextSelect object."
      End If


      '''''Adobe fields

      'Set AcExAVDoc = CreateObject("AcroExch.AVDoc")

      myfield = "250000"

      Set formApp = CreateObject("AFormAut.App")
      'Set Fields = formapp.fields
      'Set field = fields.item(myfield)


      Call acroAVDoc.SetTextSelection( PDTextSelect )
      Call acroAVDoc.ShowTextSelect()
      Print "Selection Page Number ---> " & PDTextSelect.GetPage()
      Print "Selection Text Elements ---> " & PDTextSelect.GetNumText()

      For nElem = 0 To PDTextSelect.GetNumText() - 1
      Print "Text # " & nElem & " ---> '" & PDTextSelect.GetText( nElem ) & "'"

      ' ** Destroying Text Selection
      Call PDTextSelect.Destroy()

      End If
      Set AcroAVDoc = Nothing : Set AcroApp = Nothing
      Set PDTextSelect = Nothing : Set acroRect = Nothing

      Set field = nothing : set formapp = Nothing





        • 2. Re: Not able to Retrieve the Fields in the adobe forms
          gkaiseril MVP & Adobe Community Professional

          This appears to be coding for other than Acrobat JavaScript in a PDF. Please follow the link above for the SDK/Developer's forum.

          • 3. Re: Not able to Retrieve the Fields in the adobe forms
            adobe213213 Level 1

            Thanks for replying..


            I Can't use that code to test my application.

            because my pdf file opens inside the SAP Portal application which is nothing but the SAP interactive forms.


            So what i'm achieving in my code is.(I wrote all this in QTP which uses VB scripting )

            1.Search for any pdf stuffs in my window,so whenever this pdf open inside the browser.It captures the window.

            2.I'm capturing all the text element inside a rectangle box using acrorect.

            3.Even the Fields are also comes inside the rectangle ..it is not been captured.


            Now,i need explicit calls to the field names to capture the values or write the values.


            Couples of thinks.i would like on my investigation.


            1. Do i need Visual Basic to be installed on my PC?


            2. Do i need Acrobat SDK to be installed on my PC ?if yes..what are the installation steps and how do i install?

               i have downloaded the Acrobat SDK 8.1 since i have acrobat professional 8.0


            This is a quite interesting topic to be investigate on.please spare your knowledge and time to achieve  value to it.

            Thanks again!

            • 4. Re: Not able to Retrieve the Fields in the adobe forms
              ReinhardF Level 3



              in the link I gave to you, you will find a working VBScipt example.

              So you need only to click.


              "... 1. Do i need Visual Basic to be installed on my PC? ... "



              "2 . Do i need Acrobat SDK to be installed....."

              No. It's only an explanation.

              If you want to control Acrobat from your app via Active X/OLe you need only to read the "Interapplication Communication (IAC)" sections.

              Hower downloading and installing is not bad, so you have it on your maschine.


              Very Important is to look in the acrobat help file for java script and also to look here.

              Because you can use this Acrobat-Java-Script examples also with your application -

              via the JavaScriptObject (JSO) or also other, more direct technics.


              You will find very much JS examples you use direct, but mostly only some few examples, which are written in your preferred prog-language.


              best regards, Reinhard