| Category | Licensing |
|---|---|
| Variants | pdfSetLicenseKey (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
BOOL32 __stdcall pdfSetLicenseKey(PPDF IPDF, const char* Key);
function pdfSetLicenseKey(const IPDF: PPDF; const Key: PAnsiChar): LongBool; stdcall; external 'LumasPdf.dll';
Parameters
| Parameter | Type | Description |
|---|---|---|
IPDF | PPDF | Instance handle, or NULL for the pre-create global set. |
Key | const 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)
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 also — pdfIsLicensed
C# (P/Invoke)
[return: MarshalAs(UnmanagedType.Bool)]
Setters
pdfSetLicenseKey
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.