1 Index: /branches/1.9/gdal/configure
2 ===================================================================
3 --- /branches/1.9/gdal/configure (revision 24333)
4 +++ /branches/1.9/gdal/configure (revision 24437)
9 POPPLER_BASE_STREAM_HAS_TWO_ARGS
10 POPPLER_HAS_OPTCONTENT
11 @@ -26470,4 +26471,5 @@
12 POPPLER_HAS_OPTCONTENT=no
13 POPPLER_BASE_STREAM_HAS_TWO_ARGS=no
14 +POPPLER_0_20_OR_LATER=no
16 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for poppler" >&5
17 @@ -26536,4 +26538,20 @@
18 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
21 + # And now we check if we have Poppler >= 0.20.0
22 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we have Poppler >= 0.20.0" >&5
23 +$as_echo_n "checking if we have Poppler >= 0.20.0... " >&6; }
25 + echo '#include <poppler/Error.h>' > testpoppler.cpp
26 + echo 'int main(int argc, char** argv) { setErrorCallback(0,0); return 0; }' >> testpoppler.cpp
27 + if test -z "`${CXX} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
28 + POPPLER_0_20_OR_LATER=yes
29 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
30 +$as_echo "yes" >&6; }
32 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
37 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
38 @@ -26556,4 +26574,6 @@
40 POPPLER_BASE_STREAM_HAS_TWO_ARGS=$POPPLER_BASE_STREAM_HAS_TWO_ARGS
42 +POPPLER_0_20_OR_LATER=$POPPLER_0_20_OR_LATER
44 POPPLER_INC=$POPPLER_INC
45 Index: /branches/1.9/gdal/nmake.opt
46 ===================================================================
47 --- /branches/1.9/gdal/nmake.opt (revision 23610)
48 +++ /branches/1.9/gdal/nmake.opt (revision 24437)
50 # Uncomment for PDF support
51 # Uncomment POPPLER_BASE_STREAM_HAS_TWO_ARGS = YES for Poppler >= 0.16.0
52 +# Uncomment POPPLER_0_20_OR_LATER = YES for Poppler >= 0.20.0
53 #POPPLER_ENABLED = YES
54 #POPPLER_CFLAGS = -Ie:/kde/include -Ie:/kde/include/poppler
55 #POPPLER_HAS_OPTCONTENT = YES
56 #POPPLER_BASE_STREAM_HAS_TWO_ARGS = YES
57 +#POPPLER_0_20_OR_LATER = YES
58 #POPPLER_LIBS = e:/kde/lib/poppler.lib e:/kde/lib/freetype.lib e:/kde/lib/liblcms-1.lib advapi32.lib gdi32.lib
60 Index: /branches/1.9/gdal/configure.in
61 ===================================================================
62 --- /branches/1.9/gdal/configure.in (revision 24333)
63 +++ /branches/1.9/gdal/configure.in (revision 24437)
65 POPPLER_HAS_OPTCONTENT=no
66 POPPLER_BASE_STREAM_HAS_TWO_ARGS=no
67 +POPPLER_0_20_OR_LATER=no
69 AC_MSG_CHECKING([for poppler])
70 @@ -3000,4 +3001,17 @@
71 POPPLER_BASE_STREAM_HAS_TWO_ARGS=yes
74 + # And now we check if we have Poppler >= 0.20.0
75 + AC_MSG_CHECKING([if we have Poppler >= 0.20.0])
77 + echo '#include <poppler/Error.h>' > testpoppler.cpp
78 + echo 'int main(int argc, char** argv) { setErrorCallback(0,0); return 0; }' >> testpoppler.cpp
79 + if test -z "`${CXX} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
80 + POPPLER_0_20_OR_LATER=yes
81 + AC_MSG_RESULT([yes])
89 AC_SUBST(POPPLER_HAS_OPTCONTENT, $POPPLER_HAS_OPTCONTENT)
90 AC_SUBST(POPPLER_BASE_STREAM_HAS_TWO_ARGS, $POPPLER_BASE_STREAM_HAS_TWO_ARGS)
91 +AC_SUBST(POPPLER_0_20_OR_LATER, $POPPLER_0_20_OR_LATER)
92 AC_SUBST(POPPLER_INC, $POPPLER_INC)
94 Index: /branches/1.9/gdal/frmts/pdf/pdfdataset.cpp
95 ===================================================================
96 --- /branches/1.9/gdal/frmts/pdf/pdfdataset.cpp (revision 23986)
97 +++ /branches/1.9/gdal/frmts/pdf/pdfdataset.cpp (revision 24437)
99 poSplashOut = new SplashOutputDev(splashModeRGB8, 4, gFalse, sColor);
100 PDFDoc* poDoc = poGDS->poDoc;
101 +#ifdef POPPLER_0_20_OR_LATER
102 + poSplashOut->startDoc(poDoc);
104 poSplashOut->startDoc(poDoc->getXRef());
106 double dfDPI = poGDS->dfDPI;
111 +#ifdef POPPLER_0_20_OR_LATER
112 +static void PDFDatasetErrorFunction(void* userData, ErrorCategory eErrCatagory, int nPos, char *pszMsg)
117 + osError.Printf("Pos = %d, ", nPos);
120 + if (strcmp(osError.c_str(), "Incorrect password") == 0)
123 + CPLError(CE_Failure, CPLE_AppDefined, "%s", osError.c_str());
126 static void PDFDatasetErrorFunction(int nPos, char *pszMsg, va_list args)
129 CPLError(CE_Failure, CPLE_AppDefined, "%s", osError.c_str());
136 /* Set custom error handler for poppler errors */
137 +#ifdef POPPLER_0_20_OR_LATER
138 + setErrorCallback(PDFDatasetErrorFunction, NULL);
140 setErrorFunction(PDFDatasetErrorFunction);
143 /* poppler global variable */
144 Index: /branches/1.9/gdal/frmts/pdf/makefile.vc
145 ===================================================================
146 --- /branches/1.9/gdal/frmts/pdf/makefile.vc (revision 22493)
147 +++ /branches/1.9/gdal/frmts/pdf/makefile.vc (revision 24437)
150 !IFDEF POPPLER_ENABLED
151 -EXTRAFLAGS = $(POPPLER_CFLAGS) $(POPPLER_HAS_OPTCONTENT_FLAGS) $(POPPLER_BASE_STREAM_HAS_TWO_ARGS_FLAGS) -DUSE_POPPLER
152 +EXTRAFLAGS = $(POPPLER_CFLAGS) $(POPPLER_HAS_OPTCONTENT_FLAGS) $(POPPLER_BASE_STREAM_HAS_TWO_ARGS_FLAGS) $(POPPLER_0_20_OR_LATER_FLAGS) -DUSE_POPPLER
154 !IFDEF POPPLER_HAS_OPTCONTENT
156 !IFDEF POPPLER_BASE_STREAM_HAS_TWO_ARGS
157 POPPLER_BASE_STREAM_HAS_TWO_ARGS_FLAGS = -DPOPPLER_BASE_STREAM_HAS_TWO_ARGS
160 +!IFDEF POPPLER_0_20_OR_LATER
161 +POPPLER_0_20_OR_LATER_FLAGS = -DPOPPLER_0_20_OR_LATER
164 Index: /branches/1.9/gdal/frmts/pdf/GNUmakefile
165 ===================================================================
166 --- /branches/1.9/gdal/frmts/pdf/GNUmakefile (revision 22491)
167 +++ /branches/1.9/gdal/frmts/pdf/GNUmakefile (revision 24437)
171 +ifeq ($(POPPLER_0_20_OR_LATER),yes)
172 +CPPFLAGS += -DPOPPLER_0_20_OR_LATER
176 CPPFLAGS := $(GDAL_INCLUDE) $(CPPFLAGS) $(POPPLER_INC) $(PODOFO_INC)
178 Index: /branches/1.9/gdal/GDALmake.opt.in
179 ===================================================================
180 --- /branches/1.9/gdal/GDALmake.opt.in (revision 24419)
181 +++ /branches/1.9/gdal/GDALmake.opt.in (revision 24437)
183 POPPLER_HAS_OPTCONTENT = @POPPLER_HAS_OPTCONTENT@
184 POPPLER_BASE_STREAM_HAS_TWO_ARGS = @POPPLER_BASE_STREAM_HAS_TWO_ARGS@
185 +POPPLER_0_20_OR_LATER = @POPPLER_0_20_OR_LATER@
186 POPPLER_INC = @POPPLER_INC@