From 318048dfe1171b04f23e7f77cb43daad3ecf03fb Mon Sep 17 00:00:00 2001 From: blackbeam Date: Sun, 9 Dec 2018 18:56:11 +0300 Subject: [PATCH] Update for poppler v0.72.0 --- src/NodePopplerDocument.cc | 11 +++++++---- src/NodePopplerPage.cc | 8 ++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/NodePopplerDocument.cc b/src/NodePopplerDocument.cc index 139b50a..3c4d724 100644 --- a/src/NodePopplerDocument.cc +++ b/src/NodePopplerDocument.cc @@ -154,10 +154,13 @@ NAN_GETTER(NodePopplerDocument::paramsGetter) auto fileName = self->doc->getFileName(); if (fileName != NULL) { - info.GetReturnValue().Set( - Nan::New(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(c_str, fileName->getLength()) + .ToLocalChecked()); } else { diff --git a/src/NodePopplerPage.cc b/src/NodePopplerPage.cc index 984db79..0a61398 100644 --- a/src/NodePopplerPage.cc +++ b/src/NodePopplerPage.cc @@ -285,8 +285,12 @@ NAN_METHOD(NodePopplerPage::getWordList) v8result->Set(Nan::New("x2", 2).ToLocalChecked(), Nan::New(x2)); v8result->Set(Nan::New("y1", 2).ToLocalChecked(), Nan::New(y1)); v8result->Set(Nan::New("y2", 2).ToLocalChecked(), Nan::New(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;