VBA将数字签名添加到PDF

时间:2020-11-03 00:05:48

标签: excel vba pdf runtime-error adobe

我要在特定的PDF文件中添加数字证书签名的宏问题。

我不断收到运行时错误424:必需的对象错误。

有人知道这可能是什么参考吗?我相信我添加了正确的内容,但不是肯定的。

我相信这将解决Set PPKLite = jso.security.getHandler("Adobe.PPKLite", True)

的问题

这也是我其余的代码!

有什么建议吗?

Sub PDFSig()

Dim test As Boolean

Set acrobatApplication = CreateObject("AcroExch.App")

Dim gPDDoc As Acrobat.CAcroPDDoc

Set gPDDoc = CreateObject("AcroExch.PDDoc")

gPDDoc.Open Environ$("userprofile") & "A:\Corporate\Data\Financial\YE2020\Utilities\Month 10\Journal Entries\Robert\PDF File\Cost Transfer - 70145173 - 0100771347.pdf"

Set PPKLite = jso.security.getHandler("Adobe.PPKLite", True)
Set jso = gPDDoc.GetJSObject

test = PPKLite.login(InputBox("Please enter your password"), "C:\Users\hanlonr\OneDrive - Aecon\Desktop\RobertHanlon.pfx")
Set oAdd1 = jso.AddField("Action Form Preparer Signature", "signature", 0, Array(173, 175, 355, 130))
Set oSign1 = jso.GetField("Action Form Preparer Signature")
Set oAdd2 = jso.AddField("Authorized Signer", "signature", 0, Array(173, 130, 355, 86))
Set oSign2 = jso.GetField("Authorized Signer")
oSign1.signatureSign PPKLite

PPKLite.logout

End Sub

0 个答案:

没有答案