Skip to content
ComPDF
Guides

Introduction

This section introduces the API interfaces for ComPDF AI related functionalities.

Advantages of ComPDF AI

  • 24 Label Detection: Based on AI training, our algorithm can identify and classify page elements using 24 labels.
  • Preserve Original Logic: Our powerful sorting algorithm preserves the original reading structure and logic.
  • Analyze and Parse Data: Intelligently parse and analyze data for downstream applications, such as automatic report generation or integration with Q&A systems.
  • Support for GPU and CPU: Supports private deployment of ComPDF AI, leveraging GPU and CPU to accelerate document processing.

Intelligent Document Extraction - sync

Extract key information fields and table data from documents. Supported file formats: PDF, JPG, JPEG, PNG.

Request Method:

  • Request Method: POST
  • Parameter Type: Body (form-data)

Request URL:

js
http://localhost:7000/api/idp/data-extract-api

Request Header Parameters:

ParameterData TypeDescriptionRequired
API_KEYStringLicense KeyYes

Request Body Parameters:

ParameterData TypeDescriptionRequired
fileFileSource document.Yes
keysarray[string]Key information fields.No
tableHandlesarray[string]Table header fields.No
keysDescribearray[string]Additional descriptions for key information fields, corresponding to elements in keys by index. Use empty string "" for fields without descriptions.No
tableHandlesDescribearray[string]Additional descriptions for table header fields, corresponding to elements in tableHandles by index. Use empty string "" for fields without descriptions.No

When both keys and tableHandles are not provided, all key information in the file will be extracted.

JSON Response Explanation

Response ParameterData TypeDescription
codeIntError code, 200 indicates success
messageStringError message
dataObjectResponse result
+detailsObjectKey information extraction result
++pagesObjectCurrent page number, Page-Index
+++keyStringKey information field extraction result, key:value
+++tablesArrayTable extraction result, tables:[ [table1], [table2] ]

JSON Structure Example:

json
{
    "code": 200,
    "msg": "success",
    "data": {
        "details": {
            "Page-1": {
                "Invoice Number": "202401291234567890",
                "Invoice Date": "01/29/2024",
                "Zip Code": "92868",
                "Company Name": "PDF Technologies, Inc.",
                "Tax": "5%",
                "Total Excluding Tax": "$ 20.40",
                "Total": "$ 428.40",
                "tables": [
                    [
                        {
                            "Num": "1",
                            "Products": "ComPDFKit API",
                            "Payment Cycle": "Package Payments",
                            "Gear Level": "5000",
                            "Price": "$ 408.00"
                        }
                    ]
                ]
            }
        }
    }
}

Intelligent Document Parsing - sync

Parse document structure and output structured JSON data. Supported file formats: PDF, JPG, JPEG, PNG.

Request Method:

  • Request Method: POST
  • Parameter Type: Body (form-data)

Request URL:

js
http://localhost:7000/api/idp/api-file-resolve-api

Request Header Parameters:

ParameterData TypeDescriptionRequired
API_KEYStringLicense KeyYes

Request Body Parameters:

ParameterData TypeDescriptionRequired
fileFileSource document.Yes

JSON Response Explanation

Response ParameterData TypeDescription
codeIntError code, 200 indicates success
messageStringError message
dataObjectResponse result
+fileIdStringFile ID
+downFileUrlStringDocument parsing result URL.

Response Structure Example:

json
{
    "code": 200,
    "message": "success",
    "data": {
        "fileId": "42b3f995dd890ba9533d1bdcbb4c7246",
        "downFileUrl": "http://localhost:7000/api/idp/get-file?path=%2FComPDF AI%2Fserver%2Fout_tmp%2F979796629%2FTEST%282%29_ComPDF AI_batch_parse.zip"
    }
}

For document parsing label details, see: ComPDF AI Intelligent Document Parsing Field Introduction