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:
http://localhost:7000/api/idp/data-extract-apiRequest Header Parameters:
| Parameter | Data Type | Description | Required |
|---|---|---|---|
| API_KEY | String | License Key | Yes |
Request Body Parameters:
| Parameter | Data Type | Description | Required |
|---|---|---|---|
| file | File | Source document. | Yes |
| keys | array[string] | Key information fields. | No |
| tableHandles | array[string] | Table header fields. | No |
| keysDescribe | array[string] | Additional descriptions for key information fields, corresponding to elements in keys by index. Use empty string "" for fields without descriptions. | No |
| tableHandlesDescribe | array[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 Parameter | Data Type | Description |
|---|---|---|
| code | Int | Error code, 200 indicates success |
| message | String | Error message |
| data | Object | Response result |
| +details | Object | Key information extraction result |
| ++pages | Object | Current page number, Page-Index |
| +++key | String | Key information field extraction result, key:value |
| +++tables | Array | Table extraction result, tables:[ [table1], [table2] ] |
JSON Structure Example:
{
"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:
http://localhost:7000/api/idp/api-file-resolve-apiRequest Header Parameters:
| Parameter | Data Type | Description | Required |
|---|---|---|---|
| API_KEY | String | License Key | Yes |
Request Body Parameters:
| Parameter | Data Type | Description | Required |
|---|---|---|---|
| file | File | Source document. | Yes |
JSON Response Explanation
| Response Parameter | Data Type | Description |
|---|---|---|
| code | Int | Error code, 200 indicates success |
| message | String | Error message |
| data | Object | Response result |
| +fileId | String | File ID |
| +downFileUrl | String | Document parsing result URL. |
Response Structure Example:
{
"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