75 lines
2.9 KiB
Diff
75 lines
2.9 KiB
Diff
|
From d295d0ebc3b41092ad072790c704c772098da210 Mon Sep 17 00:00:00 2001
|
||
|
From: Even Rouault <even.rouault@spatialys.com>
|
||
|
Date: Thu, 17 Jan 2019 22:52:36 +0100
|
||
|
Subject: [PATCH] PDF: add support for 0.72.0 and 0.73.0 (fixes #1207, fixes
|
||
|
#1208)
|
||
|
|
||
|
---
|
||
|
gdal/frmts/pdf/pdfdataset.cpp | 8 ++++++++
|
||
|
gdal/frmts/pdf/pdfobject.cpp | 5 +++++
|
||
|
gdal/frmts/pdf/pdfsdk_headers.h | 4 ++++
|
||
|
3 files changed, 17 insertions(+)
|
||
|
|
||
|
diff --git a/gdal/frmts/pdf/pdfdataset.cpp b/gdal/frmts/pdf/pdfdataset.cpp
|
||
|
index 27c9b552431..2eff2189fad 100644
|
||
|
--- a/gdal/frmts/pdf/pdfdataset.cpp
|
||
|
+++ b/gdal/frmts/pdf/pdfdataset.cpp
|
||
|
@@ -3416,7 +3416,11 @@ void PDFDataset::FindLayersPoppler()
|
||
|
#endif
|
||
|
if( ocg != nullptr && ocg->getName() != nullptr )
|
||
|
{
|
||
|
+#if (POPPLER_MAJOR_VERSION >= 1 || POPPLER_MINOR_VERSION >= 72)
|
||
|
+ const char* pszLayerName = (const char*)ocg->getName()->c_str();
|
||
|
+#else
|
||
|
const char* pszLayerName = (const char*)ocg->getName()->getCString();
|
||
|
+#endif
|
||
|
AddLayer(pszLayerName);
|
||
|
oLayerOCGMapPoppler[pszLayerName] = ocg;
|
||
|
}
|
||
|
@@ -4740,7 +4744,11 @@ GDALDataset *PDFDataset::Open( GDALOpenInfo * poOpenInfo )
|
||
|
GooString* poMetadata = poCatalogPoppler->readMetadata();
|
||
|
if (poMetadata)
|
||
|
{
|
||
|
+#if (POPPLER_MAJOR_VERSION >= 1 || POPPLER_MINOR_VERSION >= 72)
|
||
|
+ const char* pszContent = poMetadata->c_str();
|
||
|
+#else
|
||
|
const char* pszContent = poMetadata->getCString();
|
||
|
+#endif
|
||
|
if (pszContent != nullptr &&
|
||
|
STARTS_WITH(pszContent, "<?xpacket begin="))
|
||
|
{
|
||
|
diff --git a/gdal/frmts/pdf/pdfobject.cpp b/gdal/frmts/pdf/pdfobject.cpp
|
||
|
index cc87a8ec258..bcd093e9310 100644
|
||
|
--- a/gdal/frmts/pdf/pdfobject.cpp
|
||
|
+++ b/gdal/frmts/pdf/pdfobject.cpp
|
||
|
@@ -1061,8 +1061,13 @@ const CPLString& GDALPDFObjectPoppler::GetString()
|
||
|
#else
|
||
|
GooString* gooString = m_po->getString();
|
||
|
#endif
|
||
|
+#if (POPPLER_MAJOR_VERSION >= 1 || POPPLER_MINOR_VERSION >= 72)
|
||
|
+ return (osStr = GDALPDFGetUTF8StringFromBytes(reinterpret_cast<const GByte*>(gooString->c_str()),
|
||
|
+ static_cast<int>(gooString->getLength())));
|
||
|
+#else
|
||
|
return (osStr = GDALPDFGetUTF8StringFromBytes(reinterpret_cast<const GByte*>(gooString->getCString()),
|
||
|
static_cast<int>(gooString->getLength())));
|
||
|
+#endif
|
||
|
}
|
||
|
else
|
||
|
return (osStr = "");
|
||
|
diff --git a/gdal/frmts/pdf/pdfsdk_headers.h b/gdal/frmts/pdf/pdfsdk_headers.h
|
||
|
index 9150b0f4102..41e48ae91d6 100644
|
||
|
--- a/gdal/frmts/pdf/pdfsdk_headers.h
|
||
|
+++ b/gdal/frmts/pdf/pdfsdk_headers.h
|
||
|
@@ -50,7 +50,11 @@
|
||
|
#pragma warning( disable : 4244 ) /* conversion from 'const int' to 'Guchar', possible loss of data */
|
||
|
#endif
|
||
|
|
||
|
+#if !(POPPLER_MAJOR_VERSION >= 1 || POPPLER_MINOR_VERSION >= 73)
|
||
|
#include <goo/gtypes.h>
|
||
|
+#else
|
||
|
+typedef unsigned char Guchar;
|
||
|
+#endif
|
||
|
#include <goo/GooList.h>
|
||
|
|
||
|
/* begin of poppler xpdf includes */
|