AcroExch.AVDoc.FindText(), Acrobat XI

Code from Chapter 16 Scripting Quicktest Professional Page 25,  Dani Vainstein
FindText(): Finds the specified text,
but doesn't scrolls so that it is visible, and doesn't highlights it
Dim AcroApp, AcroAVDoc As Object
Dim gPDFPath, bReset, nCount
gPDFPath = "c:\Input.pdf"
Set AcroApp = CreateObject("AcroExch.App")
AcroApp.Show
Set AcroAVDoc = CreateObject("AcroExch.AVDoc")
If AcroAVDoc.Open(gPDFPath, "") Then
AcroAVDoc.BringToFront
bReset = True: nCount = 0
Do While AcroAVDoc.FindText("9630208046", True, True, bReset)
bReset = False: nCount = nCount + 1
Loop
End If
AcroApp.CloseAllDocs
AcroApp.Exit
Print "The word '9630208046' was found " & nCount & " times."
Set AcroApp = Nothing
End Sub
With Acrobat 9 and Access the program works. Is there a Workaround for Acrobat XI.

For me it works correct - I only dislike the msgbox "not found", when the value is false.
Another way would be be to read the text of the page(s) and anlyse it in VBS.
Attached a code snipet for that.
HTH, Reinhard
'// Save this as xxx.vbs and start with Double Click
'// It gives you the text of an already opened PDF
'// if Acrobat or no Doc is open you get an ErrorMsg
set WshShell = CreateObject ("Wscript.Shell")
WshShell.AppActivate("Adobe Acrobat")
WScript.Sleep 500
'// get the active Document
Set AcroApp = CreateObject("AcroExch.App")
Set AVDoc = AcroApp.GetActiveDoc
Set PDDoc = AVDoc.GetPDDoc
Set PdfPage = PDDoc.AcquirePage(1) '<<--SET in FILE! =Pagenumber
Set PageHL = CreateObject("AcroExch.HiliteList")
PageHLRes = PageHL.Add(0,9000) '<<--SET in FILE! (Start,END[9000=All])
Set PageSel = PdfPage.CreatePageHilite(PageHL)
for i = 0 to PageSel.Getnumtext - 1
pdfData =PDFData & PageSel.GetText(i)
Next
msgBox PDFDATA

