We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 9167cbb + 3923ded commit 20e17cbCopy full SHA for 20e17cb
src/Howtomakeaturn/PDFInfo/PDFInfo.php
@@ -26,6 +26,8 @@ class PDFInfo
26
public $optimized;
27
public $PDFVersion;
28
29
+ public static $bin;
30
+
31
public function __construct($file)
32
{
33
$this->file = $file;
@@ -35,9 +37,18 @@ public function __construct($file)
35
37
$this->parseOutput();
36
38
}
39
40
+ public function getBinary()
41
+ {
42
+ if (empty(static::$bin)) {
43
+ static::$bin = getenv('PDFINFO_BIN') ?: 'pdfinfo';
44
+ }
45
46
+ return static::$bin;
47
48
49
private function loadOutput()
50
- $cmd = "pdfinfo"; // Linux
51
+ $cmd = escapeshellarg($this->getBinary()); // escapeshellarg to work with Windows paths with spaces.
52
53
$file = escapeshellarg($this->file);
54
// Parse entire output
0 commit comments