Skip to content

Commit

Permalink
Merge pull request #7 from vluzrmos/master
Browse files Browse the repository at this point in the history
Makes pdfinfo path configurable.
  • Loading branch information
howtomakeaturn committed Mar 2, 2016
2 parents 9167cbb + 3923ded commit 20e17cb
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Howtomakeaturn/PDFInfo/PDFInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class PDFInfo
public $optimized;
public $PDFVersion;

public static $bin;

public function __construct($file)
{
$this->file = $file;
Expand All @@ -35,9 +37,18 @@ public function __construct($file)
$this->parseOutput();
}

public function getBinary()
{
if (empty(static::$bin)) {
static::$bin = getenv('PDFINFO_BIN') ?: 'pdfinfo';
}

return static::$bin;
}

private function loadOutput()
{
$cmd = "pdfinfo"; // Linux
$cmd = escapeshellarg($this->getBinary()); // escapeshellarg to work with Windows paths with spaces.

$file = escapeshellarg($this->file);
// Parse entire output
Expand Down

0 comments on commit 20e17cb

Please sign in to comment.