OLE automation for Acrobat 10

I am controlling Acrobat Pro 10 from MS Excel. Can I get a link to the VBA library with the correct Excel VBA syntax for available commands? I have already successfully tested a subset of commands in the API reference manual because they are documented in the Acrobat Object library in MS Excel. The commands that I have verified are in the AcroApp, AcroAVDoc and AcroPDDoc classes. There is a good reference link http://livedocs.adobe.com/acrobat_sdk... nces/Acrobat_API_Reference/index.html but it refers to the API reference. The API reference is not friendly for my VBA library because it is a small subset of the overall API. Bottom line

1) a specific object reference with syntax for all available Acrobat Pro 10 OLE in VBA for Excel

and/or

2) a method to execute any Acrobat Pro 10 menu command with syntax, and library of the specific command menu names to use with the VBA function MenuItemExecute.




Robert Caddy Jr


3 Answers

Yeah, it's all a bit confusing. Acrobat has two ActiveX interfaces, the IAC and the browser plug-in. You want the IAC (inter-application communication) interface. The browser plug-in won't do you any good.

One of your best sources of info (besides the IAC reference at livedocs) is the SDK download. Which you can get here: http://www.adobe.com/devnet/acrobat.html

It contains several example VB projects which show exactly how to connect to a document open in Acrobat/Reader.

I'm sure you don't really want to execute menu items in Acrobat. There are normally much more reliable ways to get something done, especially if you are running from a VBA macro in Excel. What is it that you are trying to accomplish?


Thom Parker
The source for PDF Scripting Info pdfscripting.com
All About PDF Stamps in Acrobat and Paperless Workflows - THE BOOK !!

The Acrobat JavaScript Reference, Use it Early and Often

The most important JavaScript Development tool in Acrobat
The Console Window (Video tutorial)
The Console Window(article)

Having trouble, Why Doesn't my Script Work


Thom Parker   

Yeah, it's all a bit confusing. Acrobat has two ActiveX interfaces, the IAC and the browser plug-in. You want the IAC (inter-application communication) interface. The browser plug-in won't do you any good.

One of your best sources of info (besides the IAC reference at livedocs) is the SDK download. Which you can get here: http://www.adobe.com/devnet/acrobat.html

It contains several example VB projects which show exactly how to connect to a document open in Acrobat/Reader.

I'm sure you don't really want to execute menu items in Acrobat. There are normally much more reliable ways to get something done, especially if you are running from a VBA macro in Excel. What is it that you are trying to accomplish?


Thom Parker

Thanks for the response Thom. You are correct I do not really want to run Acrobat from Excel. Here is the project.

1) I have a scanned all of my personal documents into a nice PDF library.

2) Now I would like to automate some of the maintenance tasks of this library by reading selective content from the PDF document and then taking actions in the library.

3) One example is to collect key infomation such as the date of a bill or the amount of a receipt and then rename the file or extract the information into a spread sheet.

4) The only method that I have found is to run OCR and save the file into a text file and then perform a search on the text file. In theory the search command in Acrobat can find fields but it is not flexible enough to search for a key word such as "total" and then pick up the adjacent data as the total amount.

5) I have also found that OCR is quite noisy and unreliable because of the quality of some of my scans and documents so I have to perform cross checking to qualify the data.

6) With Acrobat it seems difficult to process the same operation or series of operations on many files and then return a result to another application so that I can automate the process.

7) VBA in Excel does a nice job of supporting this and has good documentation if can get the data extracted from the PDF.

Thanks for any further help. Adobe documentation is very diffuse or should I say distributed and it has been difficult for me to get current and direct information on Acrobat 10.


Robert Caddy Jr   

There are no off the shelf solutions for this type of issue. Mainly because the real world solutions are too diverse. I've developed several projects similar to what you've described, each one was unique, and you've pretty much outlined the issues from which all of them suffered: bad scans produce bad results and it is often difficult to automatically find data at an arbitrary location on a page. There's really not much you can do about a bad scan except get better OCR software. The built in Acrobat OCR has gotten better with each version, but it still has it's limitations.

As for data extraction, the most regular documents produce the best automation results. I don't necessarily mean that the data has to always be in the same location (although this helps a lot). You can get great results if the data has a unique characteristic. For example, if you can guarantee that the an invoice number will always be preceded by the words "Invoice Number", then it's easy to find it on the page. It gets messy and difficult when there are lots of variations and mixed methods. The more straightforward the task the easier it is to write the extraction algorithm and the cheaper and easier for you.

One technique for getting around all the is messiness is to write a tool that lets you draw rectangles around the data, then displays a dialog for you to enter/select the info that will be used to stuff it into Excel. This one requires more interaction, but is more flexible than trying to do full automation. It's a trade off.

No matter which way you go, the "PDF Data Extraction to Excel" workflow has two separate parts. 1) a tool in Acrobat for extracting the data, and 2) a Macro in Excel for moving the extracted data from the PDF into Excel. You write the Acrobat part in JavaScript. Look at the doc.getNthWord() and doc.getNthWordQuads() functions. Once you've extracted the data, the best place to put it is a file attachment. It's this file attachment that is acquired by Excel.

This type of tool can be really complex. Good Luck.


Thom Parker   


Please specify a reason: