PDF Colour Space

A PDF colour space is an object that defines how numerical colour values in a content stream map to actual colours on an output device. PDF supports device-dependent spaces (DeviceRGB, DeviceCMYK, DeviceGray), device-independent spaces (ICCBased, CalRGB, Lab), and special spaces (Separation, DeviceN, Indexed, Pattern) for spot colours and image indexing.

A PDF colour space is an object in the PDF resource system that defines how numerical colour values in a content stream are interpreted and mapped to actual visual output. When a content stream operator paints a colour — filling a shape, drawing text, or placing an image — the numerical arguments it passes (e.g., <code>0.8 0.2 0.1 rg</code> for an RGB fill) are interpreted according to the currently active colour space.

PDF's colour space system is defined in ISO 32000, drawing heavily on the PostScript colour model. It supports a wide range of spaces from the simple (<code>DeviceGray</code>, <code>DeviceRGB</code>) to the highly specialised (<code>DeviceN</code> for multi-colorant printing, <code>Lab</code> for perceptually uniform specification). Choosing the right colour space is essential for predictable print output, PDF/X and <a href="https://pdftheguide.com/glossary/pdf-a" target="_blank" rel="noopener">PDF/A</a> compliance, and correct colour management.

Device-dependent colour spaces

The three device-dependent colour spaces are the simplest to use and the least predictable in colour-managed workflows:

<strong>DeviceGray</strong> — A single component from 0.0 (black) to 1.0 (white). Used for black-and-white line art, greyscale images, and greyscale text. DeviceGray has no colour management implications. In PDF, the operators <code>G</code> and <code>g</code> (uppercase for stroke, lowercase for fill) set the current colour in DeviceGray. DeviceGray is implicitly used for any content drawn in DeviceGray colour space.

<strong>DeviceRGB</strong> — Three components (red, green, blue) each from 0.0 to 1.0. The interpretation depends on the output device's assumed RGB primaries. Most PDF viewers and screen output devices assume sRGB when no ICC profile is present, but this assumption is not guaranteed. The operators <code>RG</code> / <code>rg</code> set the stroke/fill colour in DeviceRGB.

<strong>DeviceCMYK</strong> — Four components (cyan, magenta, yellow, black) from 0.0 to 1.0. Pass-through ink specification: CMYK values are used directly on CMYK output devices. For screen viewing, the viewer must convert to RGB — it typically assumes a standard press profile (such as US Web Coated SWOP) for the conversion. The operators <code>K</code> / <code>k</code> set stroke/fill colours in DeviceCMYK.

<strong>Device space limitations in PDF/X</strong>: PDF/X-1a requires all content to be in DeviceCMYK or DeviceGray (with an output intent). DeviceRGB is prohibited. PDF/X-3 and PDF/X-4 allow DeviceRGB alongside ICC-based spaces, provided an output intent defines how device spaces are interpreted.

CIE-based and ICC colour spaces

CIE-based colour spaces define colour in terms of human visual perception rather than device characteristics, enabling device-independent colour:

<strong>CalGray</strong> — A calibrated grey space defined by a gamma value and a white point chromatic adaptation. Lightweight alternative to an ICC grey profile for simple greyscale content with known white point.

<strong>CalRGB</strong> — A calibrated RGB space defined by a 3×3 colour transformation matrix, gamma values per channel, and a white point. CalRGB with D65 white point and sRGB primaries is a lightweight sRGB representation without a full ICC profile.

<strong>Lab</strong> — CIE L*a*b* colour space: perceptually uniform, device-independent. L* is lightness, a* is green–red, b* is blue–yellow. Lab is used in PDF for colour specifications that need to be precisely defined independent of any device or profile. Lab values can be embedded in PDF as colour constants for spot colour alternates, providing an absolute colour definition for process-colour fallback.

<strong>ICCBased</strong> — A colour space backed by an embedded ICC profile. The profile is stored as a compressed stream in the PDF. ICCBased spaces can be RGB, CMYK, or grey. Using ICCBased colour (e.g., <code>[/ICCBased iccStreamRef]</code>) enables full ICC colour management: the viewer or RIP can accurately transform colours to the output device using the embedded profile as the source characterisation. This is the recommended approach for colour-managed document production.

