简体   繁体   中英

How to load dll file in acrobat javascript?

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM