API referenceCore SDK

pdfSetLicenseKey

Register a license key; a valid key suppresses the trial

CategoryLicensing
VariantspdfSetLicenseKey (bare / ANSI)

Purpose — Register a license key; a valid key suppresses the trial watermark.

Description — Stores the key on the instance and validates it. The call always returns TRUE (LumasPDF-compatible, including the documented nil-instance pre-create call, which is accepted as a no-op that still succeeds). Validation is real: the key must match the form LUMAS-<body>-<checksum>, where <checksum> is the uppercase 8-hex-digit FNV-1a-32 of <body>. A key that validates sets the instance's licensed flag, which suppresses the trial demo watermark.

Declarations

C
BOOL32 __stdcall pdfSetLicenseKey(PPDF IPDF, const char* Key);
Delphi
function pdfSetLicenseKey(const IPDF: PPDF; const Key: PAnsiChar): LongBool; stdcall; external 'LumasPdf.dll';

Parameters

ParameterTypeDescription
IPDFPPDFInstance handle, or NULL for the pre-create global set.
Keyconst char*License key string.

Return value — Always TRUE. Do not use the return value to decide whether the key was accepted — query pdfIsLicensed instead.

Remarks — Because success is unconditional (matching the reference ABI), the only reliable acceptance signal is pdfIsLicensed after this call. Set the key immediately after pdfNewPDF, before opening output, so the watermark decision is made correctly for the whole document.

Example — Delphi (production)

Delphi
var P: PPDF;
begin
  P := pdfNewPDF;
  try
    pdfSetLicenseKey(P, 'LUMAS-ACME-0001-1A2B3C4D');
    if not pdfIsLicensed(P) then
      Writeln('WARNING: running unlicensed — output will be watermarked');
    // ... build document ...
  finally
    pdfDeletePDF(P);
  end;
end;

See alsopdfIsLicensed

C# (P/Invoke)

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

Setters

Exported names

pdfSetLicenseKey

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.