搜索关键字坐标

更新时间:2022-03-01 11:22:05

接口描述

搜索PDF文件中关键字的坐标,以关键字左下角为原点去查询坐标。

注意:扫描或图片生成的PDF文件无法检索关键字。

接口

/v1/documents/{fileId}/searchWordsPosition

请求方式

GET

请求头

提供两种安全接入方式,开发者可选择其中一种方式进行对接,对应参数如何获取,参考文档【请点击】。

方式一:请求签名鉴权(优先推荐)

请求头入参示例如下:

参数名称

类型

必选

参数说明

X-Tsign-Open-App-Id

string

项目ID

Content-Type

string

application/json;charset=UTF-8

X-Tsign-Open-Ca-Timestamp

string

API 调用者传递时间戳,值为当前时间的毫秒数,也就是从1970年1月1日起至今的时间转换为毫秒,时间戳有效时间为15分钟,为了防重放攻击

Accept

string

建议统一填写 */*

X-Tsign-Open-Ca-Signature

string

签名字符串

Content-MD5

string

当请求 Body 非 Form 表单时,可以计算 Body 的 MD5 值传递给云网关进行 Body MD5 校验。建议当请求 Body 非 Form 表单时,加上此请求头。

X-Tsign-Open-Auth-Mode

string

选择请求方式进行鉴权,固定值,Signature

方式二:OAuth2.0鉴权(不推荐使用)

当安全接入选择OAuth2.0鉴权方式请点击查阅详情,请求头入参示例如下:

参数名称

类型

必选

参数说明

X-Tsign-Open-App-Id

string

项目ID

X-Tsign-Open-Token

string

通过获取鉴权Token接口返回

Content-Type

string

application/json; charset=UTF-8


请求参数

参数名称

类型

必选

参数类型

参数说明

fileId

string

path

文档ID

keywords

string

query

关键字列表,逗号分割;注意要英文的逗号,不能中文逗号关键字建议不要设置特殊字符,因Adobe无法识别部分符号,某些特殊字符会因解析失败从而导致搜索不到。

注意:扫描或图片生成的PDF文件无法检索关键字。

公共响应参数

参数名称

类型

必选

参数说明

code

int

业务码,0表示成功

message

string

信息

data

array

业务信息

响应参数

展开全部参数参数名称

类型

必选

参数说明

fileId

string

文档id

keyword

string

关键字

positionList

array

位置列表

pageIndex

int

页码

coordinateList

array

坐标信息

posx

float

x坐标

posy

float

y坐标

请求示例  

GET https://openapi.esign.cn/v1/documents/{fileId}/searchWordsPosition?keywords=keyword1,keyword2

响应示例

{
  "code": 0,
  "message": "成功",
  "data": [
    {
      "keyword": "方法",
      "fileId": "b4f3d89420ec438ab83e8a02cabf1342",
      "positionList": [
        {
          "pageIndex": 1,
          "coordinateList": [
            {
              "posx": 315.43,
              "posy": 185.65723
            }
          ]
        }
      ]
    }
  ]
}
我要纠错