Spludlow Web Header

CMYK Colours in PDF files


When working with print you may want to deal in CMYK colours and not the default RGB. A good example would be; you are programmatically generating a PDF that will be submitted directly to a copy shop or commercial printers.

The PDF class “Spludlow.Drawing.PDF” has a Boolean flag called “CMYK”, set it to true and passed colours will be treated as CMYK and not RGB. Any “Color” then used in any drawing method will use the values of ARGB as CMYK, note they are all percentages (0 – 100) and not a byte range (0 – 255) as when using RGB. Here is a simple code example:

       string font = "Arial, 18";

 

       Color black = Color.FromArgb(0, 0, 0, 100);

       Color cyan = Color.FromArgb(100, 0, 0, 0);

       Color red = Color.FromArgb(0, 100, 100, 0);

       Color magenta = Color.FromArgb(0, 100, 0, 0);

 

       using (Spludlow.Drawing.PDF pdf = new Spludlow.Drawing.PDF(@"E:\CMYKtest.pdf", "A4"))

       {

              pdf.CMYK = true;

 

              pdf.Text("black", font, 10, 10, black);

              pdf.Text("cyan", font, 10, 20, cyan);

              pdf.Text("red", font, 10, 30, red);

              pdf.Text("magenta", font, 10, 40, magenta);

       }

Obviously “Color.FromArgb” is really saying “Color.FromCMYK” but that’s a code readability trade-off that you will have to live with.

CMYK colours are only supported when using the PDF class directly, you can’t use a “PrintDoc” to create the PDF as you normally do, and this is because only PDFs support CMYK easily.

There is a class called “CMYKColours” in the “Spludlow.PDF” assembly that provides some named CMYK colours. The colours are defined the TextTable “CMYKColors.txt” so you can add your own if you like. These colours were taken from Adobe Illustrator’s Print Default Swatch (So they should all print well) then named on the closest converted RGB colour using http://www.htmlcsscolor.com/, then sorted in RGB hue order.

Use the method “Spludlow.Drawing.CMYKColours.PaletteSheet” to produce the following reference PDF you can copy and paste the colour names into your code.

If you require CMYK I will assume you already know what you’re doing with print colours, there is currently no support for spot colours.

If you are new to CMYK I then read one of the introductions to the “CMKY Colour model” on the web. Here are a few points to help you out:

·         The colour components are specified in percentages 0% - 100% no decimal place are necessary (You just wouldn’t notice even if the printing machine could put ink on the paper to this precision).

·         When submitting files to a printer they just about always expect a PDF or other some vector format like .AI, .EPS

·         Vector formats can contain RGB and CMYK objects. Illustrator will warn about this and it should be avoided.

·         Bitmap formats are either RGB or CMYK, you can change the colour mode in Photoshop.

·         PNG does not support CMYK.

·         The classic bitmap format for CMYK is a TIFF but they can be large.

·         JPEG does support CMYK but should be avoided in your print workflow unless saving out at a high quality setting.

·         You can use the colour gadgets in Photoshop and Illustrator to see CMYK and RGB components of any colour.

·         In Photoshop when in the colour gadget you can “pipette” the bitmap to get the colour breakdown. This can be useful when determining a CMYK colour from a suppled JPEG for example.

·         It’s a bad idea to work in RGB and convert to CMYK as you won’t get the best out of your colours.

·         The RGB secondary colours R+G=Yellow, R+B=Magenta and G+B=Cyan are the CMKY primary colours and visa-versa.

·         Not all colours will print well from CMYK process, they will just not be quite the right hue or may look dirty. Unlike with RGB where every colour on screen is achievable.

·         You can see the dulling of RGB to CMYK in Photoshop by converting the colour mode.

·         Photo-Printers or any print machine that uses more than 4 colour inks is designed to print RGB images, do not convert RGB images to CMYK if this is the case.

·         When working in Illustrator or Photoshop if the document is set to CMYK then it should be previewing the printed result (it will automatically dull it down).

·         When working with bitmaps don’t go below 300 dpi, this is considered the print minimum.

·         The “Press Quality” PDF setting is your best bet for submitting files to a printer.

·         Press Quality PDFs default setting will down-sample any bitmaps over 450dpi down to 300dpi so there is no point in going over 450 in a PDF workflow.

 


 
 
 
 
 
 
 
 
 
Spludlow Web Footer