Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
5

c sharp: DLL for IJSMessageHandler Interface

Community Beginner ,
Sep 23, 2023 Sep 23, 2023

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.

 

 

 

873
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 25, 2023 Sep 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-t...

 

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

 

 

 

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 25, 2023 Sep 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 27, 2023 Sep 27, 2023
LATEST

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 PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines