Set or clear one channel in the DeviceN channel mask.
void pdfSetDeviceNChannelMask(PDFHandle pdf, int channelIdx, int on)
This function sets one channel in the DeviceN channel mask to "on" or "off". The channelIdx argument specifies the channel number, and the on argument is non-zero for "on" or zero for "off".

The pdfGetDeviceNToRGBBitmap uses a mask that controls which color channels are included in the conversion. Channels that are "on" are included; channels that are "off" do not contribute to the output pixels. The channels are the same as reported by pdfGetDeviceNChannelName. The mask only affects the output of pdfGetDeviceNToRGBBitmap.

int nChannels, i; char *channelName; unsigned int channelCMYK; PDFImageHeader hdr; char *bits; int err; err = pdfConvertPageToDeviceNImage(pdf, pageNum, dpi); if (err != pdfOk) { /* handle the error */ ... } pdfResetDeviceNChannelMask(pdf); nChannels = pdfGetNumDeviceNChannels(pdf); for (i = 0; i < nChannels; ++i) { channelName = pdfGetDeviceNChannelName(pdf, i); if ( ... ) { pdfSetDeviceNChannelMask(pdf, 1); } else { pdfSetDeviceNChannelMask(pdf, 0); } } pdfGetDeviceNToRGBBitmap(pdf, 4, &hdr, &bits); ... use the bitmap ... /* the bitmap memory must be freed when you are finished */ pdfFreeMemory(bits); /* free the internal storage used by pdfConvertPageToDeviceNImage */ pdfClearDeviceNImage(pdf);