如何从 Internet Explorer 嵌入对象访问完整的 Adob​​e Acrobat AcroExch COM API?

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

我有以下情况:

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

鉴于:

有了这个 AxAcroPDFLib.AxAcroPDF 对象,我需要操作表单字段、阅读文本,以及做其他完全可以用 AcroExch.PDDoc API 做的事情,然后单击网页上的一个按钮(使用 IE 自动化)将表单字段序列化为 XML 并将它们保存到网络服务器。

由于业务需要,我需要从用户的角度来测试这个 "end to end",所以我不能只在 XML 中填充值并查看服务器是否接受它们。

有没有办法从 AxAcroPDFLib.AxAcroPDF 参考访问打开的 PDF 文档的 AcroExch.PDDoc API, 不保存 PDF 到磁盘上的文件并使用 AcroExch.App 打开它?

据我所知,问题是如果我将它保存到磁盘并在 Acrobat 中重新打开它,则该文件不能用于保存表单域数据并将其提交到 Web 服务器。 (还是可以?)

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?

我不认为你可以用 AxAcroPDFLib.AxAcroPDF 做到这一点。检查 "Developing for Adobe® Reader®",第 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.

此外,还有一个详细的支持API列表,你也可以通过OleView确认。

可能 可以开发 Adob​​e Acrobat 插件,但是:

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.

我进行了搜索,找到了 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

很明显他在那里使用AcroExch.PDDoc。也许您可以从浏览器 运行 或 Javascript 等价物。