Docflow uses xParse as its core document parsing service, which can accurately convert PDF, Word, and common image format documents into structured data containing text, tables, title hierarchies, formulas, handwritten characters, and image information for subsequent automated processing and analysis.In application scenarios such as knowledge base construction and unstructured document image processing, powerful document parsing capabilities can meet most requirements.The document parsing results returned by Docflow’s result retrieval interface are heavily trimmed from xParse results, retaining only basic text blocks and position information for page text position visualization rendering.
This document uses this sample document as an example to explain how to obtain document parsing results.

Prerequisites

According to the Document Upload instructions, upload a file and obtain the returned file ID.
File processing takes time. You need to wait several seconds after uploading before you can retrieve processing results.

Get Document Parsing Results

Document parsing results are large in size and are not returned by default.
When calling the result retrieval interface, add the URL parameter with_document=true to return document parsing results.
Example:
curl \
  -H "x-ti-app-id: <your-app-id>" \
  -H "x-ti-secret-code: <your-secret-code>" \
  "https://docflow.textin.com/api/app-api/sip/platform/v2/file/fetch?workspace_id=<your-workspace-id>&file_id=<your-file-id>&with_document=true"

Response JSON Structure Description

The document parsing structure is in result.files[].document, with the following example (excerpt):
"document":{
    "pages":[
        {
            "angle":0,
            "width":1191,
            "height":794,
            "lines":[
            {
                "text":"电子发票(普通发票)",
                "position":[ 389, 45, 767, 45, 767, 87, 389, 87 ],
                "charPositions":[]
            }
            ]
        }
    ]
}
Field descriptions are as follows:
  • document: Document parsing result object
    • pages: Array of parsing results for each page of the document
      • angle: Rotation angle of the document page
      • width: Width of the document page
      • height: Height of the document page
      • lines: Results for each text line in the document
        • text: Text content
        • position: Text coordinates
        • charPositions: Coordinates of each character in the text
The meaning of position can be referenced in the Coordinate System Description.