Special-purpose colour spaces

<strong>Indexed</strong> — A lookup table colour space. Pixel values in the content stream are integers indexing into a colour table of base-space values. <code>[/Indexed /DeviceRGB 255 colourTableBytes]</code>. Used for palettized images (PNG/GIF style). Reduces data by sharing common colours through indices.

<strong>Separation</strong> — A single named colorant. <code>[/Separation /PANTONE-485-C /DeviceCMYK alternateTintFunction]</code>. The name identifies the colorant (a Pantone colour, a varnish plate, a custom ink). The alternate space and tint function provide a fallback for devices that do not have the named colorant. Essential for spot colour printing — allows Pantone colours to be specified by name with CMYK simulation for proofing.

<strong>DeviceN</strong> — A multi-colorant space for combinations of named colorants: <code>[/DeviceN [/Cyan /Magenta /PANTONE-485-C] /DeviceCMYK alternateTintFunction]</code>. Generalises Separation to multiple inks in a single colour space. Used for multi-colorant images in high-end prepress (photopolymer ink sets, multi-channel inkjet) and for combining process inks with spot inks in a single image.

<strong>Pattern</strong> — Not a colour in the conventional sense, but classified as a colour space in PDF. Allows tile patterns (repeated graphical elements) and shading patterns (gradient fills) to be used as fill or stroke paint. Shading patterns include axial gradients, radial gradients, and function-based shadings.

<strong>PDF/A and special colour spaces</strong>: PDF/A-1 restricts colour spaces significantly — DeviceN and Separation are permitted only with CMYK or grey alternate spaces; indexed colour must use only PDF/A-permitted base spaces. PDF/A-2 is more permissive.

Frequently asked questions

What colour space should I use for a PDF that will be printed?

For commercial offset printing: use DeviceCMYK or ICCBased CMYK with an output intent ICC profile matching your printing condition (FOGRA51 for European coated, GRACoL2013_CRPC6 for US commercial coated). All images should be in CMYK with embedded ICC profiles; RGB images in a print PDF risk unpredictable press conversion. For PDF/X-4 (the current recommended print PDF standard): ICCBased RGB images are allowed alongside CMYK, provided an output intent is present and defines how RGB should be converted. For inkjet or digital printing: confirm with your printer whether they expect CMYK or RGB+profile. Many wide-format inkjet printers prefer ICCBased RGB with their printer profile embedded.

How do I specify a Pantone spot colour in PDF?

Pantone spot colours in PDF are represented using Separation colour spaces. The colour space array is: [/Separation /PantoneName /AlternateSpace TintFunction]. The name should match the Pantone colour name exactly as expected by your print workflow (e.g., /PANTONE\ 485\ C). The alternate space is typically DeviceCMYK, and the tint function maps a 0.0–1.0 ink value to CMYK equivalent values for display and proofing. Professional layout tools (InDesign, Illustrator) create Separation colour spaces automatically when you use a Pantone swatch and export to PDF. When creating PDFs programmatically, use your PDF library's spot colour API (iText's PdfSpotColor, PDFlib's spot_name()/spot()) to create Separation spaces with correct CMYK fallback values.

What is the difference between an ICCBased colour space and an output intent?

An ICCBased colour space is a per-object colour space definition — it specifies how colour values for a particular image or graphical element should be interpreted, using an embedded ICC profile. Each image or element can have its own ICCBased colour space (e.g., one image might be sRGB-profiled, another might be ProPhoto RGB-profiled). An output intent (/OutputIntents array entry) is a document-level declaration of the intended output device or printing condition for the entire document. The output intent specifies the "destination" — what device the PDF is designed for. In a colour-managed workflow, the rendering engine (viewer or RIP) takes each object's source ICCBased profile, converts via the colour management engine, and maps to the output intent destination profile to produce the final output. Both are ICC profiles — but ICCBased is per-object source characterisation, while the output intent is the document-level destination target.