blob: bcfea9b77adb20035929b53c600914b4707595aa [file] [log] [blame]
configure.ac | 5 ++++
src/extension/internal/pdfinput/pdf-parser.cpp | 32 +++++++++++++++++++++-----
2 files changed, 31 insertions(+), 6 deletions(-)
diff --git a/configure.ac b/configure.ac
index c8e1ae2..d62c989 100644
--- a/configure.ac
+++ b/configure.ac
@@ -593,6 +593,11 @@ if test "x$popplernewercolorspaceapi" = "xyes"; then
AC_DEFINE(POPPLER_EVEN_NEWER_COLOR_SPACE_API, 1, [Use even newer color space API from Poppler >= 0.26.0])
fi
+PKG_CHECK_MODULES(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API, poppler >= 0.29.0, popplernewernewcolorspaceapi=yes, popplernewernewcolorspaceapi=no)
+if test "x$popplernewernewcolorspaceapi" = "xyes"; then
+ AC_DEFINE(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API, 1, [Use even newer new color space API from Poppler >= 0.29.0])
+fi
+
# Poppler's b604a008 commit changes this
AC_MSG_CHECKING([whether Poppler's GfxPatch no longer uses GfxColor])
popplergfxcolor="no"
diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp
index b6edbfb..3fbf237 100644
--- a/src/extension/internal/pdfinput/pdf-parser.cpp
+++ b/src/extension/internal/pdfinput/pdf-parser.cpp
@@ -860,7 +860,9 @@ void PdfParser::opSetExtGState(Object args[], int numArgs) {
blendingColorSpace = NULL;
isolated = knockout = gFalse;
if (!obj4.dictLookup(const_cast<char*>("CS"), &obj5)->isNull()) {
-#if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
+#if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API)
+ blendingColorSpace = GfxColorSpace::parse(NULL, &obj5, NULL, NULL);
+#elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
blendingColorSpace = GfxColorSpace::parse(&obj5, NULL, NULL);
#elif defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
blendingColorSpace = GfxColorSpace::parse(&obj5, NULL);
@@ -1085,7 +1087,13 @@ void PdfParser::opSetFillColorSpace(Object args[], int numArgs) {
state->setFillPattern(NULL);
res->lookupColorSpace(args[0].getName(), &obj);
-#if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
+#if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API)
+ if (obj.isNull()) {
+ colorSpace = GfxColorSpace::parse(NULL, &args[0], NULL, NULL);
+ } else {
+ colorSpace = GfxColorSpace::parse(NULL, &obj, NULL, NULL);
+ }
+#elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
if (obj.isNull()) {
colorSpace = GfxColorSpace::parse(&args[0], NULL, NULL);
} else {
@@ -1126,7 +1134,13 @@ void PdfParser::opSetStrokeColorSpace(Object args[], int numArgs) {
state->setStrokePattern(NULL);
res->lookupColorSpace(args[0].getName(), &obj);
-#if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
+#if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API)
+ if (obj.isNull()) {
+ colorSpace = GfxColorSpace::parse(NULL, &args[0], NULL, NULL);
+ } else {
+ colorSpace = GfxColorSpace::parse(NULL, &obj, NULL, NULL);
+ }
+#elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
if (obj.isNull()) {
colorSpace = GfxColorSpace::parse(&args[0], NULL, NULL);
} else {
@@ -2756,7 +2770,9 @@ void PdfParser::doImage(Object *ref, Stream *str, GBool inlineImg) {
}
}
if (!obj1.isNull()) {
-#if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
+#if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API)
+ colorSpace = GfxColorSpace::parse(NULL, &obj1, NULL, NULL);
+#elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
colorSpace = GfxColorSpace::parse(&obj1, NULL, NULL);
#elif defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
colorSpace = GfxColorSpace::parse(&obj1, NULL);
@@ -2847,7 +2863,9 @@ void PdfParser::doImage(Object *ref, Stream *str, GBool inlineImg) {
obj2.free();
}
}
-#if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
+#if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API)
+ GfxColorSpace *maskColorSpace = GfxColorSpace::parse(NULL, &obj1, NULL, NULL);
+#elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
GfxColorSpace *maskColorSpace = GfxColorSpace::parse(&obj1, NULL, NULL);
#elif defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
maskColorSpace = GfxColorSpace::parse(&obj1, NULL);
@@ -3040,7 +3058,9 @@ void PdfParser::doForm(Object *str) {
if (obj1.dictLookup(const_cast<char*>("S"), &obj2)->isName(const_cast<char*>("Transparency"))) {
transpGroup = gTrue;
if (!obj1.dictLookup(const_cast<char*>("CS"), &obj3)->isNull()) {
-#if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
+#if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API)
+ blendingColorSpace = GfxColorSpace::parse(NULL, &obj3, NULL, NULL);
+#elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
blendingColorSpace = GfxColorSpace::parse(&obj3, NULL, NULL);
#elif defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
blendingColorSpace = GfxColorSpace::parse(&obj3, NULL);