3

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?)

allquixotic
  • 1,481
  • 2
  • 18
  • 37

2 Answers2

1

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.

noseratio
  • 59,932
  • 34
  • 208
  • 486
  • This is most puzzling, since Adobe **Reader** is not in the picture at all. Reader does not activate when opening an embedded PDF on this system; **Acrobat** does. `Acrobat.exe` runs when the PDF is displayed in a browser. Are you saying that when Acrobat is embedded in a browser window, it's only as capable as Reader? – allquixotic Mar 16 '15 at 21:22
  • @allquixotic, I'm saying that the set of APIs available on the `AxAcroPDFLib.AxAcroPDF` ActiveX control is the same, regardless of whether you have just Reader or full Acrobat installed on a particular PC. I believe the reason behind this is that this ActiveX was initially designed as IE plugin, and the set of APIs was deliberately limited to [these](http://help.adobe.com/livedocs/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/wwhelp/wwhimpl/js/html/wwhelp.htm?href=IAC_API_OLE_Objects.103.167.html&accessible=true). – noseratio Mar 16 '15 at 22:32
0

I have made a search, an I'd found this VBScript example:

Set acrobatApplication = CreateObject("AcroExch.App")
Set AVDoc = CreateObject("AcroExch.AVDoc")
Set gPDDoc = CreateObject("AcroExch.PDDoc")

If gPDDoc.Open("c:\adobe.pdf") Then
Set jso = gPDDoc.GetJSObject
Set oAdd = jso.addField("FirmaField1", "signature", 0, Array(20, 100,
100, 20))
Set oSign = jso.getField("FirmaField1")
Set ppklite = jso.security.getHandler("Adobe.PPKLite", True)

ppklite.login "1111", "c:\certificate_file.pfx"
oSign.signatureSign ppklite
ppklite.logout
end if

It is clear that he use there the AcroExch.PDDoc. Maybe you can run it from the browser, or the Javascript equivalent.

yucer
  • 4,431
  • 3
  • 34
  • 42