RecolorPage
Colour
Description
Moves the selected page into one colour space.
Syntax
Delphi
Function TPDFlib.RecolorPage(TargetSpace: Integer): Integer;Parameters
| TargetSpace | 1 grey, 2 RGB, 3 CMYK. |
|---|
Return values
| Count | How many colours were converted on this page. |
|---|---|
| 0 | Nothing needed converting, or TargetSpace was outside 1 to 3. The page then keeps its original bytes. |
Remarks
The conversion is the ordinary device arithmetic rather than a colour-managed one: a document that says only DeviceRGB carries no profile to convert through. RGB becomes grey by the luminance weights of ITU-R BT.601, and CMYK converts as described in ISO 32000-1 §8.6.4.4, which is what a viewer already does when it shows a CMYK document on a screen.
Colours set through an ICCBased, Separation, Indexed or Pattern space are left as they stand. Reading their components without their profile would change how the page looks rather than keep it, so such a document is converted only in the parts that name a device space directly.
Images are not converted by this call: an image can be drawn on more than one page, so converting it here would change pages the caller did not ask about. Use RecolorDocument to convert the images as well.
Geometry, text, clipping and every other operator are written back unchanged.
The page's layers are joined before the pass, since a colour set on one layer stays in force on the next and reading them apart would lose that.
Example
PDF.SelectPage(1);
PDF.RecolorPage(1); // this page in grey