diff --git a/CMakeLists.txt b/CMakeLists.txt index 6de85df..3cb389e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,13 @@ add_custom_target(dist WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) find_package(PkgConfig) -pkg_check_modules(POPPLER REQUIRED poppler>=0.20.0) +pkg_check_modules(POPPLER poppler>=0.23.0) +if(POPPLER_FOUND) + set(POPPLER_OLDER_THAN_0_23_0 0) +else() + set(POPPLER_OLDER_THAN_0_23_0 1) + pkg_check_modules(POPPLER REQUIRED poppler>=0.20.0) +endif() include_directories(${POPPLER_INCLUDE_DIRS}) link_directories(${POPPLER_LIBRARY_DIRS}) set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${POPPLER_LIBRARIES}) diff --git a/src/BackgroundRenderer/SplashBackgroundRenderer.cc b/src/BackgroundRenderer/SplashBackgroundRenderer.cc index a982149..5385f4d 100644 --- a/src/BackgroundRenderer/SplashBackgroundRenderer.cc +++ b/src/BackgroundRenderer/SplashBackgroundRenderer.cc @@ -27,9 +27,17 @@ const SplashColor SplashBackgroundRenderer::white = {255,255,255}; * And thus have modified region set to the whole page area * We do not want that. */ +#if POPPLER_OLDER_THAN_0_23_0 +void SplashBackgroundRenderer::startPage(int pageNum, GfxState *state) +#else void SplashBackgroundRenderer::startPage(int pageNum, GfxState *state, XRef *xrefA) +#endif { +#if POPPLER_OLDER_THAN_0_23_0 + SplashOutputDev::startPage(pageNum, state); +#else SplashOutputDev::startPage(pageNum, state, xrefA); +#endif clearModRegion(); } diff --git a/src/BackgroundRenderer/SplashBackgroundRenderer.h b/src/BackgroundRenderer/SplashBackgroundRenderer.h index 1c5be7e..1301354 100644 --- a/src/BackgroundRenderer/SplashBackgroundRenderer.h +++ b/src/BackgroundRenderer/SplashBackgroundRenderer.h @@ -15,6 +15,8 @@ #include #include +#include "pdf2htmlEX-config.h" + #include "Param.h" #include "HTMLRenderer/HTMLRenderer.h" @@ -34,7 +36,11 @@ public: virtual ~SplashBackgroundRenderer() { } +#if POPPLER_OLDER_THAN_0_23_0 + virtual void startPage(int pageNum, GfxState *state); +#else virtual void startPage(int pageNum, GfxState *state, XRef *xrefA); +#endif virtual void drawChar(GfxState *state, double x, double y, double dx, double dy, diff --git a/src/HTMLRenderer/HTMLRenderer.h b/src/HTMLRenderer/HTMLRenderer.h index ade8c83..25b4d5d 100644 --- a/src/HTMLRenderer/HTMLRenderer.h +++ b/src/HTMLRenderer/HTMLRenderer.h @@ -20,6 +20,8 @@ #include #include +#include "pdf2htmlEX-config.h" + #include "Param.h" #include "Preprocessor.h" #include "StringFormatter.h" @@ -73,9 +75,11 @@ public: virtual void setDefaultCTM(double *ctm); // Start a page. - // UGLY: These 2 versions are for different versions of poppler +#if POPPLER_OLDER_THAN_0_23_0 virtual void startPage(int pageNum, GfxState *state); +#else virtual void startPage(int pageNum, GfxState *state, XRef * xref); +#endif // End a page. virtual void endPage(); diff --git a/src/HTMLRenderer/general.cc b/src/HTMLRenderer/general.cc index 6608176..6799e86 100644 --- a/src/HTMLRenderer/general.cc +++ b/src/HTMLRenderer/general.cc @@ -165,12 +165,11 @@ void HTMLRenderer::setDefaultCTM(double *ctm) memcpy(default_ctm, ctm, sizeof(default_ctm)); } -void HTMLRenderer::startPage(int pageNum, GfxState *state) -{ - startPage(pageNum, state, nullptr); -} - +#if POPPLER_OLDER_THAN_0_23_0 +void HTMLRenderer::startPage(int pageNum, GfxState *state) +#else void HTMLRenderer::startPage(int pageNum, GfxState *state, XRef * xref) +#endif { this->pageNum = pageNum; diff --git a/src/pdf2htmlEX-config.h.in b/src/pdf2htmlEX-config.h.in index 695a8dd..09dc253 100644 --- a/src/pdf2htmlEX-config.h.in +++ b/src/pdf2htmlEX-config.h.in @@ -11,6 +11,7 @@ #include +#define POPPLER_OLDER_THAN_0_23_0 @POPPLER_OLDER_THAN_0_23_0@ #define HAVE_CAIRO @HAVE_CAIRO@ namespace pdf2htmlEX {