diff --git a/.config/libreoffice/4/user/pack/registrymodifications.pack b/.config/libreoffice/4/user/pack/registrymodifications.pack index 0db0d5d..1a24834 100644 Binary files a/.config/libreoffice/4/user/pack/registrymodifications.pack and b/.config/libreoffice/4/user/pack/registrymodifications.pack differ diff --git a/.config/libreoffice/4/user/registrymodifications.xcu b/.config/libreoffice/4/user/registrymodifications.xcu index 7603942..e75ca56 100644 --- a/.config/libreoffice/4/user/registrymodifications.xcu +++ b/.config/libreoffice/4/user/registrymodifications.xcu @@ -10,7 +10,9 @@ V1,2,0 V1,2,0 en-US +0,0,800,600;1;0,0,0,0; 0,0,800,600;1;0,0,0,0; +0,0,800,600;1;0,0,0,0; 40(Build:3) true true diff --git a/app/SearchDisplace/Convertor/Convertor.php b/app/SearchDisplace/Convertor/Convertor.php index b59688a..763a46a 100644 --- a/app/SearchDisplace/Convertor/Convertor.php +++ b/app/SearchDisplace/Convertor/Convertor.php @@ -21,6 +21,7 @@ class Convertor { public static function convert($to, $document, $tmp = false) { $path = pathinfo($document); + $extension = $path['extension']; $dir = $path['dirname']; $original = $dir . '/' . $path['basename']; if(!$tmp) { @@ -29,6 +30,15 @@ class Convertor { $folder = storage_path('app/tmp/'); } + $env = [ + 'HOME' => base_path() + ]; + + if ($extension == 'odt') { + $to = $to . ':"$FILTER"'; + $env['FILTER'] = 'OpenDocument Text Flat XML'; + } + Log::info('Running `soffice` to convert "' . $original . '" to "' . $to . '". Output folder: "' . $folder . '"'); Log::info( 'COMMAND: ' . @@ -41,20 +51,28 @@ class Convertor { ); - $process = new Process( - [ - 'soffice', - '--convert-to', - $to, - $original, - '--outdir', - $folder - ], base_path(), - [ - 'HOME' => base_path() - ] + // $process = new Process( + // [ + // 'soffice', + // '--convert-to', + // $to, + // $original, + // '--outdir', + // $folder + // ], base_path(), + // [ + // 'HOME' => base_path(), + // 'FILTER' => 'OpenDocument Text Flat XML' + // ] + // ); + $process = Process::fromShellCommandline( + "soffice --convert-to $to $original --outdir $folder", + base_path(), + $env ); - $process->run(); + $process->run(null, $env); + + Log::info("OUTPUT: " . $process->getOutput()); if (!$process->isSuccessful()) { throw new ProcessFailedException($process); diff --git a/app/SearchDisplace/Ingest/HandleReceivedDocument.php b/app/SearchDisplace/Ingest/HandleReceivedDocument.php index 3ce8630..5e0b977 100644 --- a/app/SearchDisplace/Ingest/HandleReceivedDocument.php +++ b/app/SearchDisplace/Ingest/HandleReceivedDocument.php @@ -77,7 +77,7 @@ class HandleReceivedDocument // HTML document cannot be converted directly to xml. So we convert to ODT first, then to XML Convertor::convert('odt', $this->storage->path("$dir/$fileName")); Convertor::convert('xml', $this->storage->path("$dir/$intermediateFileName")); - $this->storage->delete("$dir/$intermediateFileName"); + // $this->storage->delete("$dir/$intermediateFileName"); foreach ($this->content['images'] as $image) { $name = $image['name'];