GetLastStructuredTextDiagnostics

Text, extraction, structured data

Description

Returns JSON describing the most recent structured extraction analysis on this instance

Syntax

Delphi

Function TPDFlib.GetLastStructuredTextDiagnostics: WideString;

DLL

const wchar_t* DLGetLastStructuredTextDiagnostics(int InstanceID);
const char* DLGetLastStructuredTextDiagnosticsA(int InstanceID);

ActiveX

Function PDFlib::GetLastStructuredTextDiagnostics() As String

Return values

Returns the JSON diagnostics produced by the most recent structured text analysis on this instance.

Report

{
  "status": "completed",
  "pages": [
    {
      "page": 1,
      "readingSource": "tagged",
      "warnings": ""
    },
    {
      "page": 2,
      "readingSource": "mixed",
      "warnings": "shared-tagged-form-occurrence-order-unresolved\r\n"
    }
  ]
}

The initial report is {"status":"notRun"}; an extraction attempt starts with {"status":"error","code":"extraction_failed"} and successful analysis replaces it with a completed report

Each completed page records its one-based page, readingSource, and warnings; warnings are a newline-separated string of diagnostic codes, while schema 2 structured JSON uses a warnings array

Reading sources are tagged, mixed, geometric, and geometric-columns

Remarks

The report covers structured JSON, XHTML, CSV, Markdown, and DOCX extraction; invalid requests rejected before extraction can leave the previous report unchanged

A completed report means analysis returned successfully; it does not certify complete semantics, correct layout inference, valid tagging, or PDF/UA conformance

Warnings disclose unsupported object-reference text, unresolved roles or namespaces, cycles or traversal limits, missing source mappings, and ambiguous shared Form XObject occurrences

When structure traversal or binding is incomplete, extracted source text is retained through mixed or geometric fallback; inspect ExtractStructuredPage for per-block provenance and structureComplete

Cancellation or extraction failure can leave the error report; consult LastErrorCode and the normal operation lifecycle for the call result

The getter does not clear the latest error; the DLL A variant returns UTF-8 and DLL string pointers remain valid until the next string-returning call on this instance

Semantic tagging diagnostics

After AutoTagPages with PDF_AUTOTAG_SEMANTIC, this getter returns the semantic candidate report with committed status, confidence, column-aware order, structure object numbers and skipped-page reasons; review-only mode leaves the document unchanged and reports object number zero

Semantic page reports include coordinateSpace="display-crop", normalized clockwise rotation (0, 90, 180 or 270), and displayed width and height; candidate bounds use a top-left origin in the displayed crop-relative default user-space units, before any UserUnit scaling

Semantic page reports include formInvocations, the number of prepared invocation-specific Form scopes; committed candidates can own local MCIDs in several private Form streams through MCR/Stm references while original shared sources remain intact

The semantic inlineImages count identifies exactly qualified inline image instructions across the prepared invocation scopes; repeated uses of a shared Form count separately, and figure candidates retain the alternate-text and decoration review requirement

The semantic splitTextInstructions count records text-show instructions expanded into verified byte-owned parts; each semantic fragment receives its owning element and local MCID, while source-byte conflicts appear as skipped-page reasons without editing that page

See also

SetStructuredTextOptions, GetStructuredTextOptions, ExtractStructuredDocument, ExportDocumentMarkdown, SaveDOCXToStream