Search code examples
internet-explorercomui-automationacrobat

How to access full Adobe Acrobat AcroExch COM API from Internet Explorer embedded object?


I have the following situation:

  • Internet Explorer 9 on Windows 7 SP1 32-bit
  • Adobe Acrobat Professional version 10
  • A webpage with code like this:

<object data="foo.pdf" src="foo.pdf">

Given that:

  • The default PDF reader on the system is Adobe Acrobat
  • Adobe Reader's browser plugin is suppressed in favor of Acrobat's plugin
  • Acrobat.exe is running when the plugin loads
  • I'm using Internet Explorer's COM automation (from Ruby, but that doesn't really matter) to obtain a reference to the object's AxAcroPDFLib.AxAcroPDF object

With this AxAcroPDFLib.AxAcroPDF object, I need to manipulate form fields, read text, and do other stuff that is perfectly reasonable to do with the AcroExch.PDDoc API, and then click a button on the webpage (using IE automation) to serialize the form fields to XML and save them to the webserver.

I need to test this "end to end" from a user perspective due to business requirements, so I can't just stuff values in the XML and see if the server takes them.

Is there any way to access the AcroExch.PDDoc APIs of the opened PDF document from the AxAcroPDFLib.AxAcroPDF reference, without saving the PDF to a file on disk and opening it in using AcroExch.App?

The problem is that if I save it to disk and re-open it in Acrobat, that file cannot be used to save and submit the form field data to the web server, as far as I know. (Or can it?)


Solution

  • Is there any way to access the AcroExch.PDDoc APIs of the opened PDF document from the AxAcroPDFLib.AxAcroPDF reference, without saving the PDF to a file on disk and opening it in using AcroExch.App?

    I don't think you can do this with AxAcroPDFLib.AxAcroPDF. Check "Developing for Adobe® Reader®", page 25 ("OLE automation"):

    On Windows, the only OLE automation supported for Adobe Reader is the PDF browser controls interface, which enables you to treat a PDF document as an ActiveX document within an external application. This makes it possible to load a file, move to various pages within the file, highlight a text selection, and specify various print and display options, as shown below.

    Further, there's a detailed list of the supported APIs, and you can also confirm that with OleView.

    It might be possible to develop an Adobe Acrobat plugin, but:

    Any plug-ins written for Adobe Reader must be Reader-enabled, which means that you will need to obtain permission and licensing from Adobe Systems.