diff --git a/README.md b/README.md index 8514412..80e51af 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ FileTextCache_SSCache: PDFs require special handling, for example through the [XPDF](http://www.foolabs.com/xpdf/) commandline utility. Follow their installation instructions, its presence will be automatically -detected. You can optionally set the binary path in `mysite/_config/config.yml`: +detected for *nix operating systems. You can optionally set the binary path (required for Windows) in `mysite/_config/config.yml` ```yml PDFTextExtractor: diff --git a/code/extractors/PDFTextExtractor.php b/code/extractors/PDFTextExtractor.php index 0fdaf16..f832169 100644 --- a/code/extractors/PDFTextExtractor.php +++ b/code/extractors/PDFTextExtractor.php @@ -71,6 +71,9 @@ class PDFTextExtractor extends FileTextExtractor if(file_exists($path)) { return $path; } + if (file_exists($path.'.exe')) { + return $path.'.exe'; + } } // Not found @@ -100,6 +103,10 @@ class PDFTextExtractor extends FileTextExtractor } exec(sprintf('%s %s - 2>&1', $this->bin('pdftotext'), escapeshellarg($path)), $content, $err); if ($err) { + if (!is_array($err) && $err == 1) { + // For Windows compatibility + $err = $content; + } throw new FileTextExtractor_Exception(sprintf( 'PDFTextExtractor->getContent() failed for %s: %s', $path,