Skip to main content
Participant
January 24, 2019
Question

Error Digital Signature C# Acrobat Sdk

  • January 24, 2019
  • 1 reply
  • 585 views

Hi.
I am creating an application to sign a pdf from c #.
I am currently having the following problem:

System.Runtime.InteropServices.COMException: 'Nombre desconocido. (Excepción de HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME))'

This is the code:

            Type AcrobatCAcroAppType;

            AcrobatCAcroAppType = Type.GetTypeFromProgID("AcroExch.app");

            Acrobat.CAcroApp gapp = (Acrobat.CAcroApp)Activator.CreateInstance(AcrobatCAcroAppType);

            Type AcrobatPDDocType;

            AcrobatPDDocType = Type.GetTypeFromProgID("AcroExch.PDDoc");

            Acrobat.CAcroPDDoc gpddoc = (Acrobat.CAcroPDDoc)Activator.CreateInstance(AcrobatPDDocType);

            object jso;

            if (gpddoc.Open("C:\\Users\\tmuñoz\\Desktop\\PDFs Para firmar\\Thuban-Nivel 2.pdf"))

            {

                jso = gpddoc.GetJSObject();

                object[] param = new object[1];

                param[0] = "C:\\Users\\tmuñoz\\Desktop\\ThomasMuñoz.pfx";

                object con = jso.GetType().InvokeMember("SetUserDigitalIDPath",

                BindingFlags.InvokeMethod, null, jso, param);

                param[0] = "testpassword";

                con = jso.GetType().InvokeMember("SetUserPassword",

                BindingFlags.InvokeMethod, null, jso, param);

                param[0] = jso;

                con = jso.GetType().InvokeMember("AddSignature",

                BindingFlags.InvokeMethod, null, jso, param);

            }

I think the error comes from not finding these functions in the JSO object.
From what I understand these are the sdkAddSignature file.
So I guess I should integrate it into the C # project, but I do not know how to do it.

This topic has been closed for replies.

1 reply

Thom Parker
Community Expert
Community Expert
January 24, 2019

What happens when you run the same JavaScript from the console window? This has to work first, before you can do it from the IAC. 

There are many issues related to translating between .Net objects and JavaScript objects. It's best to avoid them as much as possible by writing all the JS as a folder level function, then calling the function from the IAC.

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often