A few examples that demonstrate the use of a slightly modified Processing PGraphicsPDF class which permits, among a few other things, to set colors in CMYK space.
This class was used used at a Resonate.io workshop in Belgrade, 2013
→ Download from github
→ View on github
This example creates a four pages pdf document with CMYK and spot colors; overprint is demonstrated on page two. To preview the overprint you may need to print the document or to open it with software that allows overprint preview. Gradients are on page three and four.
See comments in code for more details.
An example which shows how to preview the graphics in RGB color space (monitor) before creating the CMYK output (pdf).
This example loads an existing PDF file and uses it as a template to create a series of business cards, each with a slightly different form. The output file is ready for (offset) print.