I'm not sure what you mean by "color odf PDF", but here's a php function to convert from RGB to CMYK. What you do with the resulting array is up to you. /* Converts an array of RGB data to CMYK data. Parameters: $rgb - an array of color information where $rgb[0] == red value $rgb[1] == green value $rgb[2] == blue value Returns: array containing cmyk color information: $array[0] == cyan value $array[1] == magenta value $array[2] == yellow value $array[3] == black value */ function RGB_to_CMYK($rgb) { $cyan = 1 - ($rgb[0] / 255); $magenta = 1 - ($rgb[1] / 255); $yellow = 1 - ($rgb[2] / 255); $min = min($cyan, $magenta, $yellow); if ($min == 1) return array(0,0,0,1); $K = $min; $black = 1 - $K; return array ( ($cyan - $K) / $black, ($magenta- $K) / $black, ($yellow - $K) / $black, $K ); } PHP:
I would be utterly amazed if that is all there is to converting RGB to cmyk. I figured that photoshop, etc. would have a complex algorithm for this. varun - if correct, the above function would do absolutely nothing for your conversion hopes. All that is doing is changing 1 color to another (RGB --> CMYK) not converting a pdf or even a picture. Being a graphic artist and a programmer, I can honestly tell you that I have looked and found nothing that will automate this process. If you are building the PDFs server side from a group of pictures and text it would be possible to convert the pictures then build the PDF in cmyk but if you already have a rendered PDF, it's not going to happen (to the best of my knowledge). Good luck
Well...yes and no. The algorithm is simple, and what I posted is it. That said, doing something useful with the output is another matter. The conversion doesn't take into account any of the real-world factors you and I deal with every day: rich black, saturation, bleed, ICC profiles (for acquisition, display and output), and more.