GetAPIScopeReportJSON

Diagnostics, content stream inspection, document editing

Description

Returns a deterministic JSON report of API scope violations, the currently active runtime scopes, and optional selected-page content validation

Syntax

Delphi

Function TPDFlib.GetAPIScopeReportJSON(
  Options: Integer= PDF_API_SCOPE_INCLUDE_CONTENT): WideString;

ActiveX

Function PDFlib::GetAPIScopeReportJSON(Options As Long) As String

DLL

const wchar_t* DLGetAPIScopeReportJSON(int InstanceID, int Options);
const char* DLGetAPIScopeReportJSONA(int InstanceID, int Options);

Parameters

OptionsZero reports runtime state and retained violations; PDF_API_SCOPE_INCLUDE_CONTENT also parses all content layers of the selected page

Return values

Returns JSON containing overall valid and balanced flags, the selected document and page, currentScope, active container and depth fields, total and retained violation counts, ordered runtime events, and a content validation object

Each runtime event includes a monotonic sequence, document, page, API name, stable code, expected and actual scopes, and a diagnostic message

Content validation reports unmatched or unclosed q/Q, BT/ET, marked-content, and path sequences with token positions

Returns an empty string and sets LastErrorCode to 117 when Options contains unsupported bits

Remarks

Runtime tracking has constant-time overhead on successful transitions and retains the latest 256 violations without allocating on ordinary drawing calls

Invalid tracked transitions return zero immediately and set LastErrorCode 117, preventing silent path loss, graphics-state underflow, mismatched marked-content closure, or context changes with open scopes

Calling this method does not clear retained violations or alter active scopes; use ClearAPIScopeReport after consuming a report

See also

ClearAPIScopeReport, GetAPIScopeReportJSONA, TraceGraphicsStates