Skip to main content
Participating Frequently
May 18, 2016
Question

sdkAddSIgnature.js called from VB app works only when Acrobat is running

  • May 18, 2016
  • 3 replies
  • 2054 views

Environment:

  • Visual Studio 2015 Community,
  • Adobe Acrobat Installed,
  • Acrobat SDK downloaded and sdkAddSIgnature.js script copied to Adobe\Javascripts (visible at Edit menu -> Acrobat SDK JavaScript in Acrobat)

I have this situation:

- standard sdkAddSIgnature.js script copied from SDK

- simple code of VB.Net app:

Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        Dim gapp As Acrobat.CAcroApp

        Dim gpddoc As Acrobat.CAcroPDDoc

        Dim jso As Object

        gapp = CreateObject("acroexch.app")

        gpddoc = CreateObject("acroexch.pddoc")

        Dim args() As String = Environment.GetCommandLineArgs()

        If gpddoc.Open("c:\Temp\report.pdf") Then

            jso = gpddoc.GetJSObject()

            jso.SetUserDigitalIDPath("/C/Temp/cert.pfx")

            jso.SetUserPassword("***")

            jso.AddSignature(jso)

            gpddoc.Save(0, "c:\Temp\report.pdf")

            gpddoc.Close()

            Me.Close()

        End If

    End Sub

End Class

After hours of misery trying to get sdkAddSIgnature.js working with VB.Net app I came to conclusion, that it works only when I have Acrobat running!

When Acrobat is closed my app does not sign PDF file, but only creates empty field for signing and that's it. There is no content in that field and when I click on it - tool window for signing document appears ob screen.

Situation changes when I run Acrobat - then signing PDF files with this app works OK.

As I read Acrobat DC SDK documentation ...

To obtain a security handler (the oSig parameter), invoke the security object getHandler method. The method, which returns a security handler object, takes the following parameters:

cName — The name of the security handler (contained in the security object’s handlers property)

bUIEngine — If true, the method returns the existing engine associated with the Acrobat user interface; if false, the default, it returns a new engine.

so script line:

var myEngine = security.getHandler(DigSigHandlerName);

(DigSigHandlerName being "Adobe.PPKLite") means, that new engine should be returned.

In my case, it appears like it VB app works good only when there is Acrobat running, hence -> when there is existing engine.

One thing left to say - Acrobat javascript debugging showed GeneralError ...

Please let me know how can I resolve that problem, to run VB app with stable result (signed PDF in this case) without Acrobat running all the time.

This topic has been closed for replies.

3 replies

Legend
May 19, 2016

1. The word "engine" here should not be taken as meaning "a background process separate from Acrobat". It's just a part of Acrobat. Believe it from developers who have worked with Acrobat for many years, there is NO ACROBAT ENGINE RUNNING OUTSIDE ACROBAT. Or don't believe it, but it won't help!

2. You would probably need to subscribe, but tech support, the normal route, is irrelevant. You'd need to buy developer support, I believe it is $200/case. If you find out how to buy a case, please let us know.

gg5001Author
Participating Frequently
May 19, 2016

1. Yes, I know Acrobat engine is not a separate process, it's just terminology taken from documentation - "getHandler method returns an engine" and I believe it's Acrobat what they mean

Legend
May 19, 2016

There is no "Acrobat engine". There is only Acrobat. It might be visible or invisible, but it does the job in all cases. You can of course start it and quit it like other apps.

You should probably consider this: the Acrobat SDK is a tool for very light duty automation of an interactive tool. Nothing else. You may also have found a bug and would need to create a developer support case if it is happening in the current version (DC).

gg5001Author
Participating Frequently
May 19, 2016

@Test Screen Name - by "Acrobat engine" I mean Acrobat.

anyway ... may be I should start by asking for right direction - I'm trying to build app with functionality of 'automatic' PDF digital signing - is there another way to do that? Other Adobe APIs, tools?

lrosenth
Adobe Employee
Adobe Employee
May 19, 2016

Provided that this automation is happening only for a single user – one that is licensed for Acrobat usage (vs. some sort of server or multiple user automation tool) – then what you are doing is fine.

Legend
May 18, 2016

It's quite a strange description of the problem, because the Acrobat SDK does nothing by itself. When the Acrobat SDK is working, through OLE or anything else, it runs Acrobat. So Acrobat WILL BE RUNNING. It might be invisible, but it will be running. So the difference here seems to be that Acrobat has to be visible for this to work. So I guess, just let it be visible throughout - should be no big problem.  The Acrobat SDK is simply a tool for automating the UI application.

gg5001Author
Participating Frequently
May 19, 2016

The problem is that I have to run Acrobat manually to get VB app working. If I don't - result is as I described - PDF file with empty field.

I'm aware that SDK uses Acrobat engine, but I guess it's not supposed to be started manually,  to take benefit from running your app afterwards.

Legend
May 19, 2016

Why not just start it manually, or make sure it is running before the user clicks to run your signing app?