public
Created

  • Download Gist
foo.cc
C++
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
#include <node.h>
#include <v8.h>
 
#ifndef UNIX
#define UNIX
#define UNIX_64
#endif
 
#include <scctype.h>
#include <sccex.h>
 
using namespace v8;
 
Handle<Value> convert (const Arguments& args) {
HandleScope scope;
return scope.Close(Undefined());
}
 
void initialize (Handle<Object> target) {
VTDWORD loadSettings = OI_INIT_DEFAULT | OI_INIT_NOSAVEOPTIONS | OI_INIT_NOLOADOPTIONS;
// initialize data access module
if (DAInitEx(DATHREAD_INIT_NOTHREADS, loadSettings) != DAERR_OK)
ThrowException(Exception::TypeError(String::New("failed to initialize pdf export engine")));
// export convert function
target->Set(String::NewSymbol("convert"), FunctionTemplate::New(convert)->GetFunction());
}
 
NODE_MODULE(topdf, initialize)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.