This is the last of the Ducky mini-series within the Introduction to PDF Color story arc. Only four Duckies were not harmed in the making of this particular slide compared to the body counts in the previous slides. However, you may want to avert your eyes because this slide is particularly gruesome as we are doing the color printing equivalent of a vivisection here.
Here we are separating the colors of the (ducky.pdf) PDF to their individual process colors, which generally results in grayscale images, since the output color space is DeviceGray. But we are re-inserting the separation images into a same-sized page, and scaling them down to one-quarter size, and changing the color space of the images to a DeviceCMYK Separation color space corresponding to appropriate color component, or ink.
A lot of this is drawn from the DrawSeparations sample app that ships with APDFL.
but the magic is in the snippet below, both because of the Matrix we generate to scale and position the image and since we are replacing the Image’s ColorSpace:
And in more detail, here is where we setup the separation color spaces for each ink: