From 58b013b2e673426bac0986beb413f207ee76f84f Mon Sep 17 00:00:00 2001 From: Pawel Kordowski Date: Mon, 4 May 2020 15:52:57 +0200 Subject: [PATCH] Allow rtf conversion to pdf as it is available in Libre Office --- src/OfficeConverter/OfficeConverter.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/OfficeConverter/OfficeConverter.php b/src/OfficeConverter/OfficeConverter.php index 4f61fc6..d13ad25 100755 --- a/src/OfficeConverter/OfficeConverter.php +++ b/src/OfficeConverter/OfficeConverter.php @@ -199,7 +199,7 @@ private function getAllowedConverter($extension = null) 'Jpg' => ['pdf'], 'Jpeg' => ['pdf'], 'Jfif' => ['pdf'], - 'rtf' => ['docx', 'txt'] + 'rtf' => ['docx', 'txt', 'pdf'] ]; if ($extension !== null) { @@ -228,10 +228,10 @@ private function exec($cmd, $input = '') // Cannot use $_SERVER superglobal since that's empty during UnitUnishTestCase // getenv('HOME') isn't set on Windows and generates a Notice. if ($this->prefixExecWithExportHome) { - $home = getenv('HOME'); - if (!is_writable($home)) { - $cmd = 'export HOME=/tmp && ' . $cmd; - } + $home = getenv('HOME'); + if (!is_writable($home)) { + $cmd = 'export HOME=/tmp && ' . $cmd; + } } $process = proc_open($cmd, [0 => ['pipe', 'r'], 1 => ['pipe', 'w'], 2 => ['pipe', 'w']], $pipes); fwrite($pipes[0], $input);