Eric Johnson
Eric Johnson

Reputation: 17970

How can get PDF::API2 to use CMYK instead of RGB?

I am generating pdfs with Perl and PDF::API2. How can I get my pdf to be CMYK? Currently my pdfs all come out as RGB according to ImageMagick's identify command.

Upvotes: 0

Views: 410

Answers (1)

Steve Simms
Steve Simms

Reputation: 826

PDF::API2 allows colors to be entered as RGB or CMYK, and will output whatever you pass into it.

To enter a CMYK color, use the pattern %CCMMYYKK instead of #RRGGBB (note the percent sign instead of the number sign).

For example, you can set "true black" as follows:

$content->fillcolor('%000000FF');

PDF::API2::Util also has an undocumented RGBtoCMYK function. I have no idea if it's accurate, and it's undocumented, so use at your own risk, but it might be useful as a one-time way to convert your existing RGB colors to CMYK.

Upvotes: 2

Related Questions