]>
Commit | Line | Data |
---|---|---|
1 | Index: /branches/1.9/gdal/configure | |
2 | =================================================================== | |
3 | --- /branches/1.9/gdal/configure (revision 24333) | |
4 | +++ /branches/1.9/gdal/configure (revision 24437) | |
5 | @@ -639,4 +639,5 @@ | |
6 | HAVE_PODOFO | |
7 | POPPLER_INC | |
8 | +POPPLER_0_20_OR_LATER | |
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 | |
15 | ||
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 | |
19 | $as_echo "yes" >&6; } | |
20 | + | |
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; } | |
24 | + rm -f testpoppler.* | |
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; } | |
31 | + else | |
32 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 | |
33 | +$as_echo "no" >&6; } | |
34 | + fi | |
35 | + | |
36 | else | |
37 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 | |
38 | @@ -26556,4 +26574,6 @@ | |
39 | ||
40 | POPPLER_BASE_STREAM_HAS_TWO_ARGS=$POPPLER_BASE_STREAM_HAS_TWO_ARGS | |
41 | + | |
42 | +POPPLER_0_20_OR_LATER=$POPPLER_0_20_OR_LATER | |
43 | ||
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) | |
49 | @@ -469,8 +469,10 @@ | |
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 | |
59 | ||
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) | |
64 | @@ -2941,4 +2941,5 @@ | |
65 | POPPLER_HAS_OPTCONTENT=no | |
66 | POPPLER_BASE_STREAM_HAS_TWO_ARGS=no | |
67 | +POPPLER_0_20_OR_LATER=no | |
68 | ||
69 | AC_MSG_CHECKING([for poppler]) | |
70 | @@ -3000,4 +3001,17 @@ | |
71 | POPPLER_BASE_STREAM_HAS_TWO_ARGS=yes | |
72 | AC_MSG_RESULT([yes]) | |
73 | + | |
74 | + # And now we check if we have Poppler >= 0.20.0 | |
75 | + AC_MSG_CHECKING([if we have Poppler >= 0.20.0]) | |
76 | + rm -f testpoppler.* | |
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]) | |
82 | + else | |
83 | + AC_MSG_RESULT([no]) | |
84 | + fi | |
85 | + | |
86 | else | |
87 | AC_MSG_RESULT([no]) | |
88 | @@ -3015,4 +3029,5 @@ | |
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) | |
93 | ||
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) | |
98 | @@ -327,5 +327,9 @@ | |
99 | poSplashOut = new SplashOutputDev(splashModeRGB8, 4, gFalse, sColor); | |
100 | PDFDoc* poDoc = poGDS->poDoc; | |
101 | +#ifdef POPPLER_0_20_OR_LATER | |
102 | + poSplashOut->startDoc(poDoc); | |
103 | +#else | |
104 | poSplashOut->startDoc(poDoc->getXRef()); | |
105 | +#endif | |
106 | double dfDPI = poGDS->dfDPI; | |
107 | ||
108 | @@ -518,4 +522,19 @@ | |
109 | ||
110 | #ifdef USE_POPPLER | |
111 | +#ifdef POPPLER_0_20_OR_LATER | |
112 | +static void PDFDatasetErrorFunction(void* userData, ErrorCategory eErrCatagory, int nPos, char *pszMsg) | |
113 | +{ | |
114 | + CPLString osError; | |
115 | + | |
116 | + if (nPos >= 0) | |
117 | + osError.Printf("Pos = %d, ", nPos); | |
118 | + osError += pszMsg; | |
119 | + | |
120 | + if (strcmp(osError.c_str(), "Incorrect password") == 0) | |
121 | + return; | |
122 | + | |
123 | + CPLError(CE_Failure, CPLE_AppDefined, "%s", osError.c_str()); | |
124 | +} | |
125 | +#else | |
126 | static void PDFDatasetErrorFunction(int nPos, char *pszMsg, va_list args) | |
127 | { | |
128 | @@ -531,4 +550,5 @@ | |
129 | CPLError(CE_Failure, CPLE_AppDefined, "%s", osError.c_str()); | |
130 | } | |
131 | +#endif | |
132 | #endif | |
133 | ||
134 | @@ -567,5 +587,9 @@ | |
135 | ||
136 | /* Set custom error handler for poppler errors */ | |
137 | +#ifdef POPPLER_0_20_OR_LATER | |
138 | + setErrorCallback(PDFDatasetErrorFunction, NULL); | |
139 | +#else | |
140 | setErrorFunction(PDFDatasetErrorFunction); | |
141 | +#endif | |
142 | ||
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) | |
148 | @@ -7,5 +7,5 @@ | |
149 | ||
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 | |
153 | ||
154 | !IFDEF POPPLER_HAS_OPTCONTENT | |
155 | @@ -15,4 +15,8 @@ | |
156 | !IFDEF POPPLER_BASE_STREAM_HAS_TWO_ARGS | |
157 | POPPLER_BASE_STREAM_HAS_TWO_ARGS_FLAGS = -DPOPPLER_BASE_STREAM_HAS_TWO_ARGS | |
158 | +!ENDIF | |
159 | + | |
160 | +!IFDEF POPPLER_0_20_OR_LATER | |
161 | +POPPLER_0_20_OR_LATER_FLAGS = -DPOPPLER_0_20_OR_LATER | |
162 | !ENDIF | |
163 | ||
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) | |
168 | @@ -16,4 +16,9 @@ | |
169 | endif | |
170 | ||
171 | +ifeq ($(POPPLER_0_20_OR_LATER),yes) | |
172 | +CPPFLAGS += -DPOPPLER_0_20_OR_LATER | |
173 | +endif | |
174 | + | |
175 | + | |
176 | CPPFLAGS := $(GDAL_INCLUDE) $(CPPFLAGS) $(POPPLER_INC) $(PODOFO_INC) | |
177 | ||
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) | |
182 | @@ -386,4 +386,5 @@ | |
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@ | |
187 |