Skip to content

Commit

Permalink
Update for poppler v0.72.0
Browse files Browse the repository at this point in the history
  • Loading branch information
blackbeam committed Dec 9, 2018
1 parent 12d4b3d commit 318048d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
11 changes: 7 additions & 4 deletions src/NodePopplerDocument.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,13 @@ NAN_GETTER(NodePopplerDocument::paramsGetter)
auto fileName = self->doc->getFileName();
if (fileName != NULL)
{
info.GetReturnValue().Set(
Nan::New<String>(fileName->getCString(),
fileName->getLength())
.ToLocalChecked());
#if POPPLER_VERSION_MAJOR == 0 && POPPLER_VERSION_MINOR < 72
auto c_str = fileName->getCString();
#else
auto c_str = fileName->c_str();
#endif
info.GetReturnValue().Set(Nan::New<String>(c_str, fileName->getLength())
.ToLocalChecked());
}
else
{
Expand Down
8 changes: 6 additions & 2 deletions src/NodePopplerPage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,12 @@ NAN_METHOD(NodePopplerPage::getWordList)
v8result->Set(Nan::New("x2", 2).ToLocalChecked(), Nan::New<Number>(x2));
v8result->Set(Nan::New("y1", 2).ToLocalChecked(), Nan::New<Number>(y1));
v8result->Set(Nan::New("y2", 2).ToLocalChecked(), Nan::New<Number>(y2));
v8result->Set(Nan::New("text", 4).ToLocalChecked(), Nan::New(str->getCString()).ToLocalChecked());

#if POPPLER_VERSION_MAJOR == 0 && POPPLER_VERSION_MINOR < 72
auto c_str = str->getCString();
#else
auto c_str = str->c_str();
#endif
v8result->Set(Nan::New("text", 4).ToLocalChecked(), Nan::New(c_str).ToLocalChecked());
v8results->Set(i, v8result);

delete str;
Expand Down

0 comments on commit 318048d

Please sign in to comment.