diff --git a/filters/karbon/pdf/CMakeLists.txt b/filters/karbon/pdf/CMakeLists.txt
index 8f462b7b597..945eebbe676 100644
--- a/filters/karbon/pdf/CMakeLists.txt
+++ b/filters/karbon/pdf/CMakeLists.txt
@@ -1,4 +1,8 @@
+if(Poppler_VERSION VERSION_LESS "0.82.0")
+ add_definitions("-DHAVE_POPPLER_PRE_0_82")
+endif()
+
set(pdf2svg_PART_SRCS PdfImportDebug.cpp PdfImport.cpp SvgOutputDev.cpp )
add_library(calligra_filter_pdf2svg MODULE ${pdf2svg_PART_SRCS})
diff --git a/filters/karbon/pdf/SvgOutputDev.cpp b/filters/karbon/pdf/SvgOutputDev.cpp
index 18c6fbb4a44..3ebb2281bf3 100644
--- a/filters/karbon/pdf/SvgOutputDev.cpp
+++ b/filters/karbon/pdf/SvgOutputDev.cpp
@@ -405,7 +405,11 @@ void SvgOutputDev::drawString(GfxState * state, const GooString * s)
const char * p = s->c_str();
int len = s->getLength();
CharCode code;
+#ifdef HAVE_POPPLER_PRE_0_82
Unicode *u = nullptr;
+#else
+ const Unicode *u = nullptr;
+#endif
int uLen;
double dx, dy, originX, originY;
while (len > 0) {
@@ -474,9 +478,15 @@ void SvgOutputDev::drawString(GfxState * state, const GooString * s)
*d->body << "</text>" << endl;
}
-void SvgOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
+#ifdef HAVE_POPPLER_PRE_0_82
+ void SvgOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
+ int width, int height, GfxImageColorMap *colorMap,
+ bool /*interpolate*/, int *maskColors, bool /*inlineImg*/)
+#else
+ void SvgOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
int width, int height, GfxImageColorMap *colorMap,
- bool /*interpolate*/, int *maskColors, bool inlineImg)
+ bool /*interpolate*/, const int *maskColors, bool inlineImg)
+#endif
{
ImageStream * imgStr = new ImageStream(str, width, colorMap->getNumPixelComps(), colorMap->getBits());
imgStr->reset();
diff --git a/filters/karbon/pdf/SvgOutputDev.h b/filters/karbon/pdf/SvgOutputDev.h
index 2c161ce50af..2b0ea41e30c 100644
--- a/filters/karbon/pdf/SvgOutputDev.h
+++ b/filters/karbon/pdf/SvgOutputDev.h
@@ -61,9 +61,17 @@ public:
void drawString(GfxState * state, const GooString * s) override;
+#ifdef HAVE_POPPLER_PRE_0_82
+ // images
+ void drawImage(GfxState *state, Object *ref, Stream *str,
+ int width, int height, GfxImageColorMap *colorMap,
+ bool interpolate, int *maskColors, bool inlineImg) override;
+#else
// images
void drawImage(GfxState *state, Object *ref, Stream *str,
int width, int height, GfxImageColorMap *colorMap,
- bool interpolate, int *maskColors, bool inlineImg) override;
+ bool interpolate, const int *maskColors, bool inlineImg) override;
+#endif
+
// styles
void updateAll(GfxState *state) override;