pdfAddMPDeviceNChannel
Add a DeviceN color channel to the list to be rasterized (multi-pass DeviceN API).
void pdfAddMPDeviceNChannel(PDFHandle pdf, char *channelName)
This function adds a DeviceN color channel to a multi-pass
rasterization run. This also enables multi-pass rasterization.
No more than 28 custom color channels can be included in a single
rasterization. The 4 CMYK channels will be present in all
rasterizations; there is no need to
call pdfAddMPDeviceNChannel
for them.
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);