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

做~自己de王妃 提交于 2021-02-19 04:24:34

问题


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


回答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.




回答2:


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.



来源:https://stackoverflow.com/questions/29035257/how-to-access-full-adobe-acrobat-acroexch-com-api-from-internet-explorer-embedde

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!