Skip to content

Commit

Permalink
Add support to execute unoconv in a different port (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
xorti authored and jygaulier committed Sep 16, 2019
1 parent a8000b8 commit 8fa6669
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Unoconv/Unoconv.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ public function transcode($input, $format, $outputFile, $pageRange = null)
'--stdout'
);

if ($port = $this->configuration->get('unoconv.port')) {
$arguments[] = '--port=' . $port;
}

if (preg_match('/\d+-\d+/', $pageRange)) {
$arguments[] = '-e';
$arguments[] = 'PageRange=' . $pageRange;
Expand Down
11 changes: 11 additions & 0 deletions tests/Unoconv/Functional/UnoconvTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,15 @@ public function testOdtToPDFConversionWithPageRange()
$this->assertTrue(file_exists($dest));
unlink($dest);
}

public function testOdtToPDFConversionWithOtherPort()
{
$dest = 'Hello.pdf';

$unoconv = Unoconv::create(array('unoconv.port' => 2003));
$unoconv->transcode(__DIR__ . '/../../files/Hello.odt', 'pdf', $dest);

$this->assertTrue(file_exists($dest));
unlink($dest);
}
}

0 comments on commit 8fa6669

Please sign in to comment.