Skip to content

Commit 524fb4e

Browse files
committed
Finalized page range input
Added clear page range function, added unit test and updated docs
1 parent a02d971 commit 524fb4e

File tree

4 files changed

+38
-0
lines changed

4 files changed

+38
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,13 @@ $ghostscript->setPageEnd(int $page);
170170
```
171171

172172

173+
## Clear specified page range
174+
175+
```php
176+
$ghostscript->clearPageRange();
177+
```
178+
179+
173180
## Subsample antialiasing
174181

175182
These options control the use of subsample antialiasing. Their use is highly recommended for producing high quality rasterizations of the input files.

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,8 @@
2727
"require": {
2828
"php": ">= 7.0.0",
2929
"mikehaertl/php-shellcommand": "^1.2"
30+
},
31+
"scripts": {
32+
"test": "vendor/bin/phpunit --verbose --configuration phpunit.xml"
3033
}
3134
}

src/PHPGhostscript/Ghostscript.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,19 @@ public function setPages(int $startPage, int $endPage) : Ghostscript
448448
return $this;
449449
}
450450

451+
/**
452+
* Clears the page range
453+
*
454+
* @return self
455+
*/
456+
public function clearPageRange() : Ghostscript
457+
{
458+
$this->setPageStart(null);
459+
$this->setPageEnd(null);
460+
return $this;
461+
}
462+
463+
451464

452465
/**
453466
* Set the render box mode

tests/PHPGhostscript/PHPGhostscriptTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,21 @@ public function testMerging()
171171
$this->assertTrue($result);
172172
}
173173

174+
public function testClearPageRange() {
175+
$ghostscript = new Ghostscript();
176+
$this->assertNull($ghostscript->getPageStart());
177+
$this->assertNull($ghostscript->getPageEnd());
178+
179+
$ghostscript->setPageStart(2);
180+
$ghostscript->setPageEnd(10);
181+
$this->assertEquals(2, $ghostscript->getPageStart());
182+
$this->assertEquals(10, $ghostscript->getPageEnd());
183+
184+
$ghostscript->clearPageRange();
185+
$this->assertNull($ghostscript->getPageStart());
186+
$this->assertNull($ghostscript->getPageEnd());
187+
}
188+
174189
public function testMerging2()
175190
{
176191
$outputFile = __DIR__ . DIRECTORY_SEPARATOR . 'output' . DIRECTORY_SEPARATOR . 'merge2.pdf';

0 commit comments

Comments
 (0)