Similar Messages

  • AcroExch.AVDoc.FindText()

    Hi, there
    Does anyone have any experience of the FindText() function? I was hoping to use it together with acrApp.MenuItemExecute "NewBookmark" to create a set of standard bookmarks. The API documentation claims that the function "Finds the specified text, scrolls so that it is visible, and highlights it" and it returns "True if the text was found, False if it was not." From my experience, though, it always returns True, and certainly doesn't scroll to the text or highlight it. In fact, all it seems to do is insert the find text in the application's search field.
    Or am I doing summit wrong?
    Dim acrApp, acrAVDoc
    Set acrApp = CreateObject("AcroExch.App")
    Set acrAVDoc = CreateObject("AcroExch.AVDoc")
    acrApp.Show
    If acrAVDoc.Open(MY_FILE, "") Then
    acrAVDoc.FindText MY_TEXT, False, True, True
    etc...
    thanks
    jON
    - Adobe Acrobat 6.0
    - MS Office 2003
    - MS Windows XP Professional SP2

    For me it works correct - I only dislike the msgbox "not found", when the value is false.
    Another way would be be to read the text of the page(s) and anlyse it in VBS.
    Attached a code snipet for that.
    HTH, Reinhard
    '// Save this as xxx.vbs and start with Double Click
    '// It gives you the text of an already opened PDF
    '// if Acrobat or no Doc is open you get an ErrorMsg
    set WshShell = CreateObject ("Wscript.Shell")
    WshShell.AppActivate("Adobe Acrobat")
    WScript.Sleep 500
    '// get the active Document
    Set AcroApp = CreateObject("AcroExch.App")
    Set AVDoc = AcroApp.GetActiveDoc
    Set PDDoc = AVDoc.GetPDDoc
    Set PdfPage = PDDoc.AcquirePage(1) '<<--SET in FILE! =Pagenumber
    Set PageHL = CreateObject("AcroExch.HiliteList")
    PageHLRes = PageHL.Add(0,9000) '<<--SET in FILE! (Start,END[9000=All])
    Set PageSel = PdfPage.CreatePageHilite(PageHL)
    for i = 0 to PageSel.Getnumtext - 1
    pdfData =PDFData & PageSel.GetText(i)
    Next
    msgBox PDFDATA

  • QTP-11 doesn't recognize "AcroExch.AVDoc" object with "Adobe Acrobat 9.0"

    Hi Support Team,
    I worked with Acrobat 7 and have used the same script after installing Acrobat 9 for Automation Testing with QTP for validating pdf. The object "AcroExch.AVDoc" is not getting identified as object while working in QTP-11 in the system/machine which has Acrobat 9 installed, whereas it works well in the machine which has Acrobat 7 installed . So it will be better if two things are known as per my understanding, ie.,
    it must have compatibility issue (i need links/wweb-source about the difference between "Adobe Acrobat versions 7 & 9" to assure this) or
    installation issue( which can be confirmed if the former question is answered).
    So i kindly request you to help me out for this scenario.
    Kind Regards,
    Vikraman G

    You need the Adobe PDF Test Toolkit - http://labs.adobe.com/technologies/aptt/

  • Hello, I have the usual issue to use AcroExch.PDDoc/AcroExch.App/AcroExch.AVDoc objects in Visual Basic (MS EXCEL). On my company's machine I have Acrobat X and everything works fine, but I have another machine with just "Reader" installed - is there als

    Hello, I have the usual issue to use AcroExch.PDDoc/AcroExch.App/AcroExch.AVDoc objects in Visual Basic (MS EXCEL). On my company's machine I have Acrobat X and everything works fine. I am looking for the cheapest solution to get the stuff running on another machine... is there any way to do that with the Acrobat SDK, or do I need to purchase a full version of Acrobat XI ($$) ?

    The Acrobat SDK is nothing by itself. It is just information on how to automate Acrobat - just as the Office SDK doesn't include Office, but is for people who already have purchased Office but want to automate it.
    These automation things are MARKETING TOOLS FOR ACROBAT. Consider this and the technical limitations make a lot more sense.
    So, yes, you need to buy Acrobat. Standard is cheaper than Pro.

  • How do I pass the number of print copies to AcroExch.AVDoc

    Hi,
    I have the following function to print a pdf file, but I don't seem to be able to specify the number of copies I want to print, please help! How to set the number of copies to print, thanks a lot!
    Sub PrintPDF(ByVal pdfFilePath As String, ByVal numCopyToPrint As Integer)
    'AcroPDF1.Application
    Call GetCommandBarNames
    Dim myAcroApp As AcroApp
    Dim myAVDoc As AcroAVDoc
    Dim PDDoc As AcroPDDoc
    Dim numPages As Integer
    Dim IsSuccess As Boolean
    Set myAcroApp = CreateObject("AcroExch.App")
    Set myAVDoc = CreateObject("AcroExch.AVDoc")
    myAVDoc.Open pdfFilePath, ""
    Set PDDoc = myAVDoc.GetPDDoc
    numPages = PDDoc.GetNumPages
    myAcroApp.Show
    'MsgBox "numpages = " & numPages & ", numcopies = " & numCopyToPrint
    'myAVDoc.PrintPages 1, numPages, numCopyToPrint, True, True
    myAVDoc.PrintPages 1, numPages, 2, True, True
    'Close the PDF
    myAVDoc.Close True
    myAcroApp.Hide
    myAcroApp.CloseAllDocs
    myAcroApp.Exit
    'Cleanup
    Set PDDoc = Nothing
    Set myAVDoc = Nothing
    Set myAcroApp = Nothing
    End Sub

    You cannot. (Note to other readers: this is an API to Acrobat, not
    Adobe Reader)
    Aandi Inston

  • AcroExch.app(sdk)はAcrobat Reader 5.0では使用できないの?

    undefined

    みません。Acrobat 5.0+SDKを用いてVBで、Acrobat Reader 5.0でファイルをオープンしたり、ページ指定したりするソフトを作りました。試しに、インストーラを作り他のマシンでAcrobat Reader 5.0しか入っていないマシンに対してインストールを行い実行したところ、ActiveX・・・”429”が作れません。とエラーが出ます。
    ・Acrobatを用いずとも、Acrobat Reader 5.0でPDFファイルを制御したいだけなのですが、この場合何れの機械にもAcrobatが必要なのか?
    ・Acrobat Reader 5.0のみを用いて外のプログラムから制御する閲覧システムを作りたいが出来ないのでしょうか?
    ・クライアントのユーザではPDFファイルの作成も変換もしないで閲覧するのみなのでAcrobatは不要だし、0Acrobat Reader 5.0しかないマシンで実現したいが可能なのか?
    実現する方法を教えてください。

  • Extract highlighted words from a pdf (Acrobat SDK, OLE)

    Hello Acrobat gurus ! :-)
    I'm new to the SDK, so please excuse any "stupid" question i might have.
    Here is what i want to do:
    I want to search for a group of words in a pdf document. According to the SDK documentation, once i search for a text using AcroExch.AVDoc.FindText(), the function "Finds the specified text, scrolls so that it is visible, and highlights it."
    I was assuming that after calling this function with my string, once the string is found i will have acces to the coordinates of the rectangle containing the highlighted group of words (i presumed that those words would be automatically contained in an object of the type AcroExch.HiliteList) and to the coordinates of those words.But i'm not able to do so, i cannot find any function(s) that give me that kind of access.
    So question is:
    Is it possible to access the coordinates of the rectangle/words that are highlighted in a pdf after calling the FindText() function ? Can someone help me get on the right track ?
    Thanks

    Ok, let me give you an more elaborate example, maybe i don't ask the right question.
    Let's say i have a pdf, containing the following text in the first page
    --- arbitrary number of ":"
    Mother's Name: Joanna
    Father's Name: Josh
    other text
    If i call the function like this: FindText("Mother's Name:"), acrobat is going to find the first occurance of my string. What i want to do is to be able to get the coordinates of this WHOLE string OR the coordinates of the last character in the string  (in this case ":").
    The problem is that if i go for the coordinates ofthe double dots i cannot just look for them in the pdf, because i may have an unknown number of double dots (":") before the ones i'm interested in. The logical solution in this case would be to get the coordinates of the entire string ("Mother's Name:" in this case) and then get the coordinates of the double dots i'm interested in.
    Would that be possible ?

  • How to Hide Acrobat When Running VBA Code

    I am using Acrobat 9.
    My project adds text to Acrobat fillable fields using VBA written in Access 2003. I take records from my Access database, and populate it into different Acrobat Forms based on the field name in the Acrobat Form. I am able to do this, but there is one problem.
    The problem is that as the code runs through populating text in the Acrobat Forms, Acrobat opens up each form, and makes it visible to the user. It populates quick, but it is still visible. I want this to run in the background, or at least be minimized in the windows taskbar. The users should not not know which form the Application is updating. It should be hidden or invisible. That is the goal at least :)
    I know which line in the code causes it to Maximize, but if I remove that line, I receive an error about No Document Currently Open in Acrobat Viewer.
    Here is the snippet of the code I am using. Any help would be greatly appreciated.
    Dim gApp As Acrobat.CAcroApp
    Dim avdoc As Acrobat.CAcroAVDoc
    Dim gPDDoc As Acrobat.CAcroPDDoc
    Const DOC_FOLDER As String = "C:\Trial"
    Dim x As Boolean
    Set gApp = CreateObject("AcroExch.App")
    Set gPDDoc = CreateObject("AcroExch.PDDoc")
    Set avdoc = CreateObject("AcroExch.AVDoc")
    'Hides Acrobat - So Far So Good
    gApp.Hide
    Dim FormApp As AFORMAUTLib.AFormApp
    Dim AcroForm As AFORMAUTLib.Fields
    Dim Field As AFORMAUTLib.Field
    'Open PDF that I choose. Acrobat still has not flashed on my screen
    x = avdoc.Open(DOC_FOLDER & "\trial.pdf", "temp")
    'Acrobat Now Pops up on my screen. However, I get an error without this line. avdoc.Show works the same as Maximize it seems.
    avdoc.Maximize(1)
    'Hides it again, right after it opens. This creates a flash
    gApp.Hide
    Set FormApp = CreateObject("AFormAut.App")
    'If the Maximize line is not there, this is where I receive error about document viewer
    For Each Field In FormApp.Fields
    If Field.Name = "Sample_FieldName" Then
    Field.Value = TextToUse
    End If
    Next
    Please let me know if you can think of a way to keep Acrobat hidden. Thank you.

    Use standard VB/Windows features to minimize the app.

  • SignatureInfo.Date Displays wrong Day

    When I sign a digital signature field on a PDF form, in the properties window, the date is showing as "2010.02.24 10:25:40 -06'00'"
    However, when I extract the date programmatically, it's returning as "2/3/2010 10:25:40am"
    Does anyone know why the day is 3 weeks off or just wrong in general?

    I'm signing using a Topaz Digital Signature Pad.
    Here's the code of how I'm extracting it:
       '*** PDF Initializing Variables ***
        Dim AcroApp As Acrobat.AcroApp
        Dim formApp As AFORMAUTLib.AFormApp
        Dim acroForm As AFORMAUTLib.Fields
        Dim field As AFORMAUTLib.Field
        Dim avDoc As Acrobat.CAcroAVDoc
        Dim pdDoc As Acrobat.CAcroPDDoc
        Dim bOK As Boolean
        Dim jsObj As Object
        Dim Info As Object
        Sub Main()
            ' OPEN PDF
            AcroApp = CreateObject("AcroExch.App")
            AcroApp.Lock("TEST")
            avDoc = CreateObject("AcroExch.AVDoc") 'New Acrobat.AcroAVDoc
            Console.WriteLine("Object Created")
            bOK = avDoc.Open("C:\TEST.pdf", "Admission Document")
            ' GET PDDoc
            pdDoc = avDoc.GetPDDoc
            pdDoc.OpenAVDoc("C:\TEST.pdf")
            jsObj = pdDoc.GetJSObject
            If (bOK) Then
                formApp = CreateObject("AFormAut.App")
                acroForm = formApp.Fields
            End If
            field = acroForm.Item("Signature1")
            If field.Value <> Nothing Then
                Info = jsObj.getField("Signature1").signatureInfo()
                MsgBox("Signature1: " & Info.date)
            End If
            pdDoc.Close()
            avDoc.Close(True)
            AcroApp.UnlockEx("TEST")
            AcroApp = Nothing
        End Sub
    I basically open the document, get the PDDoc, get the JSObject, check to see if the signature has been signed, and then message box the date for testing purposes.

  • AcroExch - Acrobat SDK 9.0

    Hi,
    I have a copy of Adobe Acrobat 9 pro installed along with the SDK.  I can run the BasicIACVB example and have used the sample to find text in the pdf, however I am having issues pulling the actual page number that the text is found on.
    I am using the ACROBAT.CACROAVPAGEVIEW object.
    Dim gAVPage as Acrobat.CAcroAVPageView
    gAvPage = CreateObject("AcroExch.CAcroAVPageView")
    I get an error stating "Cannot create ActiveX component." on the second line, the CreateObject line.
    I can create an object of AcroExch.AVDoc just fine without errors.
    Any Suggestions would be greatly appreciated.  Oh, I am developing in VB.net 2005 on a Windows XP Pro Box.
    Thanks!
    JT

    You should post in the Acrobat SDK forum.

  • .FindText not respecting parameters in Acrobat 10

    Hello to all,
    New to programming with Adobe. Experienced in MS Office VBA.
    I have some code in VBA (EXCEL) that opens pdf files (created from WORD 2007 and searchable) and searches each one for a series of key words.
    The example below works fine on Acrobat 8, but not on my newly installed Acrobat 10 (Acrobat X version 10.0.0).
    The text to find is "CO" (whole word only, case sensistive) - not present as such in the test pdf file, but the word "COMMITTEE" is.
    The code used is: spfd = AVDoc.FindText("CO", 1, 1, 1)
    This results in spfd=False for Acrobat 8 (which is correct), but results in spfd=True in acrobat 10.
    If I do the same search through the Acrobat application interface on the same pdf file, specifying whole words only & case sensitive, it does not find a match, which is correct.
    Any thoughts?
    Many thanks in advance for any help!
    timo_mika

    Hello to all,
    This is justto say that the problem also occurs on a brand new machine with new Acrobat X installation. Any help would be appreciated, including other methods to find text (over 100 key words, noting that some of the strings contain more than one word...).
    Thanks!

  • Acrobat won't release a file

    Everyone,
    I'm using visual basic to manipulate a pdf file opened in Acrobat. The code below opens the file and searches for a text string. If it finds the text string, the pages containing are deleted. Once the text string is no longer found, the file is closed, the application is hidden and then exited. All of this works just fine.
    My problem occurs with the last line of code. I want to rename the file and place it in another directory. However, I get a file path error which indicates to me that Acrobat is still holding on to the recently closed file.
    Is there a method to get Acrobat to release the file? Any help is appreciated.
    MikeCJ
    Dim pdfAcroExchApp As Acrobat.AcroApp
    Dim pdfAVDoc As Acrobat.AcroAVDoc
    Dim pdfPDDoc As Acrobat.AcroPDDoc
    Dim pdfPath, sText As String
    Dim foundText, Rsp, x As Integer
    Dim check As Boolean
    'Check establishes whether an MSDS has a chemical Evaluation form attahced.
    check = True
    Do While check = True
        'If the text string frmChemEval is found it is a certainty the MSDS file contains a Chemcial Evaluation Form
        sText = "frmChemEval"
        pdfPath = "Q:\" & Form_frmControlPanel.fldautoMSDSNbr & ".pdf"
        'set pdfAVDoc for searching
        Set pdfAcroExchApp = CreateObject("AcroExch.App")
        Set pdfAVDoc = CreateObject("AcroExch.Avdoc")
        pdfAVDoc.Open pdfPath, ""
        pdfAcroExchApp.Show
        Set pdfPDDoc = pdfAVDoc.GetPDDoc
        Set pdfPDDoc = CreateObject("AcroExch.PDDoc")
        pdfPDDoc.Open pdfPath
        x = pdfPDDoc.GetNumPages
        foundText = pdfAVDoc.FindText(sText, 0, 1, 1)
            If foundText = -1 Then
                check = True
            Else
                check = False
            End If
            If check = True Then 'The MSDS already contains a Chemical Evaluation Form
                    pdfPDDoc.AcquirePage pdfPDDoc.GetNumPages - 1
                    pdfPDDoc.DeletePages pdfPDDoc.GetNumPages - 1, pdfPDDoc.GetNumPages - 1
            End If
    Loop
    pdfPDDoc.Close
    pdfAcroExchApp.Hide
    pdfAcroExchApp.Exit
    Name (pdfPath) As ("Q:\MSDS Temp\MSDStoMerge.pdf")

    Bernd,
    It was an omission on my part. I've included a save statement just before the close statement. Any thoughts of the "releasing" issue?
    Thanks,

  • How to search a word and its page in Acrobat 6.0 using vb6.0

    Hi all,
    I would like to search a word and its corresponding page number in my PDF document. The word may be occur in many of the pages and i have to collect all the page numbers and need to create bookmark for all of them.
    Eg: The word "Chennai" can be found in the pages 5, 6, 7 and10. Then I need to create bookmarks Chennai1 - Page 5, Chennai2 - Page 6 and so on...
    I have tried this with Acrobat 7.0 professional and it was working fine. But in 6.0 Professional i am not able to collect all the pages. Below I have given the code that i have used.
    Dim objFind As Acrobat.CAcroAVDoc
    Set objFind = CreateObject("AcroExch.AVDoc")
    Do While objFind.FindText("MyText", 0, 1, False)
                    Dim objPageView As Acrobat.CAcroAVPageView
                    Set objPageView = objFind.GetAVPageView
                    strPageNo = objPageView.GetPageNum + 1
                    If strPageNo = strPrevPageNo Then
                        intIncremental = intIncremental + 1
                    Else
                        intIncremental = 0
                    End If
                    If intIncremental > 50 Then
                        Exit Do
                    End If
                    If Val(strPageNo) < Val(strPrevPageNo) Then
                        Exit Do
                    End If
                    strPrevPageNo = strPageNo
    Loop
    Thanks in advance,
    Dhanasekaran. G

    Adobe no longer supports Acrobat 7 or earlier.

  • How do I call an object written in Plugin from Javascript in Acrobat 9.0?

    Hi,
    Since Acrobat 9.0 has no longer support  GetNumAVDocs() called in Javascript, it does not return number counter of opened pdf documents.
    I am looking for a way to write method GetNumAVDocs() or similar one in Plug-in. My questions are that
    1. Can we write the method  GetNumAVDocs() or similar in Plug-in?
    2. Can we integrate that method GetNumAVDocs() which written in Plug-in in Javascript or Can Javascript call that method GetNumAVDocs()?
    Any of your comments or advices are very helpful to me.
    Thanks a lot for your support,
    Thai Nguyen

    Hi lrosenth,
    Thank you for help so far. In fact we our codes have been using COM/ActiveX and AcroExch.App library along. These codes are working find with Acrobat 8.0, but they do not work with Acrobat 9.0 since the function GetNumAVDocs() is no longer working. It always returns 0, instead of maximum number of documents.
    I would like to attach the code along with PDF documents for you to take a look and help us. This zip file is test1.zip.  This zip file include a html file test1.html. This file includes HTML page and a number of Javascript/Activex functions. 
    The function getActiveDoc() is the target of the issue. It contains an AcroExch.App function GetNumAVDocs() which does not return a number of the maximum number of documents the Acrobat application can open on Acrobat 9.0. It always returns 0 regardless how many how many documents are opened.
    At the bottom of the source code is html page that called the function getActiveDoc()  at the <input>  tag.  <input type="button" value="Show Active Docs" onclick="getActiveDoc();">
    For testing this code, you unzip test1.zip file. Open test1.html on a web browser. It will load couple pdf files that include on test1.zip.  Click on button "Show Active Docs" that calls function getActiveDoc().  This function trigger GetNumAVDocs(). It then call alert(numdoc)  to display a value of number of opened documents.
    Thank you,
    Thai Nguyen
    -------------------------------The Codes below-------------------------------------
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Test for Adobe 8&amp;9</title>
    </head>
    <script type="text/javascript">
    function nextPage(){
    var acrobatpdf= document.getElementById("acrobatpdf");
    acrobatpdf.GotoNextPage();
    function prevPage(){
    var acrobatpdf= document.getElementById("acrobatpdf");
    acrobatpdf.GotoPreviousPage();
    function showToolbar(){
    var acrobatpdf= document.getElementById("acrobatpdf");
      acrobatpdf.setShowToolbar(1);
    function hideToolbar(){
    var acrobatpdf= document.getElementById("acrobatpdf");
      acrobatpdf.setShowToolbar(0);
    function loadfile(){
    var file = document.getElementById("file").value;
    alert(file);
    var acrobatpdf= document.getElementById("acrobatpdf");
    var rtn = acrobatpdf.LoadFile(file);
    alert(rtn);
    function getActiveDoc(){
    var acrobatapp= document.getElementById("acrobatapp");
    var numdoc = acrobatapp.GetNumAVDocs();
    alert(numdoc);
    for(i=0;i < numdoc;i++){
      actDoc = acrobatapp.getIEPDFDoc();
      var actDoc = acrobatapp.GetAVDoc(i);
      alert("item:"+i);
      if(actDoc!=null){
              var title = actDoc.GetTitle();
        alert(title);
      }else{
       alert("Null object");
    function findText(){
    var file = "D:\\lab\\adobe\\test1\\fcom012360.pdf";
    var text = document.getElementById("findtext").value;
    var acrobatapp= new ActiveXObject("AcroExch.App");
    var avdoc= new ActiveXObject("AcroExch.AVDoc");
    var acrobatpdf= document.getElementById("acrobatpdf");
    var x = acrobatpdf.LoadFile(file);
    alert(x);
    </script>
    <body>
    <div>
    <input type="button" value="Next Page" onclick="nextPage();">
    <input type="button" value="Prev Page" onclick="prevPage();">
    <input type="text" id="file" width="80">
    <input type="button" value="Load File" onclick="loadfile();">
    <input type="button" value="Show toolbar" onclick="showToolbar();">
    <input type="button" value="Hide toolbar" onclick="hideToolbar();">
    </div>
    <div>
    <input type="button" value="Show Active Docs" onclick="getActiveDoc();">
    <input type="text" id="findtext" width="80">
    <input type="button" value="Find Text" onclick="findText();">
    </div>
    <div>
        <OBJECT id="acrobatapp"
                classid="clsid:85DE1C45-2C66-101B-B02E-04021C009402">
        </OBJECT>
        <OBJECT id="avdoc"
                classid="clsid:72498821-3203-101B-B02E-04021C009402">
        </OBJECT>
        <OBJECT classid="clsid:CA8A9780-280D-11CF-A24D-444553540000"
                width="960" height="492" id="acrobatpdf"
                style="WIDTH: 784px; HEIGHT: 492px">
         <PARAM NAME="_cx" VALUE="26035">
            <PARAM NAME="_cy" VALUE="15663">
            <Param name="SRC" value="fcom012330.pdf">
        </OBJECT>
    </div>
    </body>
    </html>

  • .FindText() infinite loop problem

    My company has a need to count how many times certain words are in a PDF document while doing automated testing.  We're using QuickTest Professional and it's programming language is VBScript.  Now I attempted to use the example code from the SDK manual but when I run it it's in an infinite loop.  Once it's gone through the document one time, it jumps back up to the top and counts it again and continue doing this until I either kill the process or kill Acrobat.  My code is attached though it's not much different from the example.  If anyone could help I would be greatly appreciative.
    Option Explicit
    Dim AcroApp, AcroAVDoc
    Dim gPDFPath, bReset, nCount
    gPDFPath = "C:\Documents and Settings\HicksAM\Desktop\Organize Later\DemoDoc.pdf"
    Set AcroApp = CreateObject("AcroExch.App")
    'AcroApp.Show()
    Set AcroAVDoc = CreateObject("AcroExch.AVDoc")
    If AcroAVDoc.Open(gPDFPath, "") Then
         AcroAVDoc.BringToFront()
         bReset = 1 : nCount = 0
         Do While AcroAVDoc.FindText("DRIVER", True, True, bReset)
              bReset = false : nCount = nCount + 1
    '         If Window("Adobe Acrobat").Dialog("Adobe Acrobat").Exist(0) Then
    '               Window("Adobe Acrobat").Dialog("Adobe Acrobat").WinButton("OK").Click
    '               Exit Do
    '          End If
              Wait 0, 200
         Loop
    End If
    AcroApp.CloseAllDocs()
    AcroApp.Exit()
    Print "The word DRIVER was found " & nCount &" times."
    Set AcroApp = Nothing

    This is from the documentation that came with the SDK:
    "Since the JavaScript code runs slowly, it is not suitable for searching through a large PDF file."  I work for an insurance company and the documents can get
    quite lengthy. Not only that, I would need native methods to Acrobat that I can send directly from QTP without having to import specific header/import files.  Just as the example posted in the original post, I could actually get it to search correctly without using any of the SDK files, but it loops infinitely instead of stopping at the end of the PDF document.

Maybe you are looking for