Skip to content

Commit 8fa6669

Browse files
xortijygaulier
authored andcommitted
Add support to execute unoconv in a different port (#13)
1 parent a8000b8 commit 8fa6669

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/Unoconv/Unoconv.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ public function transcode($input, $format, $outputFile, $pageRange = null)
5555
'--stdout'
5656
);
5757

58+
if ($port = $this->configuration->get('unoconv.port')) {
59+
$arguments[] = '--port=' . $port;
60+
}
61+
5862
if (preg_match('/\d+-\d+/', $pageRange)) {
5963
$arguments[] = '-e';
6064
$arguments[] = 'PageRange=' . $pageRange;

tests/Unoconv/Functional/UnoconvTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,15 @@ public function testOdtToPDFConversionWithPageRange()
3838
$this->assertTrue(file_exists($dest));
3939
unlink($dest);
4040
}
41+
42+
public function testOdtToPDFConversionWithOtherPort()
43+
{
44+
$dest = 'Hello.pdf';
45+
46+
$unoconv = Unoconv::create(array('unoconv.port' => 2003));
47+
$unoconv->transcode(__DIR__ . '/../../files/Hello.odt', 'pdf', $dest);
48+
49+
$this->assertTrue(file_exists($dest));
50+
unlink($dest);
51+
}
4152
}

0 commit comments

Comments
 (0)