Skip navigation
jinny201209
Currently Being Moderated

Creating a AcroAVDoc give me an error message

Sep 6, 2012 2:02 PM

Tags: #acrobat #api #.net #c# #acrobat_reader

I am trying to read the the content from a pdf file programmatically with C#, by adding reference to Acrobat.dll in the project and use APIs 

 

This is the code which give me an error message "There was an error opening this document. This file cannot be found."

 

public String getText()

{

            AcroAVDoc pdfDoc = new AcroAVDoc();

            if (pdfDoc.Open(FileName, ""))

            {

                 AcroPDPage page;

                 AcroPDDoc pdf = (AcroPDDoc)pdfDoc.GetPDDoc();

                 int pages = pdf.GetNumPages();

              ......

}

 

My project file was successfully build. Through debugging, I found the error message was shown just running the above line of code in red.

I also tested that opening PDF file in windows file browser, it works fine.

 

Does anybody have the same problem before?

 
Replies
  • Currently Being Moderated
    Sep 6, 2012 2:23 PM   in reply to jinny201209

    I've seen this in C# where people have overlooked the rules for using \ in a string and just written something like FileName="C:\Dir\Thing.pdf"

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 6, 2012 2:38 PM   in reply to jinny201209

    Oh, ok.

    1. Be sure you don't just have Adobe Reader installed. You need a full copy of Acrobat.

    2. Sometimes it seems necessary to create an AcroExch.App object first.

    3. I have found debuggers can be misleading. Did you try adding a message after the new AcroAVDoc to see if it actually passed that line?

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 6, 2012 2:42 PM   in reply to Test Screen Name

    Make sure you have a copy of the SDK and associated documentation and have read it and looked at the samples.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 6, 2012 3:04 PM   in reply to jinny201209

    Just to clarify the meaning of the comma in " I have Adobe Acrobat 9 Standard, Adobe Reader 9.3.4 installed". Do you mean that you have both of these products installed, the purchased Acrobat and the free Adobe Reader?

     

    This can cause problems; try starting Acrobat first to make sure Reader doesn't get involved.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 6, 2012 3:22 PM   in reply to jinny201209

    It's a tricky one unless you take a brute force approach. Just start Acrobat at the start of the code - it will only start once. However, that won't close Reader.  I think in 10.0 they are independent, in 9.0 only one can run.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 7, 2012 4:46 AM   in reply to Test Screen Name

    Yes, as of Acrobat/Reader X, you can explicitly target one or the other – the conflict no longer happens.

     

    So upgrade ☺.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points