跳到主要内容

九宫格PDF

说明 将 1个PDF,按照9宫格方式排列,或将1个PDF文件变成缩略格式,排列格式支持2=2x1, 3=3x1, 4=2x2, 8=4x2, 9=3x3, 12=4x3, 16=4x4。如1个PDF有22页,采用就9宫格,变成3页,其中每页9个页面。

接口说明

请求地址

request_url 参考基础 > request_url

请求参数,POST请求

名称类型必须描述
methodStringpdf.pdfToGrid,固定值
tokenString可自行创建或更新,参考基础 > token
asyncString任务方式,默认0,代表同步;1代表异步,异步需要设置回调地址,或者主动查询结果
inputString输入文件,可访问互联网url,比如 https://static.easyyun.com/static/example/files/22_pages.pdf
optionsStringjson格式,比如{"grid": "9","direction":"vertical"}

options字段说明

  • grid 必须,每页排列数量,可选值:2、3、4、8、9、12、16,(2=2x1, 3=3x1, 4=2x2, 8=4x2, 9=3x3, 12=4x3, 16=4x4),默认9
  • direction 非必须,内容排列顺序(纵向、横向),因纸张问题,内容排版需根据情况选择。可选值:vertical、horizontal。(vertical纵向,A4纸张, horizontal 横向,Ledger纸张),默认vertical纵向

响应参数,类型为JSON

名称类型示例值描述
request_idStringxxx任务id
codeString200code说明
dataString{"file_url": "xxx"}json格式消息内容
code_msgString"成功"code描述

请求示例

curl -X POST 'https://test-rest-api.easyyun.com/v1/router/rest' \
-d 'method=pdf.pdfToGrid' \
-d 'token=395a25d6fa758bfb6c0d3da007a8b189' \
-d 'input=https://static.easyyun.com/static/example/files/22_pages.pdf' \
-d 'options={"grid": "9","direction": "horizontal"}'

响应示例

{
"request_id": "xxx",
"code": "200",
"data": {
"file_url": "https://static.easyyun.com/static/example/out/pdfToGrid.pdf"
},
"code_msg": "请求成功"
}