For many years we've used this great library to, among other uses, create barcodes that are printed on our products. These need to be in the CMYK colorspace to avoid offset printing problems (only want the barcode to show up in the black print), and therefore we added two functions, setColorCMYK() and setStrokeColorCMYK() to Cpdf.php back in version 009. Most likely the code was found elsewhere at the time, but I no longer remember.
We recently upgraded to the lastest version, and had to re-add the functions (which still worked). It would obviously be beneficial for us to get CMYK support added officially, so hoping that's something that can be considered? I'll be happy to help out.
Here are the two functions we've been using, not sure if the function names fit with the current conventions:
/**
* sets the CMYK colour for stroke operations
*/
public function setColorCMYK($c,$m,$y,$k,$force=0){
if ($c>=0 && ($force || $c!=$this->currentColour['c'] || $m!=$this->currentColour['m'] || $y!=$this->currentColour['y'] || $k!=$this->currentColour['k'])){
$this->objects[$this->currentContents]['c'].="\n".($c/100).' '.($m/100).' '.($y/100).' '.($k/100).' k';
$this->currentColour=array('c'=>$c,'m'=>$m,'y'=>$y,'k'=>$k);
}
}
/**
* sets the CMYK colour for stroke operations
*/
public function setStrokeColorCMYK($c,$m,$y,$k,$force=0){
if ($c>=0 && ($force || $c!=$this->currentStrokeColour['c'] || $m!=$this->currentStrokeColour['m'] || $y!=$this->currentStrokeColour['y'] || $k!=$this->currentStrokeColour['k'])){
$this->objects[$this->currentContents]['c'].="\n".($c/100).' '.($m/100).' '.($y/100).' '.($k/100).' K';
$this->currentStrokeColour=array('c'=>$c,'m'=>$m,'y'=>$y,'k'=>$k);
}
}
For many years we've used this great library to, among other uses, create barcodes that are printed on our products. These need to be in the CMYK colorspace to avoid offset printing problems (only want the barcode to show up in the black print), and therefore we added two functions, setColorCMYK() and setStrokeColorCMYK() to Cpdf.php back in version 009. Most likely the code was found elsewhere at the time, but I no longer remember.
We recently upgraded to the lastest version, and had to re-add the functions (which still worked). It would obviously be beneficial for us to get CMYK support added officially, so hoping that's something that can be considered? I'll be happy to help out.
Here are the two functions we've been using, not sure if the function names fit with the current conventions: