How to load dll file in acrobat javascript?

264 Views Asked by At

Here are my steps to load dll in js file var x = callFunction();

function callFunction()
{

var mylib =  new ExternalObject ("lib:fullPath:PrintableInt.dll"); 

var a = new PrintableInt(1);

alert(a);
mylib.unload();    
}

I am getting error at new PrintableInt(1); line stating that PrintableInt does not have constructor

-- I am using adobe ExtendScript Toolkit

-- I am following below links: Page 200 Indirect Access https://www.adobe.com/content/dam/Adobe/en/devnet/scripting/pdfs/javascript_tools_guide.pdf

I have written c++ class for dll as below

PrintableInt.h

#pragma once
// PrintableInt.h 
#pragma once 
#include <string>
class PrintableInt 
{ public:   
// Constructor  
PrintableInt(int value);  
// Converts the int into a string.   
std::string toString() 
const; private:   
int m_value; 
};

PrintableInt.cpp

include "stdafx.h"
include "PrintableInt.h" 
include <sstream> 
PrintableInt::PrintableInt(int value) 
{   m_value = value; } 
std::string PrintableInt::toString() const 
{ 
std::ostringstream builder;   
builder << m_value;   
return builder.str(); 
}

Please provide your feedback.

Thanks in advance

1

There are 1 best solutions below

0
On

Acrobat uses its own variant of JavaScript (Acrobat JavaScript), which has not much in common with ExtendScript, except the JavaScript Core.

You'd have to refer to the Acrobat JavaScript documentation.