Skip to content

Commit 753e241

Browse files
committed
Output profile support
1 parent 8746190 commit 753e241

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

src/Ghostscript.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ class Ghostscript
6969
*/
7070
protected $fitPage;
7171

72+
/**
73+
* The output ICC profile.
74+
*
75+
* @var LocalFile|null
76+
*/
77+
protected $outputProfile = null;
78+
7279
/**
7380
* Create a new Ghostscript instance.
7481
*
@@ -170,6 +177,17 @@ public function setFitPage(int $width, int $height)
170177
$this->fitPage = compact('width', 'height');
171178
}
172179

180+
/**
181+
* Set the output ICC profile.
182+
*
183+
* @param LocalFile $profile
184+
* @return void
185+
*/
186+
public function setOutputProfile(LocalFile $profile)
187+
{
188+
$this->outputProfile = $profile;
189+
}
190+
173191
/**
174192
* Convert the specified PDF to an image.
175193
*
@@ -202,6 +220,10 @@ public function convert(LocalFile $file, int $page = 1, LocalFile $outputFile =
202220
$command[] = '-dUse' . $this->pageBox;
203221
}
204222

223+
if (!is_null($this->outputProfile)) {
224+
$command[] = "-sOutputICCProfile={$this->outputProfile->getLocalPath()}";
225+
}
226+
205227
$command[] = '-dNOPLATFONTS';
206228
$command[] = '-dBATCH';
207229
$command[] = '-dNOPAUSE';

0 commit comments

Comments
 (0)