Skip to main content
Participating Frequently
September 23, 2023
Question

c sharp: DLL for IJSMessageHandler Interface

  • September 23, 2023
  • 1 reply
  • 858 views

Task: C Sharp: Coverting PDF to MS Word

          Capture return messages Acrobat translation function.

 

I downloaded Acrobat_DC_SDK_Windows_2021_v3 refereced Interop.Acrobal.dll

 

IJSMessageHandler   is not found. 

Please provide link to download the required DLL.

 

 
MyJSMessageHandler: IJSMessageHandler   <***************
{
   public void OnMessage( string msg )
  {
     MessageBox.Show(msg);
   }
}
 
AcroPDDoc pdfDoc = new AcroPDDoc();
pdfDoc.Open("sourcPDF.pdf");
Object jsObj = pdfDoc.GetJSObject();
 
jsObj.MessageHandler = handler;     <*******************
 
type = jsObj.GetType();
object[] saveAsParam = { "targetWord.docx", "com.adobe.acrobat.docx" };
type.InvokeMember(
    "saveAs",
    BindingFlags.InvokeMethod |
    BindingFlags.Public |
    BindingFlags.Instance,
null, jsObj, saveAsParam);
 
Thanks for your help.

 

 

 

This topic has been closed for replies.

1 reply

Thom Parker
Community Expert
Community Expert
September 25, 2023

You don't download the interop, you generate it. Have you seen this article?

https://learn.microsoft.com/en-us/dotnet/framework/interop/how-to-generate-interop-assemblies-from-type-libraries

 

Also, it's "Interop.Acrobat.dll". I'm assuming that's a typo.

 

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
LL123LAuthor
Participating Frequently
September 25, 2023

Hi Thom,  

 

Installed: Acrobat Version: 2021.005.20058

 

In CMD window, I ran tlbimp on the C:\Program Files (x86)\Acrobat\Acrobat DC\Acrobat\acrobat.tlb

 

I removed the solution's Interoop.Acrobat.dll and used this newly created dll.  Tthere are many Reference Errors - Not Recogzized:

 

using Acrobat;  

IJSMessageHandler

AcroPDDoc pdfDoc = new AcroPDDoc();

 

Where else on my system can I find the correct "tlb".  Is there an Adobe download link ?

 

tlbimp acrobat.tlb /out: Interop.Acrobat.dll
Microsoft (R) .NET Framework Type Library to Assembly Converter 4.8.3928.0
Copyright (C) Microsoft Corporation. All rights reserved.

TlbImp : warning TI3019 : Interface 'CIConnectionPointContainerProxy' is marked as [dual], but does not derive from IDispatch. It will be converted as an IUnknown-derived interface.
TlbImp : warning TI3019 : Interface 'CIConnectionPointProxy' is marked as [dual], but does not derive from IDispatch. It will be converted as an IUnknown-derived interface.
TlbImp : Type library imported to C:\Temp\Interop.Acrobat.dll

 

Yes - Just Type in this post.  "Also, it's "Interop.Acrobat.dll". I'm assuming that's a typo"

 

Thx for help.

Thom Parker
Community Expert
Community Expert
September 27, 2023

Hmm, that's a bummer. I think maybe you are going down the wrong path.

I would suggest a different route.

Have you tried the SDK C# samples?  Do they work correctly?

Have you tried to implement this using VB? Just as a test for the IAC functionality you want to use.

 

 

 

 

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