Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#5469 closed defect (fixed)

PDF: Problems on Windows with PoDoFo

Reported by: keosak Owned by: warmerdam
Priority: normal Milestone: 1.11.1
Component: ConfigBuild Version: 1.11.0
Severity: normal Keywords: windows compilation shell
Cc: klokan


I had to compile GDAL on Windows using the SDK from 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.

Attachments (2)

pdf-compilation.patch (501 bytes) - added by keosak 7 years ago.
pdf-spawn.patch (1008 bytes) - added by keosak 7 years ago.

Download all attachments as: .zip

Change History (4)

Changed 7 years ago by keosak

Attachment: pdf-compilation.patch added

Changed 7 years ago by keosak

Attachment: pdf-spawn.patch added

comment:1 Changed 7 years ago by Even Rouault

Component: defaultConfigBuild
Milestone: 1.11.1
Resolution: fixed
Status: newclosed

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)"

comment:2 Changed 7 years ago by keosak

I have tried the CPLSpawn() patch and it works fine. Thank you.

Note: See TracTickets for help on using tickets.