use configuration pdftotext binary

This commit is contained in:
aynsix
2019-08-14 18:24:22 +04:00
parent 6b01a5df23
commit d0bbea71b9

View File

@@ -115,6 +115,7 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormTypeInterface; use Symfony\Component\Form\FormTypeInterface;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Process\ExecutableFinder;
use Unoconv\UnoconvServiceProvider; use Unoconv\UnoconvServiceProvider;
use XPDF\PdfToText; use XPDF\PdfToText;
use XPDF\XPDFServiceProvider; use XPDF\XPDFServiceProvider;
@@ -237,8 +238,19 @@ class Application extends SilexApplication
$this->register(new UnicodeServiceProvider()); $this->register(new UnicodeServiceProvider());
$this->register(new ValidatorServiceProvider()); $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 FileServeServiceProvider());
$this->register(new ManipulatorServiceProvider()); $this->register(new ManipulatorServiceProvider());
$this->register(new PluginServiceProvider()); $this->register(new PluginServiceProvider());