API referenceRendering & Viewer

pdfAddRenderingIntent

Despite the source's own section-header comment marking

C
int32_t __stdcall pdfAddRenderingIntentA(PPDF IPDF, const char* ICCFile);
int32_t __stdcall pdfAddRenderingIntentEx(PPDF IPDF, void* Buffer, uint32_t BufSize);
Delphi
function pdfAddRenderingIntentA(const IPDF: PPDF; const ICCFile: PAnsiChar): Integer; stdcall;
function pdfAddRenderingIntentEx(const IPDF: PPDF; const Buffer: Pointer; BufSize: Cardinal): Integer; stdcall;

Purpose. Despite the source's own section-header comment marking this cluster "ICC rendering intent profile (subsystem not implemented)", the implementation is real: both embed an ICC profile as a document /OutputIntent (AddOutputIntent, NComps=3, OutCond='Rendering'), from a file (A/W) or an in-memory buffer (Ex).

Description. AddOutputIntent stores the raw ICC bytes, clamps NComps to {1,3,4} (defaulting to 3 if given anything else — moot here since this wrapper always passes 3), defaults OutCond to 'sRGB' if empty (moot here, always 'Rendering'), and returns the new output-intent's index — a genuine, real output-intent entry that reaches serialization (the stale "subsystem not implemented" comment appears to predate this function actually being wired up; do not trust it over the code). The A/W file variants read the whole file via TFile.ReadAllBytes; Ex uses the caller's buffer directly.

Parameters.

ParameterDescription
IPDFDocument handle.
ICCFilePath to an ICC profile file (A/W); must exist and be non-empty.
Buffer, BufSize*(Ex only)* In-memory ICC profile bytes.

Return value. The new output-intent's 0-based index; -1 on any failure (IPDF invalid, file missing/empty, empty buffer).

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfAddRenderingIntentA(IntPtr IPDF, [MarshalAs(UnmanagedType.LPStr)] string ICCFile);
public static extern int pdfAddRenderingIntentW(IntPtr IPDF, [MarshalAs(UnmanagedType.LPWStr)] string ICCFile);
Area
Rendering & Viewer
Category

Content Creation

Exported names

pdfAddRenderingIntentA pdfAddRenderingIntentW

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.