Skip to content

Instantly share code, notes, and snippets.

@ryancole
Created November 11, 2012 00:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryancole/4053133 to your computer and use it in GitHub Desktop.
Save ryancole/4053133 to your computer and use it in GitHub Desktop.
#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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment