pdfGetNumMPDeviceNChannels

Get the number of DeviceN color channels used on a page (multi-pass DeviceN API).
int pdfGetNumMPDeviceNChannels(PDFHandle pdf)
This function returns the number of DeviceN color channels in the list generated by the last call to pdfLoadMPDeviceNChannels.

The "MP" in the function names refers to multi-pass DeviceN rasterization support. These functions are different from pdfGetNumDeviceNChannels and pdfGetDeviceNChannelName, which look at the list of channels used in the most recent DeviceN rasterization (via pdfConvertPageToDeviceNImage, etc).

XpdfRasterizer is limited to rasterizing 32 color channels (4 CMYK channels + 28 spot channels) at a time. Normally, any channels beyond those 32 are converted to CMYK. The multi-pass support allows running multiple passes to rasterize any number of channels.

C:
// Print the list of all channels used on <page>. // This list may contain more than 32 channels. pdfLoadMPDeviceNChannels(pdf, page); nChannels = pdfGetNumMPDeviceNChannels(pdf); for (i = 0; i < nChannels; ++i) { printf("channel %2d: %s\n", i, pdfGetMPDeviceNChannelName(pdf, i)); } // All rasterizations include CMYK as the first four channels, and // the limit is 32 channels, which means we can rasterize 28 spot // channels per run. For the first run we write the CMYK bitmaps; // for subsequent runs we skip them (they'll be identical). i = 4; do { // rasterize CMYK (channels 0..3) + spot channels i .. i+28 pdfResetMPDeviceNChannelList(pdf); for (j = i; j < i + 28 && j < nChannels; ++j) { pdfAddMPDeviceNChannel(pdf, pdfGetMPDeviceNChannelName(pdf, j)); } err = pdfConvertPageToDeviceNImage(pdf, page, dpi); if (err != pdfOk) { ... } for (j = (i == 4) ? 0 : 4; j < pdfGetNumDeviceNChannels(pdf); ++j) { channelName = pdfGetDeviceNChannelName(pdf, j); pdfGetDeviceNBitmap(pdf, j, 1, 0, &hdr, &bits); ... use the bitmap for <channelName> ... pdfFreeMemory(bits); } pdfClearDeviceNImage(pdf); i += 28; } while (i < nChannels);
pdfLoadMPDeviceNChannels
pdfGetMPDeviceNChannelName
pdfResetMPDeviceNChannelList
pdfAddMPDeviceNChannel
pdfConvertPageToDeviceNImage
pdfConvertPageToDeviceNImageWithAlpha
pdfConvertRegionToDeviceNImage
pdfConvertRegionToDeviceNImageWithAlpha