How do I detect color separated PDF as well as colorant names of separated pages?

Q: I’m trying to understand on how to detect color separated PDF
documents. My problem is that the pdf has 2 pages, but actually it’s
one page because it’s preseparated and every page is a color. I want
to manage it as a single page.

Is it possible to identify which pages make reference to one actual
page? In the example
pdf, how could I understand that the 2 pages actually are one page?
Because if I call the
GetPageCount() it returns 2 pages. Even if I try to merge the 2 pages
in one page I lose
the separations inside.


A: You could use ‘SeparationInfo’ in the page dictionary. For more
info please see Section 14.11.4 ‘Separation Dictionaries’ in ISO 32000
Spec. For example

Obj seps = page.GetSDFObj().FindObj(“SeparationInfo”);
if (seps != null) {
string colorant = “”;
Obj clr = seps.FindObj(“DeviceColorant”);
if (clr != null) {
colorant = clr.IsName() ? clr.GetName() : clr.GetAsPDFText(); //
Must be a string or name;
}
}