Skip to content

印章检测工具使用指南

注意:在学习使用不同函数之前,建议先阅读请求描述,了解基本的PDF处理流程。使用不同函数时,可以在上传文件时设置各自特殊的参数。其他基本步骤一致。

Java 示例:

您需要将 apiKey 替换为您从控制台获取的 publicKey ,将 file 替换为您要转换的文件 ,language 替换为您想要的接口错误提示语言类型。

java
import java.io.*;
import okhttp3.*;
public class main {
  public static void main(String []args) throws IOException{
    OkHttpClient client = new OkHttpClient().newBuilder()
      .build();
    MediaType mediaType = MediaType.parse("text/plain");
    RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
      .addFormDataPart("file","{{file}}",
 RequestBody.create(MediaType.parse("application/octet-stream"),
                                          new File("<file>")))
      .addFormDataPart("language","{{language}}")
      .addFormDataPart("password","")
      .build();
    Request request = new Request.Builder()
      .url("https://api-server.compdf.com/server/v1/process/documentAI/detectionStamp")
      .method("POST", body)
      .addHeader("x-api-key", "{{apiKey}}")
      .build();
    Response response = client.newCall(request).execute();
  }
}

结果:

文件类型说明
.JSONOCR检测结果

内容

参数说明
cost表单识别所花费的时间
boxes输入图像中所有检测到的对象框的位置
labels检测到的对象的标签。
scores分数越高,结果越可靠。
java
{
  "cost": 59,
  "boxes": [
      [
          913.0,
          399.0,
          1159.0,
          585.0
      ]
  ],
  "labels": [
      "Seal"
  ],
  "scores": [
      0.9240224957466125
  ]
}