Create PDF file with Spot Colors

I am trying to generate a PDF file with certain components draw with Spot Colours. Spot colours are used for printing and I am not clear on how one would do that but I think that if I can create a custom ColorSpace with a specific name or a color that has a specific name - our printer looks for the name Spot1 and they use the colour green.

Can anyone shed any light on how I might be able to do this. For reference I have attached two pdf files with two different spot colours in them.

I need to be able to create similar using CGContext and CGPDFDocument. I can already generate the PDF documents using CMYK colors but don't know how I can create the equivalent "spot" colors.

At the moment I am loading the page from these attached pdf files and scaling them to fill the page to get a background with the spot color. This works fine but I also need to generate text and lines using this same spot color and I am not clear how I could do that using the Core Graphics APIs.

My guess is I need to create a custom ColorSpace with a single color and then use that color for drawing with.

The only 'custom' option for creating a ColorSpace seems to be the CGColorSpace(propertyListPList:) constructor, however there does not appear to be any documentation on what needs to be in the property list to do so. Nor can I find any examples of that.

Any pointers would be appreciated. Regards

Replies

Further investigation seems to indicate that the Apple Core Graphics API does not natively support the Separation color space (as defined by Adobe) but it does support DeviceN color spaces - or Color Models. DeviceN color spaces support Spot colors so this seems like an option for us to use. However it is still unclear how one would create such a DeviceN color space.

[% Define the color space to be DeviceN
    /DeviceN
    [/Ruby /Emerald /Sapphire /Turquoise
    /Amethyst /Citrine]
    /DeviceRGB
    {%define new values and clip to 1.0
      6 -1 roll 1 index add 2 index add
      6 -1 roll 2 index add 4 index add
      6 3 roll add add 4 -1 roll pop
      3 -1 roll dup 1 gt {pop 1} if
      3 -1 roll dup 1 gt {pop 1} if
      3 -1 roll dup 1 gt {pop 1} if
    }
] setcolorspace

I did find this pseudo code for C# which seems to shed some light on it.

> Spot color can be represented in PDF using 'Separation' or 'DeviceN'
> color spaces.
>
> A separation color space can be treated similarly to grayscale color
> space. For details on separation color space, please refer to section
> 4.5.5 'Special Color Spaces' in PDF Reference Manual
> (http://www.pdftron.com/downloads/PDFReference16.pdf).
>
> The following C# pseudocode can be used to create a separation color
> space based on a PostScript function:
>
> static ColorSpace CreateSpotColorSpace(PDFDoc doc)
> {
>   Obj sep_cs = doc.CreateIndirectArray();
>
>   sep_cs.PushBackName("Separation");
>   sep_cs.PushBackName("LogoGreen");  // The name of the colorant
>   sep_cs.PushBackName("DeviceCMYK"); // Alternate color space
>
> // Create tint function (using PostScript calculator function).
> // Tint function is used to transform a tint value into color
> // component values in the alternate color space.
> string ps_funct = "{ dup 0.84 mul exch 0.00 exch dup 0.44 mul exch
> 0.21 mul }";
>   Obj tint_funct = doc.CreateIndirectStream(new
> System.Text.UTF8Encoding().GetBytes(ps_funct));
>   tint_funct.PutNumber("FunctionType", 4);
>
>   Obj tint_domain = tint_funct.PutArray("Domain");
>   tint_domain.PushBackNumber(0);  // Gray
>   tint_domain.PushBackNumber(1);
>
>   Obj tint_range = tint_funct.PutArray("Range");
>   tint_range.PushBackNumber(0); // C
>   tint_range.PushBackNumber(1);
>   tint_range.PushBackNumber(0); // M
>   tint_range.PushBackNumber(1);
>   tint_range.PushBackNumber(0); // Y
>   tint_range.PushBackNumber(1);
>   tint_range.PushBackNumber(0); // K
>   tint_range.PushBackNumber(1);
>
>   sep_cs.PushBack(tint_funct);
>   return new ColorSpace(sep_cs);
>
> }

So how would one define such a DeviceN color space using the Core Graphics API ?

I am assuming that one should be able to define this using a CFPropertyList and then use the CGColorSpace(propertyListPlist: CFPropertyList) API to do so.

Any help would be appreciated.

Add a Comment