Windows Develop Bookmark and Share   
 index > Windows Forms General > Automate PDF reading
 

Automate PDF reading

Hi,

I am trying to use the acrobat reader to read and view the pdf file. When I am using the acroPDF it works fine except it doesn't have the function of searching text (that opens the search panel and do the search).

I have tryed objects like AcroExch.AVDoc but it can't create the type defenition of it and it said that a class doesn't registered. I checked it in registry. It doesn't exist there. Here the example of code:

<code>

// Create an Acrobat Application object

Type AcrobatAppType;

AcrobatAppType = Type.GetTypeFromProgID("AcroExch.App");

Acrobat.CAcroApp oAdobeApp = (Acrobat.CAcroApp)Activator.CreateInstance(AcrobatAppType);

// Create an Acrobat Document object;

Type AcrobatPDDocType;

AcrobatPDDocType = Type.GetTypeFromProgID("AcroExch.PDDoc");

Acrobat.CAcroPDDoc oAdobePDDoc = (Acrobat.CAcroPDDoc)Activator.CreateInstance(AcrobatPDDocType);

// Create an Acrobat AV Document object;

Type AcrobatAvType;

AcrobatAvType = Type.GetTypeFromProgID("AcroExch.AVDoc");

Acrobat.CAcroAVDoc oAdobeAVDoc = (Acrobat.CAcroAVDoc)Activator.CreateInstance(AcrobatAvType);

</code>

I have also tryed to use IEBrowser control and sending to it the ling with parameters. It works on some computers. In some cases it doesn't show the search panel but showing the PDF file. In some cases it doesn't show the PDF file and give me a not find file message.

So I need the control of viewing PDF and I need to send to this control that starts serching and show all results.

Can somebody suggest me the solution of this?

Thank's
Alexei

Alexei_shk  Monday, December 11, 2006 8:53 AM
Sounds like you are using acropdf.dll that comes with the free download of Acrobat Reader. It is very limited; basic navigation, load and print, that's about it. You'll have to purchase a license to the retail version to get the AcroExch automation object.
nobugz  Saturday, January 13, 2007 6:59 PM

Have you considered using the inherent javascript functions in reader? I've not tried the search myself, but I checked the API (do a search for js_api_reference.pdf), and it looks like there is a search function. The following code is a snippet from something I've developed in VB.NET . . . perhaps it might help you out. The last line shows accessing the JSObject, and from there it's calls per the API.

Dim AcrobatAppType As Type = Nothing

Dim app As Acrobat.CAcroApp = Nothing

Dim AVDoc As Acrobat.CAcroAVDoc = Nothing

Dim PDDoc As Acrobat.CAcroPDDoc = Nothing

AcrobatAppType = Type.GetTypeFromProgID("AcroExch.App")

If AcrobatAppType Is Nothing Then

throw new Exception ("could not create type")

End If

Dim result As Object = Activator.CreateInstance(AcrobatAppType)

If result Is Nothing Then

throw new Exception ("empty result")

End If

app = CType(result, Acrobat.CAcroApp)

AVDoc = CType(app.GetAVDoc(0), Acrobat.CAcroAVDoc)

PDDoc = CType(AVDoc.GetPDDoc(), Acrobat.CAcroPDDoc)

Dim jso As Object = PDDoc.GetJSObject()

DaxMarekWesterman  Saturday, January 13, 2007 5:16 PM
Sounds like you are using acropdf.dll that comes with the free download of Acrobat Reader. It is very limited; basic navigation, load and print, that's about it. You'll have to purchase a license to the retail version to get the AcroExch automation object.
nobugz  Saturday, January 13, 2007 6:59 PM
You're best bet is to ask this question on an Adobe developer forum. see http://www.adobe.com/support/forums/
Peter Ritchie  Sunday, January 14, 2007 1:10 AM

You can use google to search for other answers

Custom Search

More Threads

• How to Show same controls on multiple tabpages
• Form size differences between O/S's
• Simulating doubleClick events on MonthCalendar controls
• Would this work using PostMessage?
• How can I send data from my program to running program?
• Read XML data from SQL 2005 table
• How can I use fonts othern than TrueType and OpenType fonts in Windows Forms
• new listing contacts in a list box from outlook.
• How Can I display a trnslated column in a Datagridview?
• c# program not reflecting changes made when running