From d0bbea71b9092663c3956826d4936172bc90dbcd Mon Sep 17 00:00:00 2001 From: aynsix Date: Wed, 14 Aug 2019 18:24:22 +0400 Subject: [PATCH] use configuration pdftotext binary --- lib/Alchemy/Phrasea/Application.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/Alchemy/Phrasea/Application.php b/lib/Alchemy/Phrasea/Application.php index f586a4f93a..f25e906f57 100644 --- a/lib/Alchemy/Phrasea/Application.php +++ b/lib/Alchemy/Phrasea/Application.php @@ -115,6 +115,7 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormTypeInterface; use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\Process\ExecutableFinder; use Unoconv\UnoconvServiceProvider; use XPDF\PdfToText; use XPDF\XPDFServiceProvider; @@ -237,8 +238,19 @@ class Application extends SilexApplication $this->register(new UnicodeServiceProvider()); $this->register(new ValidatorServiceProvider()); - $this->register(new XPDFServiceProvider()); - $this->setupXpdf(); + + if ($this['configuration.store']->isSetup()) { + $binariesConfig = $this['conf']->get(['main', 'binaries']); + $executableFinder = new ExecutableFinder(); + $this->register(new XPDFServiceProvider(), [ + 'xpdf.configuration' => [ + 'pdftotext.binaries' => isset($binariesConfig['pdftotext_binary']) ? $binariesConfig['pdftotext_binary'] : $executableFinder->find('pdftotext'), + ] + ]); + + $this->setupXpdf(); + } + $this->register(new FileServeServiceProvider()); $this->register(new ManipulatorServiceProvider()); $this->register(new PluginServiceProvider());