Skip to content
全新发布

PDF SDK 与 AI 文档处理

在 GitHub 获取完整的私有化部署SDK 包及 AI 智能文档处理能力,一键部署,快速构建您的文档处理工作流。

PDF 生成 API

通过 HTML 文件、HTML 字符串、HTML URL,或 HTML 模板加 JSON 数据生成 PDF 文件。

HTML 转 PDF

项目
请求地址POST http://localhost:8080/api/v1/process/pdf/generation/html-to-pdf
认证x-api-key: your_api_key_here
请求类型multipart/form-data
成功响应PDF 文件流

参数

参数名类型说明是否必填
htmlFileFileHTML 文件;可与 request.htmlrequest.htmlUrl 三选一。
request.htmlStringHTML 字符串。
request.htmlUrlStringHTTP/HTTPS HTML 地址。
request.baseUriString相对资源基准路径或 URL。
request.pageSizeObject页面宽高,单位 pt。
request.outputFileNameString输出文件名。

curl 示例

bash
curl -X POST "http://localhost:8080/api/v1/process/pdf/generation/html-to-pdf" \
  -H "x-api-key: your_api_key_here" \
  -F "[email protected]" \
  -F 'request={"pageSize":{"width":595,"height":842},"outputFileName":"report.pdf"}' \
  -o report.pdf

模板转 PDF

项目
请求地址POST http://localhost:8080/api/v1/process/pdf/generation/template-to-pdf
认证x-api-key: your_api_key_here
请求类型multipart/form-data
成功响应PDF 文件流

参数

参数名类型说明是否必填
templateFileFileHTML 模板文件;可与 request.template 二选一。
dataFileFileJSON 数据文件;可与 request.data 二选一。
request.templateStringHTML 模板字符串。
request.dataObject/String模板数据。
request.baseUriString相对资源基准路径或 URL。
request.pageSizeObject页面宽高,单位 pt。
request.outputFileNameString输出文件名。

curl 示例

bash
curl -X POST "http://localhost:8080/api/v1/process/pdf/generation/template-to-pdf" \
  -H "x-api-key: your_api_key_here" \
  -F "[email protected]" \
  -F 'request={"data":{"invoiceNumber":"INV-001","customer":"Acme"},"outputFileName":"invoice.pdf"}' \
  -o invoice.pdf