ExtractStructuredPage

Text, extraction, structured data

Opis

Renders one page into a structured text model and serializes it as JSON, XHTML, or CSV

Model grupira tekst u odlomke i otkrivene tablice, s recima i stiliziranim rasponima pod odlomcima, te recima, ćelijama i rasponima pod tablicama

Sintaksa

Delphi

Function TPDFlib.ExtractStructuredPage(Page, Format,
  Options: Integer): WideString;

ActiveX

Function PDFlib::ExtractStructuredPage(Page As Long, Format As Long,
  Options As Long) As String

DLL

const wchar_t* DLExtractStructuredPage(int InstanceID, int Page,
  int Format, int Options);
const char* DLExtractStructuredPageA(int InstanceID, int Page,
  int Format, int Options);

Parametri

PageBroj stranice u 1-baziranom brojanju
FormatPDF_STRUCTURED_TEXT_JSON (0), PDF_STRUCTURED_TEXT_XHTML (1) ili PDF_STRUCTURED_TEXT_CSV (2)
OptionsZero or PDF_STRUCTURED_TEXT_INCLUDE_STYLES (1) to include font, size, colour, and vertical alignment in JSON and XHTML

JSON hierarchy

{
  "version": 1,
  "page": 1,
  "width": 612,
  "height": 792,
  "blocks": [
    {"type": "paragraph", "bbox": [40, 50, 300, 70],
     "lines": [{"bbox": [40, 50, 300, 70], "spans": []}]},
    {"type": "table", "columns": 3, "rows": [[]]}
  ]
}

Povratne vrijednosti

JSON and XHTML return complete standalone documents

CSV vraća samo otkrivene tablice i prazan je kada stranica nema tablicu

An invalid request or extraction failure returns an empty string

Napomene

Tekst se renderira jednom, a zatim se svaki format proizvodi iz iste međuhijerarhije

Table detection merges normal word gaps inside a cell and requires aligned multi-cell rows, reducing paragraph false positives

Bounding boxes use top-left page coordinates and are expressed in PDF points

DLL pokazivači povratnih vrijednosti ostaju valjani do sljedećeg poziva na istoj instanci koji vraća niz znakova

LastErrorCode is 111 for invalid page, format, or options and 515 when extraction fails

Vidi također

ExtractStructuredDocument, ExtractPageTextBlocks, GetPageText