PDF: Problems on Windows with PoDoFo
I had to compile GDAL on Windows using the SDK from www.gisinternals.com/sdk/ and use it, but only with PoDoFo and not Poppler for the PDF driver. I ran into two problems.
The code wouldn't even compile. Some Windows header defines a macro that clashes with a method name defined inside PoDoFo. This issue is documented in PoDoFo source code and I took the fix from there. See attachment:pdf-compilation.patch.
Then there was a problem with how the PDF driver invokes the pdftoppm
utility for rendering. The CPLSpawn()
function takes an array of strings, where the first string is the program to invoke, and the rest are its arguments. However, on Windows, this doesn't really work if the arguments contain spaces, since CPLSpawn()
just joins all the strings, separates them by spaces, and passes that on.
So I added quotes around the last argument to pdftoppm
, ie. the filename to render. See attachment:pdf-spawn.patch. Ultimately, the correct solution might be to fix the CPLSpawn()
function.
Thanks. I've not taken pdf-spwan.patch directly but rather fixed CPLSpawn() (only compile-tested, so please report if it works)
trunk r27328, branches/1.11 r27330 "CPLSpawn() on Windows: quote arguments with spaces in them (#5469)"
trunk r27329, branches/1.11 r27331 "PDF: fix compilation problem with Podofo on Windows (patch by keosak, #5469)"