Skip to content

Commit

Permalink
Merge pull request #45 from tetreum/patch-1
Browse files Browse the repository at this point in the history
+ Support for filters & html
  • Loading branch information
ncjoes authored Jul 3, 2023
2 parents 0fc1081 + 9f88fd8 commit 292339a
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/OfficeConverter/OfficeConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class OfficeConverter
/** @var bool */
private $prefixExecWithExportHome;
/** @var string */
private $filter = '';
private $logPath;

/**
Expand Down Expand Up @@ -133,7 +134,18 @@ protected function makeCommand($outputDirectory, $outputExtension)
$outputDirectory = escapeshellarg($outputDirectory);
$logCmd = $this->logPath ? ">> {$this->logPath}" : "";

return "{$this->bin} --headless --convert-to {$outputExtension} {$oriFile} --outdir {$outputDirectory} {$logCmd}";
return "{$this->bin} --headless --convert-to {$outputExtension}{$this->filter} {$oriFile} --outdir {$outputDirectory}";
}

/**
* @param string $filter
*
* @return OfficeConverter
*/
public function setFilter ($filter)
{
$this->filter = ":" . $filter;
return $this;
}

/**
Expand Down Expand Up @@ -165,6 +177,7 @@ private function getAllowedConverter($extension = null)
{
$allowedConverter = [
'' => ['pdf'],
'html' => ['pdf', 'docx'],
'pptx' => ['pdf'],
'ppt' => ['pdf'],
'pdf' => ['pdf'],
Expand Down

0 comments on commit 292339a

Please sign in to comment.