API referenceGraphics

pdfRenameSpotColor

Rename a spot-colorant name across every registered

C
int32_t __stdcall pdfRenameSpotColor(PPDF IPDF, const char* Colorant, const char* NewName);
Delphi
function pdfRenameSpotColor(const IPDF: PPDF; const Colorant, NewName: PAnsiChar): Integer; stdcall;

Purpose. Rename a spot-colorant name across every registered Separation and DeviceN color space that references it, document-wide.

Description. Unlike pdfChangeSeparationColor, this operates by colorant name, not by handle — it scans all non-deleted registered color spaces and, for each one, renames Colorant to NewName wherever it appears: as a Separation space's own colorant name (SepColorant), as an entry in a DeviceN space's Colorants array, and as an entry in a DeviceN space's DevNSepNames array (the per-component Separation-handle names used by pdfAddDeviceNSeparationsAttr). A single call can therefore rename the same colorant in several different color spaces simultaneously if more than one references it. Fails immediately (returns 0) if either Colorant or NewName is empty; deleted color spaces (CSDeleted) are skipped.

Parameters.

ParameterDescription
IPDFDocument handle.
ColorantExisting colorant name to search for, across all registered color spaces.
NewNameReplacement name.

Return value. The number of individual name occurrences renamed (0 if Colorant was not found anywhere, or if either argument was empty); this can exceed 1 when the same colorant is referenced by multiple color spaces or appears in more than one of a single DeviceN space's name arrays.

Remarks. Because matching is by name rather than handle, renaming a colorant that happens to share its name across two logically unrelated color spaces (e.g. two different DeviceN spaces that both use "Spot1" as a placeholder name) renames it in both — there is no per-color-space scoping option.

See also. pdfChangeSeparationColor.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfRenameSpotColor(IntPtr IPDF, [MarshalAs(UnmanagedType.LPStr)] string Colorant, [MarshalAs(UnmanagedType.LPStr)] string NewName);
Area
Graphics
Category

Core

Exported names

pdfRenameSpotColor

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.