API referenceGraphics

pdfSetUndercolorRemovalFunction

Install a /UCR2 undercolor-removal function, as a Type 0

C
BOOL32 __stdcall pdfSetUndercolorRemovalFunction(PPDF IPDF, int32_t Handle, uint8_t* Samples, int32_t NumSamples);
Delphi
function pdfSetUndercolorRemovalFunction(const IPDF: PPDF; Handle: Integer; Samples: PByte; NumSamples: Integer): LongBool; stdcall;

Purpose. Install a /UCR2 undercolor-removal function, as a Type 0 sampled PDF function, on an existing ExtGState resource.

Description. Unlike the transparent-color/color-management no-ops above, this one is real: Handle must resolve to an existing ExtGState (FindGSByHandle, the same registry pdfSetExtGState/pdfCreateExtGState populate — not a color-space handle despite the neighboring color APIs in this chapter). Requires at least 2 sample bytes; copies Samples verbatim into the ExtGState entry's UcrSamples field, consulted at ExtGState serialization time to emit a real /UCR2 Type 0 sampled function object. This function only takes effect once the target ExtGState is actually applied via pdfSetExtGState — setting it on an ExtGState handle that is never subsequently applied has no visible effect on output.

Parameters.

ParameterDescription
IPDFDocument handle.
HandleHandle of an existing ExtGState resource (from pdfCreateExtGState), not a color-space handle.
SamplesAt least 2 bytes: the sampled undercolor-removal function's output table.
NumSamplesByte count of Samples; must be >= 2.

Return value. True if Handle resolved to a live ExtGState and NumSamples >= 2; False otherwise.

Remarks. A sibling function, pdfSetHalftone (/HT Type 1 halftone), follows the identical pattern against the same ExtGState registry and is covered in the ExtGState/patterns cluster, not here.

See also. pdfSetTransparentColor (a genuinely inert sibling, for contrast).

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
[return: MarshalAs(UnmanagedType.Bool)]
Area
Graphics
Category

Setters

Exported names

pdfSetUndercolorRemovalFunction

String variants

The …A form takes UTF-8, …W takes UTF-16; a bare name aliases the ANSI form.

See working code

Worked examples — complete programs in ten languages.