Skip to content

Commit bb11258

Browse files
author
Jay Panjwani
committed
enhancement for honor icc profile site variable
1 parent a21e924 commit bb11258

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

src/Adapter/PDFLib.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,7 +1143,7 @@ public function image($img, $x, $y, $w, $h, $resolution = "normal")
11431143
if (substr($img, 0, 7) === "file://") {
11441144
$img = substr($img, 7);
11451145
}
1146-
1146+
$honorICCProfile = $this->_dompdf->getOptions()->get('honorICCProfile') ? 'true' : 'false';
11471147
if (!isset($this->_imgs[$img])) {
11481148
switch (strtolower($img_type)) {
11491149
case "webp":
@@ -1167,10 +1167,10 @@ public function image($img, $x, $y, $w, $h, $resolution = "normal")
11671167
case "jpeg":
11681168
/** @noinspection PhpMissingBreakStatementInspection */
11691169
case "png":
1170-
$image_load_response = $this->_pdf->load_image($img_type, $img, "");
1170+
$image_load_response = $this->_pdf->load_image($img_type, $img, "honoriccprofile=$honorICCProfile");
11711171
break;
11721172
case "svg":
1173-
$image_load_response = $this->_pdf->load_graphics($img_type, $img, "");
1173+
$image_load_response = $this->_pdf->load_graphics($img_type, $img, "honoriccprofile=$honorICCProfile");
11741174
break;
11751175
default:
11761176
// not handled

src/Options.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,11 @@ class Options
342342
*/
343343
private $httpContext;
344344

345+
/**
346+
* @var bool
347+
*/
348+
private $honorICCProfile = false;
349+
345350
/**
346351
* @param array $attributes
347352
*/
@@ -451,6 +456,8 @@ public function set($attributes, $value = null)
451456
$this->setPdflibLicense($value);
452457
} elseif ($key === 'httpContext' || $key === 'http_context') {
453458
$this->setHttpContext($value);
459+
} elseif ($key === 'honorICCProfile') {
460+
$this->setHonorICCProfile($value);
454461
}
455462
}
456463
return $this;
@@ -524,6 +531,8 @@ public function get($key)
524531
return $this->getPdflibLicense();
525532
} elseif ($key === 'httpContext' || $key === 'http_context') {
526533
return $this->getHttpContext();
534+
} elseif ($key === 'honorICCProfile') {
535+
return $this->getHonorICCProfile();
527536
}
528537
return null;
529538
}
@@ -1311,4 +1320,22 @@ public function validateRemoteUri(string $uri)
13111320

13121321
return [true, null];
13131322
}
1323+
1324+
/**
1325+
* @param boolean $honorICCProfile
1326+
* @return $this
1327+
*/
1328+
public function setHonorICCProfile($honorICCProfile)
1329+
{
1330+
$this->honorICCProfile = $honorICCProfile;
1331+
return $this;
1332+
}
1333+
1334+
/**
1335+
* @return boolean
1336+
*/
1337+
public function getHonorICCProfile()
1338+
{
1339+
return $this->honorICCProfile;
1340+
}
13141341
}

0 commit comments

Comments
 (0)