Planet PDF Forum Archive

Planet PDF ForumWowsers! This is page is old, head to the LIVE Planet PDF Forum. It features more than 10 conferences, covering everything from beginner to in-depth developer and pre-press discussions. If you wish to continue... one & two archive covers 1999-2011 (160,000 pages).

New Forum | Previous | Next | (P-PDF) Developers

Topic: Urgent !! PDF Security using JSO and VB
Conf: (P-PDF) Developers, Msg: 108153
From: Ashish_Sharma
Date: 3/23/2004 09:36 PM


I want to secure PDFs by signing the documents using signer's digital certificate and encrypt it using recipients' digital certificates. I am getting following problems :

1. I have succeeded in signing document using JavaScript Object and Visual Basic but not able to provide extra attributes defining Name, Location and Reason
I used PPKlite to login to a pfx (Certificate) file..

Code Snippet

Set g_PDDoc = g_AVDoc.GetPDDoc
Set jso = g_PDDoc.GetJSObject
Set PPKLite ="Adobe.PPKLite", False)
login = PPKLite.login(strPathOfCertificateFile, strPassword)

Set formApp = CreateObject("AFormAut.App")
Set acroForm = formApp.Fields
Set field = acroForm.Add("Signature", "signature", 0, 450, 720, 600, 790)
field.SetBorderColor "RGB", 0.7, 0.2, 0#, 0
Set oSign = jso.getField("Signature")
oSign.signatureSign <-- Here When I give HandlerName PPKLITE and Signature Info, I get Error and with out these parameters, it is signing but I have to compromise with the absence of signature Info like Name and location etc.

And when I try to use field.ExecuteThisJavascript method in VB, it gives me error :

Code Snippet
Dim strJSCode As String

strJSCode = "var ppklite = security.getHandler(""Adobe.PPKLite"");" & vbCrLf
strJSCode = strJSCode & "ppklite.login(""dummyPassword"", ""/C/replytoashish.pfx"");" & vbCrLf
strJSCode = strJSCode & "var f = this.addField(""Signature"", ""signature"", 0, [0,0,0,0]);" & vbCrLf
strJSCode = strJSCode & "var g = this.getField(""Signature"");" & vbCrLf
strJSCode = strJSCode & "g.signatureSign(ppklite, {password: ""dummypassword"", location: ""New Delhi"",
reason: ""I am approving this document"",contactInfo:"""",appearance:""NewGen""});"

strJSCode = strJSCode & "ppklite.logout();"

MsgBox (strJSCode)
v = fields.ExecuteThisJavascript(strJSCode) <---- This does nothing but shows following Error in Javascript Debugger Console in Acrobat Pro.

NotAllowedError: Security settings prevent access to this property or method.
security.getHandler:1:External undefined:Exec

Is it that I can not sign and encrypt a document using ExecuteThisJavascript using Javascript Object, as I get same above error when I try to write code for encryption using PPKMS security Handler.

2.Using JSO and Visual Basic, I get error when I try to connect to one of the directories like :

Code Snippet

Set PPKMS ="Adobe.PPKMS", True)
Set oDirectory = PPKMS.Directories(1) <---- This giver Automation Error

Where as its equivalent javascript code runs perfectly in Javascript Debugger Console but in that also I am not able to search for a certificate using email id in the store, as it shows its values of properties like CanStandardSearch and CanCustomSearch as false...



PDF In-Depth Free Product Trials Ubiquitous PDF

Debenu Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link...

Download free demo

Debenu PDF Tools Pro

It's simple to use and will let you preview and edit PDF files, it's a Windows application that makes...

Download free demo

Five visions of a PDF Day

In the world of PDFs or as we like to say Planet (of) PDF, a year isn't a real PDF year without an intense few days of industry knowledge sharing.

May 15, 2018
Platinum Sponsor

Search Planet PDF
more searching options...
Planet PDF Newsletter
Most Popular Articles
Featured Product

Debenu PDF Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link control. Take Acrobat to the next level.


Adding a PDF Stamp Comment

OK, so you want to stamp your document. Maybe you need to give reviewers some advice about the document's status or sensitivity. This tip from author Ted Padova demonstrates how to add stamps with the Stamp Tool along with related comments.