名称 | 内容 |
文件要求 | 1. 文件格式:pdf、图片(JPG、JPEG、PNG、BMP、PDF等常见格式,建议使用JPG格式)。 2. 文件大小: a.如果传Base64编码,要求Base64编码和urlencode之后不超过 8 MB。 b.如果传文件完整URL, URL建议使用火山引擎对象存储,其他外部链接耗时与稳定性可能会受到影响,导致接口响应失败。 3. 输入文件过大时,返回的HttpCode如下:400/413/502。 |
名称 | 内容 |
接口地址 | |
请求方式 | POST |
Content-Type | application/x-www-form-urlencoded |
是否需要鉴权 | 是 |
参数 | 可选/必选 | 类型 | 说明 |
Action | 必选 | String | 接口名,取值:OCRPdf |
Version | 必选 | String | 版本号,取值:2021-08-23 |
字段 | 类型 | 说明 | 备注 |
markdown | String | markdown字符串 | 包含整本PDF解析结果。图片会以url链接返回,访问有效期为 30 分钟,请尽快下载保存。 |
detail | Array of Result | PDF解析结构化信息 | 见下面result说明 |
字段 | 类型 | 说明 | 备注 |
page_md | String | 每页markdown字符串 | |
page_image_hw | String | 图像信息 | |
textblocks | Array of Textblock | 段落信息 | 见下面textblock字段说明 |
page_id | Int | 当前页码 | 当前PDF中页码 |
字段 | 类型 | 说明 | 备注 |
text | String | 段落文本 | |
box | Array of Float | 元素块坐标信息 | 左上、右下坐标 |
label | String | 段落文本类别 | 见下面label字段说明 |
norm_box | Array of Float | 元素块坐标信息 | 归一化坐标 |
font_size | Int | 字体大小 | 仅供参考 |
is_bold | Bool | 是否粗体 | 仅供参考 |
is_italic | Bool | 是否斜体 | 仅供参考 |
url | String | 图片的超链接 | markdown中渲染用 |
字段 | 类型 | 说明 |
title | String | 标题 |
author | String | 作者 |
sec | String | 章节标题 |
para | String | 普通段落 |
header | String | 页眉 |
foot | String | 页脚 |
fnote | String | 脚注 |
image | String | 图片 |
table | String | 表格 |
cap | String | 图/表描述 |
HttpCode | 错误码 | 错误消息 | 描述 |
200 | 10000 | 无 | 请求成功 |
401 | 50205 | "Image Size Exceeds Maximum Limit: please compress the image" | 文件大小超过上限 |
400 | 50207 | "Image Decode Error: image format unsupported" | 文件解码错误,文件内容为空或格式错误 |
401 | 50400 | "Access denied due to invalid authentication information" | 鉴权失败 |
404 | 50402 | "Invalid Request URL" | 无效的请求路径 |
500 | 50500 | "Internal Error: please contact with bytedance engineering team" | 内部错误,需要联系开发人员 |