BOOL32 __stdcall rptSetRptLicenseKeyA(PPDF IPDF, const char* Key);
TRPT __stdcall rptCreateEngineA(PPDF IPDF, const char* Key);
BOOL32 __stdcall rptDeleteEngine(TRPT Engine);
BOOL32 __stdcall rptGetLicenseInfo(TRPT Engine, PRptLicenseInfoC Info);
function rptSetRptLicenseKeyA(const IPDF: PPDF; const Key: PAnsiChar): LongBool; stdcall;
function rptCreateEngineA(const IPDF: PPDF; const Key: PAnsiChar): TRPT; stdcall;
function rptDeleteEngine(const Engine: TRPT): LongBool; stdcall;
function rptGetLicenseInfo(const Engine: TRPT; Info: PRptLicenseInfoC): LongBool; stdcall;
Purpose. rptSetRptLicenseKey stores a reporting license key on a PPDF instance for later implicit use; rptCreateEngine performs a real, multi-stage license validation and mints the engine handle every other rpt*/tbl* call operates through; rptDeleteEngine frees it; rptGetLicenseInfo reports the validated license's parsed fields.
Description. rptSetRptLicenseKey requires IPDF to resolve to a real TLumasPdfDoc (fails otherwise) and stores the key on that document instance via SetRptLicenseKey. rptCreateEngine implements a genuine three-depth verification pipeline (per the unit's own header comment, matching the "Check depth N" comments in the code): (1) RptLicenseValidate — full parse+signature-verify of the effective key (the explicit Key argument if non-empty, else the key previously stored via rptSetRptLicenseKey on the IPDF instance — explicit argument always wins); (2) TRptEngine.CreateGated(Token, Fields, Doc) — a gated constructor that re-verifies the token independently of step 1 rather than trusting it was already checked; (3) — not part of creation itself, but every subsequent rpt* API call (rptGetLicenseInfo, rptOpenReport, rptRender, rptExport, rptPreview, rptPrint, rptRegisterFunction, rptLoadPlugin) independently calls Eng.RuntimeVerify again before doing any real work — the license is re-checked on essentially every call, not just once at startup. The in-memory token copy is explicitly zeroized (FillChar(Token, ..., 0)) immediately after use, a deliberate security-hygiene step. Any creation failure (steps 1 or 2) is recorded in a per-thread threadvar GBootError — since a failed rptCreateEngine returns no engine handle to attach an error to, this is the only way to retrieve *why* it failed (rptGetLastError(nil, ...), below). rptDeleteEngine is a plain, real handle-unregister-and-free.
Parameters.
| Parameter | Description |
|---|---|
IPDF | The PDF SDK document instance the reporting license is stored on / validated against. |
Key | *(CreateEngine)* Explicit license key; empty/nil falls back to whatever was stored via rptSetRptLicenseKey. Explicit always wins. |
Engine | The engine handle. |
Info | *(GetLicenseInfo only)* Output: the parsed license's fields (edition, feature bits, expiry, etc. — exact field list not enumerated in this chapter). |
Return value. rptSetRptLicenseKey: True if IPDF resolves to a real document. rptCreateEngine: a new engine handle; nil on any license-validation failure (retrieve the reason via rptGetLastError(nil, ...)). rptDeleteEngine/rptGetLicenseInfo: True on success; both require a real, currently-valid engine handle (rptGetLicenseInfo additionally re-runs RuntimeVerify).
C# (P/Invoke)
public static extern IntPtr rptCreateEngineW(IntPtr IPDF, [MarshalAs(UnmanagedType.LPWStr)] string Key);
public static extern IntPtr rptCreateEngine(IntPtr IPDF, [MarshalAs(UnmanagedType.LPStr)] string Key);
public static extern IntPtr rptCreateEngineA(IntPtr IPDF, [MarshalAs(UnmanagedType.LPStr)] string Key);
Reporting
rptCreateEngineW
rptCreateEngine
rptCreateEngineA
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.