mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
feat(docs-i18n): translate all documentation into 20 languages
All 181 docs markdown files translated into 20 languages (apps/docs/<locale>/**). Companion to the i18n code PR; admin-merged because the file count exceeds GitHub's per-PR CI trigger limit. Validated by pnpm i18n:check (all surfaces, 0 stale/missing) and a clean all-locale docs build.
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
---
|
||||
description: "排列 PDF 页面以便折叠成小册子。"
|
||||
i18n_source_hash: 8844b6d4fe96
|
||||
i18n_provenance: human
|
||||
i18n_output_hash: c8fcdb985453
|
||||
---
|
||||
|
||||
# 小册子 PDF {#booklet-pdf}
|
||||
|
||||
对页面进行拼版以进行双面打印,使打印出的纸张可以折叠成小册子。
|
||||
|
||||
## API 端点 {#api-endpoint}
|
||||
|
||||
`POST /api/v1/tools/pdf/booklet-pdf`
|
||||
|
||||
接受包含 PDF 文件和 JSON `settings` 字段的 multipart 表单数据。
|
||||
|
||||
## 参数 {#parameters}
|
||||
|
||||
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
||||
|-----------|------|----------|---------|-------------|
|
||||
| perSheet | integer | 否 | `2` | 每张纸的页数:`2`、`4`、`6` 或 `8` |
|
||||
|
||||
## 示例请求 {#example-request}
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/pdf/booklet-pdf \
|
||||
-H "Authorization: Bearer si_your-api-key" \
|
||||
-F "file=@document.pdf" \
|
||||
-F 'settings={"perSheet": 2}'
|
||||
```
|
||||
|
||||
## 示例响应 {#example-response}
|
||||
|
||||
```json
|
||||
{
|
||||
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||||
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/document.pdf",
|
||||
"originalSize": 2450000,
|
||||
"processedSize": 2400000
|
||||
}
|
||||
```
|
||||
|
||||
## 说明 {#notes}
|
||||
|
||||
- 默认的 `perSheet: 2` 在每张纸上并排放置两页,这是双面打印的标准小册子布局。
|
||||
- 如果总页数不是纸张容量的整数倍,会自动添加空白页。
|
||||
- 以短边装订方式双面打印输出,然后折叠并装订。
|
||||
@@ -0,0 +1,62 @@
|
||||
---
|
||||
description: "通过压缩嵌入的图像来缩减 PDF 文件大小。"
|
||||
i18n_source_hash: a8bb0baaca25
|
||||
i18n_provenance: human
|
||||
i18n_output_hash: c96018e728d8
|
||||
---
|
||||
|
||||
# Compress PDF {#compress-pdf}
|
||||
|
||||
通过对嵌入的图像进行降采样来缩减 PDF 文件大小。可在质量滑块和目标文件大小之间选择。
|
||||
|
||||
## API Endpoint {#api-endpoint}
|
||||
|
||||
`POST /api/v1/tools/pdf/compress-pdf`
|
||||
|
||||
接受包含一个 PDF 文件和一个 JSON `settings` 字段的 multipart 表单数据。
|
||||
|
||||
## Parameters {#parameters}
|
||||
|
||||
| Parameter | Type | Required | Default | Description |
|
||||
|-----------|------|----------|---------|-------------|
|
||||
| mode | string | No | `"quality"` | 压缩模式:`quality` 或 `targetSize` |
|
||||
| quality | integer | No | `75` | 压缩质量,1-100(值越高压缩越少)。在 `quality` 模式下使用 |
|
||||
| targetSizeKb | number | No | - | 以千字节为单位的目标文件大小。在 `targetSize` 模式下使用 |
|
||||
|
||||
## Example Request {#example-request}
|
||||
|
||||
按质量压缩:
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/pdf/compress-pdf \
|
||||
-H "Authorization: Bearer si_your-api-key" \
|
||||
-F "file=@document.pdf" \
|
||||
-F 'settings={"mode": "quality", "quality": 60}'
|
||||
```
|
||||
|
||||
压缩到目标大小:
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/pdf/compress-pdf \
|
||||
-H "Authorization: Bearer si_your-api-key" \
|
||||
-F "file=@document.pdf" \
|
||||
-F 'settings={"mode": "targetSize", "targetSizeKb": 500}'
|
||||
```
|
||||
|
||||
## Example Response {#example-response}
|
||||
|
||||
```json
|
||||
{
|
||||
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||||
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/document.pdf",
|
||||
"originalSize": 5200000,
|
||||
"processedSize": 1800000
|
||||
}
|
||||
```
|
||||
|
||||
## Notes {#notes}
|
||||
|
||||
- 在 `quality` 模式下,值越低生成的文件越小,但图像退化越严重。
|
||||
- 在 `targetSize` 模式下,二分查找会找到能够容纳所请求大小的最高 DPI。
|
||||
- 如果压缩会使文件变大,则原始字节将原样返回。
|
||||
- 文本和矢量内容不受影响;只有嵌入的栅格图像会被降采样。
|
||||
@@ -0,0 +1,48 @@
|
||||
---
|
||||
description: "以统一的边距裁剪 PDF 的所有页面。"
|
||||
i18n_source_hash: ffa1a2cee08d
|
||||
i18n_provenance: human
|
||||
i18n_output_hash: 98c1a64a36fd
|
||||
---
|
||||
|
||||
# Crop PDF {#crop-pdf}
|
||||
|
||||
通过应用统一边距裁剪 PDF 的所有页面,从每条边等量地裁去内容。
|
||||
|
||||
## API Endpoint {#api-endpoint}
|
||||
|
||||
`POST /api/v1/tools/pdf/crop-pdf`
|
||||
|
||||
接受包含一个 PDF 文件和一个 JSON `settings` 字段的 multipart 表单数据。
|
||||
|
||||
## Parameters {#parameters}
|
||||
|
||||
| Parameter | Type | Required | Default | Description |
|
||||
|-----------|------|----------|---------|-------------|
|
||||
| margin | number | No | `20` | 以点为单位的统一裁剪边距(0-2000) |
|
||||
|
||||
## Example Request {#example-request}
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/pdf/crop-pdf \
|
||||
-H "Authorization: Bearer si_your-api-key" \
|
||||
-F "file=@document.pdf" \
|
||||
-F 'settings={"margin": 50}'
|
||||
```
|
||||
|
||||
## Example Response {#example-response}
|
||||
|
||||
```json
|
||||
{
|
||||
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||||
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/document.pdf",
|
||||
"originalSize": 2450000,
|
||||
"processedSize": 2440000
|
||||
}
|
||||
```
|
||||
|
||||
## Notes {#notes}
|
||||
|
||||
- 边距值以 PDF 点为单位(1 点 = 1/72 英寸)。
|
||||
- 相同的边距会应用到每一页的全部四条边。
|
||||
- 边距为 `0` 会移除所有现有的裁剪边距,显示完整的媒体框。
|
||||
@@ -0,0 +1,47 @@
|
||||
---
|
||||
description: "从 PDF 中提取选定页面到一个新文档。"
|
||||
i18n_source_hash: e4a8fad31e0f
|
||||
i18n_provenance: human
|
||||
i18n_output_hash: a70ca59cae62
|
||||
---
|
||||
|
||||
# Extract Pages {#extract-pages}
|
||||
|
||||
从 PDF 中提取选定页面,生成一个新的、更小的文档。
|
||||
|
||||
## API Endpoint {#api-endpoint}
|
||||
|
||||
`POST /api/v1/tools/pdf/extract-pages`
|
||||
|
||||
接受包含一个 PDF 文件和一个 JSON `settings` 字段的 multipart 表单数据。
|
||||
|
||||
## Parameters {#parameters}
|
||||
|
||||
| Parameter | Type | Required | Default | Description |
|
||||
|-----------|------|----------|---------|-------------|
|
||||
| range | string | Yes | - | 采用 qpdf 语法的页面范围,例如 `"1-5,8,10-z"` |
|
||||
|
||||
## Example Request {#example-request}
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/pdf/extract-pages \
|
||||
-H "Authorization: Bearer si_your-api-key" \
|
||||
-F "file=@document.pdf" \
|
||||
-F 'settings={"range": "1-5,8,10-z"}'
|
||||
```
|
||||
|
||||
## Example Response {#example-response}
|
||||
|
||||
```json
|
||||
{
|
||||
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||||
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/document.pdf",
|
||||
"originalSize": 3200000,
|
||||
"processedSize": 1100000
|
||||
}
|
||||
```
|
||||
|
||||
## Notes {#notes}
|
||||
|
||||
- 页面范围使用 qpdf 语法:`1-5` 表示第 1 到第 5 页,`z` 表示最后一页,用逗号组合多个范围(例如 `1-3,7,10-z`)。
|
||||
- 提取出的页面保留其原始格式、注释和链接。
|
||||
@@ -0,0 +1,46 @@
|
||||
---
|
||||
description: "将表单和注释固化到页面内容中。"
|
||||
i18n_source_hash: b25c2a2b6f40
|
||||
i18n_provenance: human
|
||||
i18n_output_hash: 16ebbe40d5eb
|
||||
---
|
||||
|
||||
# Flatten PDF {#flatten-pdf}
|
||||
|
||||
将交互式表单字段和注释固化到页面内容中,生成一个在任何地方看起来都一致的静态 PDF。
|
||||
|
||||
## API Endpoint {#api-endpoint}
|
||||
|
||||
`POST /api/v1/tools/pdf/flatten-pdf`
|
||||
|
||||
接受包含一个 PDF 文件的 multipart 表单数据。
|
||||
|
||||
## Parameters {#parameters}
|
||||
|
||||
此工具没有可配置参数。上传 PDF,所有表单和注释都会被扁平化。
|
||||
|
||||
## Example Request {#example-request}
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/pdf/flatten-pdf \
|
||||
-H "Authorization: Bearer si_your-api-key" \
|
||||
-F "file=@form.pdf"
|
||||
```
|
||||
|
||||
## Example Response {#example-response}
|
||||
|
||||
```json
|
||||
{
|
||||
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||||
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/form.pdf",
|
||||
"originalSize": 185000,
|
||||
"processedSize": 172000
|
||||
}
|
||||
```
|
||||
|
||||
## Notes {#notes}
|
||||
|
||||
- 接受的输入格式:`.pdf`。
|
||||
- 这是一个快速(同步)工具,直接返回结果。
|
||||
- 表单字段的值在输出中被保留为静态文本。
|
||||
- 注释(评论、高亮、便签)会成为页面内容的一部分,不再可编辑。
|
||||
@@ -0,0 +1,44 @@
|
||||
---
|
||||
description: "将 PDF 中的所有颜色转换为灰度。"
|
||||
i18n_source_hash: f327addb32d6
|
||||
i18n_provenance: human
|
||||
i18n_output_hash: 42ba9d288dca
|
||||
---
|
||||
|
||||
# Grayscale PDF {#grayscale-pdf}
|
||||
|
||||
将 PDF 中的所有颜色转换为灰度,生成文档的黑白版本。
|
||||
|
||||
## API Endpoint {#api-endpoint}
|
||||
|
||||
`POST /api/v1/tools/pdf/grayscale-pdf`
|
||||
|
||||
接受包含一个 PDF 文件的 multipart 表单数据。无需 `settings` 字段。
|
||||
|
||||
## Parameters {#parameters}
|
||||
|
||||
此工具没有设置参数。直接上传 PDF 文件即可。
|
||||
|
||||
## Example Request {#example-request}
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/pdf/grayscale-pdf \
|
||||
-H "Authorization: Bearer si_your-api-key" \
|
||||
-F "file=@document.pdf"
|
||||
```
|
||||
|
||||
## Example Response {#example-response}
|
||||
|
||||
```json
|
||||
{
|
||||
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||||
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/document.pdf",
|
||||
"originalSize": 3200000,
|
||||
"processedSize": 2800000
|
||||
}
|
||||
```
|
||||
|
||||
## Notes {#notes}
|
||||
|
||||
- 所有色彩空间(RGB、CMYK)都会转换为灰度,包括嵌入的图像、矢量图形和文本。
|
||||
- 输出文件通常比原始文件更小,因为灰度数据每像素所需的字节更少。
|
||||
@@ -0,0 +1,45 @@
|
||||
---
|
||||
description: "线性化 PDF 以实现快速网页查看(渐进式下载)。"
|
||||
i18n_source_hash: 36280b478161
|
||||
i18n_provenance: human
|
||||
i18n_output_hash: 03079e663052
|
||||
---
|
||||
|
||||
# Web-Optimize PDF {#web-optimize-pdf}
|
||||
|
||||
对 PDF 进行线性化,使其可以在网页浏览器中渐进式下载和显示,无需等待整个文件。
|
||||
|
||||
## API Endpoint {#api-endpoint}
|
||||
|
||||
`POST /api/v1/tools/pdf/linearize-pdf`
|
||||
|
||||
接受包含一个 PDF 文件的 multipart 表单数据。无需 `settings` 字段。
|
||||
|
||||
## Parameters {#parameters}
|
||||
|
||||
此工具没有设置参数。直接上传 PDF 文件即可。
|
||||
|
||||
## Example Request {#example-request}
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/pdf/linearize-pdf \
|
||||
-H "Authorization: Bearer si_your-api-key" \
|
||||
-F "file=@document.pdf"
|
||||
```
|
||||
|
||||
## Example Response {#example-response}
|
||||
|
||||
```json
|
||||
{
|
||||
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||||
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/document.pdf",
|
||||
"originalSize": 2450000,
|
||||
"processedSize": 2460000
|
||||
}
|
||||
```
|
||||
|
||||
## Notes {#notes}
|
||||
|
||||
- 线性化会重新排列 PDF 的内部结构,使第一页可以在整个文件下载完成之前先渲染。
|
||||
- 由于添加了线性化数据,输出文件可能会比输入文件略大。
|
||||
- 已线性化的 PDF 可以被重新线性化,不会出现问题。
|
||||
@@ -0,0 +1,53 @@
|
||||
---
|
||||
description: "将多个 PDF 合并成一个文档。"
|
||||
i18n_source_hash: e82e389cb8b6
|
||||
i18n_provenance: human
|
||||
i18n_output_hash: b509a58c4264
|
||||
---
|
||||
|
||||
# Merge PDFs {#merge-pdfs}
|
||||
|
||||
将两个或更多 PDF 文件合并成一个文档,保留每个输入文件的页面顺序。
|
||||
|
||||
## API Endpoint {#api-endpoint}
|
||||
|
||||
`POST /api/v1/tools/pdf/merge-pdf`
|
||||
|
||||
接受包含两个或更多 PDF 文件的 multipart 表单数据。无需 `settings` 字段。
|
||||
|
||||
## Parameters {#parameters}
|
||||
|
||||
此工具没有设置参数。只需上传两个或更多 PDF 文件。
|
||||
|
||||
| Constraint | Value |
|
||||
|------------|-------|
|
||||
| Minimum files | 2 |
|
||||
| Maximum files | 20 |
|
||||
|
||||
## Example Request {#example-request}
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/pdf/merge-pdf \
|
||||
-H "Authorization: Bearer si_your-api-key" \
|
||||
-F "file=@document1.pdf" \
|
||||
-F "file=@document2.pdf" \
|
||||
-F "file=@document3.pdf"
|
||||
```
|
||||
|
||||
## Example Response {#example-response}
|
||||
|
||||
```json
|
||||
{
|
||||
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||||
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/merged.pdf",
|
||||
"originalSize": 4500000,
|
||||
"processedSize": 4200000
|
||||
}
|
||||
```
|
||||
|
||||
## Notes {#notes}
|
||||
|
||||
- 文件按上传的顺序合并。
|
||||
- 至少需要两个 PDF 文件;如果提供的文件少于两个,请求将以 400 错误失败。
|
||||
- 输入文件的最大数量为 20。
|
||||
- 加密的 PDF 必须先解锁才能合并。
|
||||
@@ -0,0 +1,48 @@
|
||||
---
|
||||
description: "在每张纸上排布多个 PDF 页面(2 合 1、4 合 1 等)。"
|
||||
i18n_source_hash: 9dd82737cb72
|
||||
i18n_provenance: human
|
||||
i18n_output_hash: f7c9899d22b1
|
||||
---
|
||||
|
||||
# N-up PDF {#n-up-pdf}
|
||||
|
||||
在每张纸上排布多个页面以在打印时节省纸张,例如 2 合 1 或 4 合 1 版式。
|
||||
|
||||
## API Endpoint {#api-endpoint}
|
||||
|
||||
`POST /api/v1/tools/pdf/nup-pdf`
|
||||
|
||||
接受包含一个 PDF 文件和一个 JSON `settings` 字段的 multipart 表单数据。
|
||||
|
||||
## Parameters {#parameters}
|
||||
|
||||
| Parameter | Type | Required | Default | Description |
|
||||
|-----------|------|----------|---------|-------------|
|
||||
| perSheet | integer | No | `2` | 每张纸的页数:`2`、`3`、`4`、`8`、`9`、`12` 或 `16` |
|
||||
|
||||
## Example Request {#example-request}
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/pdf/nup-pdf \
|
||||
-H "Authorization: Bearer si_your-api-key" \
|
||||
-F "file=@document.pdf" \
|
||||
-F 'settings={"perSheet": 4}'
|
||||
```
|
||||
|
||||
## Example Response {#example-response}
|
||||
|
||||
```json
|
||||
{
|
||||
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||||
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/document.pdf",
|
||||
"originalSize": 2450000,
|
||||
"processedSize": 2300000
|
||||
}
|
||||
```
|
||||
|
||||
## Notes {#notes}
|
||||
|
||||
- 页面按阅读顺序排布(从左到右,从上到下)。
|
||||
- 输出页面大小与原始页面一致;各个页面会被缩小以适应网格。
|
||||
- 一个 20 页的文档使用 `perSheet: 4` 会生成一个 5 页的输出。
|
||||
@@ -0,0 +1,53 @@
|
||||
---
|
||||
description: "使用 AI 驱动的 OCR 从 PDF 文档中提取文本。"
|
||||
i18n_source_hash: 1431fcba180b
|
||||
i18n_provenance: human
|
||||
i18n_output_hash: 3bb9f4bd9334
|
||||
---
|
||||
|
||||
# PDF OCR {#pdf-ocr}
|
||||
|
||||
使用 AI 驱动的光学字符识别从 PDF 文档中提取文本。支持多种质量层级和语言。需要安装 OCR 功能包。
|
||||
|
||||
## API Endpoint {#api-endpoint}
|
||||
|
||||
`POST /api/v1/tools/pdf/ocr-pdf`
|
||||
|
||||
接受包含一个 PDF 文件和一个可选的 JSON `settings` 字段的 multipart 表单数据。
|
||||
|
||||
## Parameters {#parameters}
|
||||
|
||||
| Parameter | Type | Required | Default | Description |
|
||||
|-----------|------|----------|---------|-------------|
|
||||
| quality | string | No | `"balanced"` | OCR 质量层级:`fast`、`balanced`、`best` |
|
||||
| language | string | No | `"auto"` | 文档语言:`auto`、`en`、`de`、`fr`、`es`、`zh`、`ja`、`ko` |
|
||||
| pages | string | No | `"all"` | 页面选择,例如 `"all"`、`"1-3"`、`"1,3,5"` |
|
||||
|
||||
## Example Request {#example-request}
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/pdf/ocr-pdf \
|
||||
-H "Authorization: Bearer si_your-api-key" \
|
||||
-F "file=@scanned.pdf" \
|
||||
-F 'settings={"quality": "best", "language": "en", "pages": "1-5"}'
|
||||
```
|
||||
|
||||
## Example Response {#example-response}
|
||||
|
||||
返回 `202 Accepted`。通过 SSE 在 `/api/v1/jobs/{jobId}/progress` 跟踪进度。
|
||||
|
||||
```json
|
||||
{
|
||||
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||||
"async": true
|
||||
}
|
||||
```
|
||||
|
||||
## Notes {#notes}
|
||||
|
||||
- 接受的输入格式:`.pdf`。
|
||||
- 这是一个 AI 工具,需要安装 **OCR 功能包**。如果未安装该功能包,API 将返回 `501 Not Implemented`。
|
||||
- `fast` 质量层级使用较轻量的模型以加快处理速度;`best` 使用更精确的模型,但以速度为代价。
|
||||
- `auto` 语言设置会尝试自动检测文档语言。
|
||||
- 你可以使用范围(`"1-3"`)、逗号分隔的列表(`"1,3,5"`)或 `"all"` 来针对特定页面处理所有页面。
|
||||
- 对于已经包含可选择文本的 PDF,请考虑改用更快的 [PDF to Text](./pdf-to-text) 工具。
|
||||
@@ -0,0 +1,48 @@
|
||||
---
|
||||
description: "使用显式的页面顺序重新排列 PDF 中的页面。"
|
||||
i18n_source_hash: e961fc895b4b
|
||||
i18n_provenance: human
|
||||
i18n_output_hash: 716a5fd688bb
|
||||
---
|
||||
|
||||
# Organize PDF {#organize-pdf}
|
||||
|
||||
通过指定所需的页面序列来重新排列 PDF 中的页面。
|
||||
|
||||
## API Endpoint {#api-endpoint}
|
||||
|
||||
`POST /api/v1/tools/pdf/organize-pdf`
|
||||
|
||||
接受包含一个 PDF 文件和一个 JSON `settings` 字段的 multipart 表单数据。
|
||||
|
||||
## Parameters {#parameters}
|
||||
|
||||
| Parameter | Type | Required | Default | Description |
|
||||
|-----------|------|----------|---------|-------------|
|
||||
| order | string | Yes | - | 采用 qpdf 语法的所需页面顺序,例如 `"3,1,2,5-z"` |
|
||||
|
||||
## Example Request {#example-request}
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/pdf/organize-pdf \
|
||||
-H "Authorization: Bearer si_your-api-key" \
|
||||
-F "file=@document.pdf" \
|
||||
-F 'settings={"order": "3,1,2,5-z"}'
|
||||
```
|
||||
|
||||
## Example Response {#example-response}
|
||||
|
||||
```json
|
||||
{
|
||||
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||||
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/document.pdf",
|
||||
"originalSize": 2450000,
|
||||
"processedSize": 2450000
|
||||
}
|
||||
```
|
||||
|
||||
## Notes {#notes}
|
||||
|
||||
- 页面范围使用 qpdf 语法:`3,1,2` 重新排列前三页,`5-z` 追加第 5 页到最后一页。
|
||||
- 通过多次列出某个页面可以复制它(例如 `"1,1,2,3"` 复制第 1 页)。
|
||||
- 未在顺序字符串中列出的页面会从输出中省略。
|
||||
@@ -0,0 +1,61 @@
|
||||
---
|
||||
description: "读取和写入 PDF 文档元数据。"
|
||||
i18n_source_hash: b2eaebf7467f
|
||||
i18n_provenance: human
|
||||
i18n_output_hash: 32460477a093
|
||||
---
|
||||
|
||||
# PDF Metadata {#pdf-metadata}
|
||||
|
||||
读取和更新 PDF 文档的元数据字段,例如标题、作者、主题和关键字。当未提供任何设置时,将返回现有元数据而不做修改。
|
||||
|
||||
## API Endpoint {#api-endpoint}
|
||||
|
||||
`POST /api/v1/tools/pdf/pdf-metadata`
|
||||
|
||||
接受包含一个 PDF 文件和一个可选的 JSON `settings` 字段的 multipart 表单数据。
|
||||
|
||||
## Parameters {#parameters}
|
||||
|
||||
| Parameter | Type | Required | Default | Description |
|
||||
|-----------|------|----------|---------|-------------|
|
||||
| title | string | No | - | 文档标题(最多 500 个字符) |
|
||||
| author | string | No | - | 文档作者(最多 500 个字符) |
|
||||
| subject | string | No | - | 文档主题(最多 500 个字符) |
|
||||
| keywords | string | No | - | 文档关键字(最多 500 个字符) |
|
||||
|
||||
所有参数都是可选的。省略的字段保持不变。
|
||||
|
||||
## Example Request {#example-request}
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/pdf/pdf-metadata \
|
||||
-H "Authorization: Bearer si_your-api-key" \
|
||||
-F "file=@report.pdf" \
|
||||
-F 'settings={"title": "Q2 Report", "author": "Finance Team"}'
|
||||
```
|
||||
|
||||
## Example Response {#example-response}
|
||||
|
||||
```json
|
||||
{
|
||||
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||||
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/report.pdf",
|
||||
"originalSize": 245000,
|
||||
"processedSize": 245200,
|
||||
"metadata": {
|
||||
"title": "Q2 Report",
|
||||
"author": "Finance Team",
|
||||
"subject": "",
|
||||
"keywords": ""
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Notes {#notes}
|
||||
|
||||
- 接受的输入格式:`.pdf`。
|
||||
- 这是一个快速(同步)工具,直接返回结果。
|
||||
- 响应中的 `metadata` 字段包含任何更新之后得到的元数据。
|
||||
- 若要在不修改的情况下读取元数据,请省略 `settings` 字段或发送一个空对象。
|
||||
- 每个元数据字段限制为 500 个字符。
|
||||
@@ -0,0 +1,54 @@
|
||||
---
|
||||
description: "为 PDF 的每一页添加页码。"
|
||||
i18n_source_hash: 58342d6ac8d2
|
||||
i18n_provenance: human
|
||||
i18n_output_hash: c41c0a34a46d
|
||||
---
|
||||
|
||||
# PDF Page Numbers {#pdf-page-numbers}
|
||||
|
||||
为 PDF 的每一页添加“Page N of M”页码。
|
||||
|
||||
## API Endpoint {#api-endpoint}
|
||||
|
||||
`POST /api/v1/tools/pdf/pdf-page-numbers`
|
||||
|
||||
接受包含一个 PDF 文件和一个 JSON `settings` 字段的 multipart 表单数据。
|
||||
|
||||
## Parameters {#parameters}
|
||||
|
||||
| Parameter | Type | Required | Default | Description |
|
||||
|-----------|------|----------|---------|-------------|
|
||||
| position | string | No | `"bc"` | 页码位置:`bl`、`bc`、`br`、`tl`、`tc`、`tr` |
|
||||
| fontSize | integer | No | `10` | 以点为单位的字号(6-24) |
|
||||
|
||||
### Position Values {#position-values}
|
||||
|
||||
- `tl` 左上,`tc` 顶部居中,`tr` 右上
|
||||
- `bl` 左下,`bc` 底部居中,`br` 右下
|
||||
|
||||
## Example Request {#example-request}
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/pdf/pdf-page-numbers \
|
||||
-H "Authorization: Bearer si_your-api-key" \
|
||||
-F "file=@document.pdf" \
|
||||
-F 'settings={"position": "bc", "fontSize": 12}'
|
||||
```
|
||||
|
||||
## Example Response {#example-response}
|
||||
|
||||
```json
|
||||
{
|
||||
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||||
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/document.pdf",
|
||||
"originalSize": 2450000,
|
||||
"processedSize": 2470000
|
||||
}
|
||||
```
|
||||
|
||||
## Notes {#notes}
|
||||
|
||||
- 页码以“Page 1 of 10”的格式渲染。
|
||||
- 页码会添加到每一页,包括任何现有的标题页或封面页。
|
||||
- 默认位置 `"bc"` 会将页码放在每页的底部居中位置。
|
||||
@@ -0,0 +1,133 @@
|
||||
---
|
||||
description: "将 PDF 页面转换为高质量图像。"
|
||||
i18n_source_hash: 1c36be5dadb8
|
||||
i18n_provenance: human
|
||||
i18n_output_hash: 72d79f12822f
|
||||
---
|
||||
|
||||
# PDF to Image {#pdf-to-image}
|
||||
|
||||
将 PDF 页面转换为高质量的栅格图像。支持页面选择、多种输出格式、DPI 控制和色彩模式。包含用于在转换前检查 PDF 的 info 和 preview 子路由。
|
||||
|
||||
## API Endpoint {#api-endpoint}
|
||||
|
||||
`POST /api/v1/tools/pdf/pdf-to-image`
|
||||
|
||||
## Parameters {#parameters}
|
||||
|
||||
| Parameter | Type | Required | Default | Description |
|
||||
|-----------|------|----------|---------|-------------|
|
||||
| format | string | No | `"png"` | 输出格式:`png`、`jpg`、`webp`、`avif`、`tiff`、`gif`、`heic`、`heif`、`jxl` |
|
||||
| dpi | number | No | 150 | 渲染分辨率(36 到 2400)。DPI 越高,生成的图像越大、越精细。 |
|
||||
| quality | number | No | 85 | 有损格式的输出质量(1 到 100) |
|
||||
| colorMode | string | No | `"color"` | 色彩模式:`color`、`grayscale`、`bw`(黑白阈值) |
|
||||
| pages | string | No | `"all"` | 页面选择:`all`、单页(`3`)、范围(`1-5`)或逗号分隔(`1,3,5-8`) |
|
||||
|
||||
## Example Request {#example-request}
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/pdf/pdf-to-image \
|
||||
-F "file=@document.pdf" \
|
||||
-F 'settings={"format":"png","dpi":300,"pages":"1-3","colorMode":"color"}'
|
||||
```
|
||||
|
||||
## Example Response {#example-response}
|
||||
|
||||
```json
|
||||
{
|
||||
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||||
"pageCount": 10,
|
||||
"selectedPages": [1, 2, 3],
|
||||
"format": "png",
|
||||
"pages": [
|
||||
{
|
||||
"page": 1,
|
||||
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/page-1.png",
|
||||
"size": 234567
|
||||
},
|
||||
{
|
||||
"page": 2,
|
||||
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/page-2.png",
|
||||
"size": 198765
|
||||
},
|
||||
{
|
||||
"page": 3,
|
||||
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/page-3.png",
|
||||
"size": 210456
|
||||
}
|
||||
],
|
||||
"zipUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/pdf-pages.zip",
|
||||
"zipSize": 612345
|
||||
}
|
||||
```
|
||||
|
||||
## Info Sub-Route {#info-sub-route}
|
||||
|
||||
`POST /api/v1/tools/pdf/pdf-to-image/info`
|
||||
|
||||
返回 PDF 的页数,而不渲染任何页面。
|
||||
|
||||
### Info Request {#info-request}
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/pdf/pdf-to-image/info \
|
||||
-F "file=@document.pdf"
|
||||
```
|
||||
|
||||
### Info Response {#info-response}
|
||||
|
||||
```json
|
||||
{
|
||||
"pageCount": 10
|
||||
}
|
||||
```
|
||||
|
||||
## Preview Sub-Route {#preview-sub-route}
|
||||
|
||||
`POST /api/v1/tools/pdf/pdf-to-image/preview`
|
||||
|
||||
以 base64 数据 URL 的形式返回所有页面的低分辨率 JPEG 缩略图。适用于构建页面选择 UI。
|
||||
|
||||
### Preview Request {#preview-request}
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/pdf/pdf-to-image/preview \
|
||||
-F "file=@document.pdf"
|
||||
```
|
||||
|
||||
### Preview Response {#preview-response}
|
||||
|
||||
```json
|
||||
{
|
||||
"pageCount": 10,
|
||||
"thumbnails": [
|
||||
{
|
||||
"page": 1,
|
||||
"dataUrl": "data:image/jpeg;base64,/9j/4AAQ...",
|
||||
"width": 300,
|
||||
"height": 424
|
||||
},
|
||||
{
|
||||
"page": 2,
|
||||
"dataUrl": "data:image/jpeg;base64,/9j/4AAQ...",
|
||||
"width": 300,
|
||||
"height": 424
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Notes {#notes}
|
||||
|
||||
- 使用 MuPDF 进行 PDF 渲染,提供高保真输出,具备正确的字体渲染和矢量图形。
|
||||
- 不支持受密码保护的 PDF,会返回 400 错误。
|
||||
- `pages` 参数支持灵活的语法:
|
||||
- `"all"` 或 `""` - 所有页面
|
||||
- `"3"` - 单页
|
||||
- `"1-5"` - 页面范围(含首尾)
|
||||
- `"1,3,5-8"` - 单页和范围混合
|
||||
- 页码从 1 开始。指定超出文档长度的页面会返回 400 错误。
|
||||
- 主端点始终同时生成各个页面的下载文件和包含所有选定页面的 ZIP。
|
||||
- 预览端点以 72 DPI 渲染并缩放到 300px 宽度以快速生成缩略图。缩略图为 60% 质量的 JPEG。
|
||||
- 预览端点会遵循 `MAX_PDF_PAGES` 服务器配置,限制生成的缩略图数量。
|
||||
- 对于高 DPI 的大型文档,处理时间会成比例增加。网页用途请考虑使用较低的 DPI(150),打印用途请使用较高的 DPI(300-600)。
|
||||
@@ -0,0 +1,47 @@
|
||||
---
|
||||
description: "从 PDF 中提取纯文本。"
|
||||
i18n_source_hash: 15a7bc1cdf8f
|
||||
i18n_provenance: human
|
||||
i18n_output_hash: 5d3bd018e6d3
|
||||
---
|
||||
|
||||
# PDF to Text {#pdf-to-text}
|
||||
|
||||
将 PDF 文档中所有可读的纯文本提取到一个文本文件中。
|
||||
|
||||
## API Endpoint {#api-endpoint}
|
||||
|
||||
`POST /api/v1/tools/pdf/pdf-to-text`
|
||||
|
||||
接受包含一个 PDF 文件的 multipart 表单数据。
|
||||
|
||||
## Parameters {#parameters}
|
||||
|
||||
此工具没有可配置参数。上传 PDF,其文本内容将被提取。
|
||||
|
||||
## Example Request {#example-request}
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/pdf/pdf-to-text \
|
||||
-H "Authorization: Bearer si_your-api-key" \
|
||||
-F "file=@report.pdf"
|
||||
```
|
||||
|
||||
## Example Response {#example-response}
|
||||
|
||||
```json
|
||||
{
|
||||
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||||
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/report.txt",
|
||||
"originalSize": 520000,
|
||||
"processedSize": 14300,
|
||||
"chars": 14300
|
||||
}
|
||||
```
|
||||
|
||||
## Notes {#notes}
|
||||
|
||||
- 接受的输入格式:`.pdf`。
|
||||
- 这是一个快速(同步)工具,直接返回结果。
|
||||
- 响应中的 `chars` 字段表示提取的字符数。
|
||||
- 仅提取以数字方式嵌入的文本。对于扫描文档或基于图像的 PDF,请改用 [PDF OCR](./ocr-pdf) 工具。
|
||||
@@ -0,0 +1,46 @@
|
||||
---
|
||||
description: "将 PDF 转换为 Word 文档(DOCX)。"
|
||||
i18n_source_hash: be41b6b49f84
|
||||
i18n_provenance: human
|
||||
i18n_output_hash: 2fc4c695a99e
|
||||
---
|
||||
|
||||
# PDF to Word {#pdf-to-word}
|
||||
|
||||
将基于文本的 PDF 转换为 Word 文档(DOCX)。最适合具有可选择文本的 PDF;扫描页面需要先进行 OCR。
|
||||
|
||||
## API Endpoint {#api-endpoint}
|
||||
|
||||
`POST /api/v1/tools/pdf/pdf-to-word`
|
||||
|
||||
接受包含一个 PDF 文件的 multipart 表单数据。
|
||||
|
||||
## Parameters {#parameters}
|
||||
|
||||
此工具没有可配置参数。上传 PDF,它将被转换为 DOCX。
|
||||
|
||||
## Example Request {#example-request}
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/pdf/pdf-to-word \
|
||||
-H "Authorization: Bearer si_your-api-key" \
|
||||
-F "file=@report.pdf"
|
||||
```
|
||||
|
||||
## Example Response {#example-response}
|
||||
|
||||
返回 `202 Accepted`。通过 SSE 在 `/api/v1/jobs/{jobId}/progress` 跟踪进度。
|
||||
|
||||
```json
|
||||
{
|
||||
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||||
"async": true
|
||||
}
|
||||
```
|
||||
|
||||
## Notes {#notes}
|
||||
|
||||
- 接受的输入格式:`.pdf`。
|
||||
- 对基于文本的 PDF 效果最佳。扫描页或纯图像页会生成空的或极少的输出;请先使用 [PDF OCR](./ocr-pdf) 添加文本层。
|
||||
- 转换由服务器上无头运行的 LibreOffice 处理。
|
||||
- 复杂版式(多栏、重叠元素)可能无法完美转换。
|
||||
@@ -0,0 +1,45 @@
|
||||
---
|
||||
description: "将 PDF 转换为归档用 PDF/A-2 格式以实现长期保存。"
|
||||
i18n_source_hash: 4c6bf7a12e84
|
||||
i18n_provenance: human
|
||||
i18n_output_hash: 49f702ce85db
|
||||
---
|
||||
|
||||
# PDF/A Convert {#pdf-a-convert}
|
||||
|
||||
将 PDF 转换为 PDF/A-2 归档格式,适用于长期保存和合规要求。
|
||||
|
||||
## API Endpoint {#api-endpoint}
|
||||
|
||||
`POST /api/v1/tools/pdf/pdfa-convert`
|
||||
|
||||
接受包含一个 PDF 文件的 multipart 表单数据。无需 `settings` 字段。
|
||||
|
||||
## Parameters {#parameters}
|
||||
|
||||
此工具没有设置参数。直接上传 PDF 文件即可。
|
||||
|
||||
## Example Request {#example-request}
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/pdf/pdfa-convert \
|
||||
-H "Authorization: Bearer si_your-api-key" \
|
||||
-F "file=@document.pdf"
|
||||
```
|
||||
|
||||
## Example Response {#example-response}
|
||||
|
||||
```json
|
||||
{
|
||||
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||||
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/document.pdf",
|
||||
"originalSize": 2450000,
|
||||
"processedSize": 2600000
|
||||
}
|
||||
```
|
||||
|
||||
## Notes {#notes}
|
||||
|
||||
- 输出符合 PDF/A-2 标准。
|
||||
- PDF/A 会嵌入所有字体并禁止外部引用,因此输出文件可能比原始文件更大。
|
||||
- 转换过程中会剥离加密和 JavaScript,因为 PDF/A 标准不允许使用它们。
|
||||
@@ -0,0 +1,50 @@
|
||||
---
|
||||
description: "为 PDF 添加带 AES-256 加密的密码保护。"
|
||||
i18n_source_hash: 869cfbc739ef
|
||||
i18n_provenance: human
|
||||
i18n_output_hash: a3a9f913be85
|
||||
---
|
||||
|
||||
# Protect PDF {#protect-pdf}
|
||||
|
||||
使用 AES-256 加密为 PDF 添加密码保护。
|
||||
|
||||
## API Endpoint {#api-endpoint}
|
||||
|
||||
`POST /api/v1/tools/pdf/protect-pdf`
|
||||
|
||||
接受包含一个 PDF 文件和一个 JSON `settings` 字段的 multipart 表单数据。
|
||||
|
||||
## Parameters {#parameters}
|
||||
|
||||
| Parameter | Type | Required | Default | Description |
|
||||
|-----------|------|----------|---------|-------------|
|
||||
| userPassword | string | Yes | - | 打开 PDF 所需的密码(1-256 个字符) |
|
||||
| ownerPassword | string | No | 与 `userPassword` 相同 | 用于权限控制的所有者密码(1-256 个字符) |
|
||||
|
||||
## Example Request {#example-request}
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/pdf/protect-pdf \
|
||||
-H "Authorization: Bearer si_your-api-key" \
|
||||
-F "file=@document.pdf" \
|
||||
-F 'settings={"userPassword": "s3cret", "ownerPassword": "0wn3r"}'
|
||||
```
|
||||
|
||||
## Example Response {#example-response}
|
||||
|
||||
```json
|
||||
{
|
||||
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||||
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/document.pdf",
|
||||
"originalSize": 2450000,
|
||||
"processedSize": 2500000
|
||||
}
|
||||
```
|
||||
|
||||
## Notes {#notes}
|
||||
|
||||
- 加密使用 AES-256。
|
||||
- 如果省略 `ownerPassword`,则默认为与 `userPassword` 相同的值。
|
||||
- 密码会从审计日志中被隐去。
|
||||
- 加密后的 PDF 需要用户密码才能打开,需要所有者密码(如果不同)才能获得完整权限。
|
||||
@@ -0,0 +1,52 @@
|
||||
---
|
||||
description: "从 PDF 中永久移除指定的文本(经验证的真正涂黑)。"
|
||||
i18n_source_hash: 296ad2a701b2
|
||||
i18n_provenance: human
|
||||
i18n_output_hash: bba620b6691d
|
||||
---
|
||||
|
||||
# Redact PDF {#redact-pdf}
|
||||
|
||||
使用经验证的真正涂黑从 PDF 中永久移除指定的文本。被涂黑的文本会从文件中彻底移除,而不仅仅是被黑框覆盖。
|
||||
|
||||
## API Endpoint {#api-endpoint}
|
||||
|
||||
`POST /api/v1/tools/pdf/redact-pdf`
|
||||
|
||||
接受包含一个 PDF 文件和一个 JSON `settings` 字段的 multipart 表单数据。
|
||||
|
||||
## Parameters {#parameters}
|
||||
|
||||
| Parameter | Type | Required | Default | Description |
|
||||
|-----------|------|----------|---------|-------------|
|
||||
| terms | string[] | Yes | - | 要涂黑的文本字符串(1-50 个词条,每个最多 200 个字符) |
|
||||
| caseSensitive | boolean | No | `false` | 匹配是否区分大小写 |
|
||||
|
||||
## Example Request {#example-request}
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/pdf/redact-pdf \
|
||||
-H "Authorization: Bearer si_your-api-key" \
|
||||
-F "file=@contract.pdf" \
|
||||
-F 'settings={"terms": ["John Doe", "555-0123"], "caseSensitive": false}'
|
||||
```
|
||||
|
||||
## Example Response {#example-response}
|
||||
|
||||
```json
|
||||
{
|
||||
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||||
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/contract.pdf",
|
||||
"originalSize": 245000,
|
||||
"processedSize": 243000,
|
||||
"found": 7
|
||||
}
|
||||
```
|
||||
|
||||
## Notes {#notes}
|
||||
|
||||
- 接受的输入格式:`.pdf`。
|
||||
- 这是一个快速(同步)工具,直接返回结果。
|
||||
- 这会执行真正的涂黑:匹配到的文本会从 PDF 内容流中移除,而不仅仅是在视觉上遮盖。
|
||||
- 响应中的 `found` 字段表示涂黑了多少处。
|
||||
- 单次请求最多可涂黑 50 个词条。
|
||||
@@ -0,0 +1,47 @@
|
||||
---
|
||||
description: "从 PDF 中删除特定页面。"
|
||||
i18n_source_hash: 003e460a047c
|
||||
i18n_provenance: human
|
||||
i18n_output_hash: 57d65f5278fd
|
||||
---
|
||||
|
||||
# Remove Pages {#remove-pages}
|
||||
|
||||
从 PDF 中删除特定页面,同时保持所有剩余页面完好无损。
|
||||
|
||||
## API Endpoint {#api-endpoint}
|
||||
|
||||
`POST /api/v1/tools/pdf/remove-pages`
|
||||
|
||||
接受包含一个 PDF 文件和一个 JSON `settings` 字段的 multipart 表单数据。
|
||||
|
||||
## Parameters {#parameters}
|
||||
|
||||
| Parameter | Type | Required | Default | Description |
|
||||
|-----------|------|----------|---------|-------------|
|
||||
| pages | string | Yes | - | 采用 qpdf 语法要移除的页面范围,例如 `"3,5-7"` |
|
||||
|
||||
## Example Request {#example-request}
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/pdf/remove-pages \
|
||||
-H "Authorization: Bearer si_your-api-key" \
|
||||
-F "file=@document.pdf" \
|
||||
-F 'settings={"pages": "3,5-7"}'
|
||||
```
|
||||
|
||||
## Example Response {#example-response}
|
||||
|
||||
```json
|
||||
{
|
||||
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||||
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/document.pdf",
|
||||
"originalSize": 2450000,
|
||||
"processedSize": 1800000
|
||||
}
|
||||
```
|
||||
|
||||
## Notes {#notes}
|
||||
|
||||
- 你不能移除文档中的每一页;至少必须保留一页。
|
||||
- 页面范围使用 qpdf 语法:`3` 表示单页,`5-7` 表示范围,用逗号组合(例如 `1,3,5-7`)。
|
||||
@@ -0,0 +1,45 @@
|
||||
---
|
||||
description: "尝试修复受损或损坏的 PDF。"
|
||||
i18n_source_hash: 864073a2f09f
|
||||
i18n_provenance: human
|
||||
i18n_output_hash: d4fdbfdb8ca1
|
||||
---
|
||||
|
||||
# Repair PDF {#repair-pdf}
|
||||
|
||||
通过重建 PDF 的内部结构来尝试修复受损或损坏的 PDF。
|
||||
|
||||
## API Endpoint {#api-endpoint}
|
||||
|
||||
`POST /api/v1/tools/pdf/repair-pdf`
|
||||
|
||||
接受包含一个 PDF 文件的 multipart 表单数据。无需 `settings` 字段。
|
||||
|
||||
## Parameters {#parameters}
|
||||
|
||||
此工具没有设置参数。直接上传受损的 PDF 文件即可。
|
||||
|
||||
## Example Request {#example-request}
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/pdf/repair-pdf \
|
||||
-H "Authorization: Bearer si_your-api-key" \
|
||||
-F "file=@damaged.pdf"
|
||||
```
|
||||
|
||||
## Example Response {#example-response}
|
||||
|
||||
```json
|
||||
{
|
||||
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||||
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/damaged.pdf",
|
||||
"originalSize": 2450000,
|
||||
"processedSize": 2400000
|
||||
}
|
||||
```
|
||||
|
||||
## Notes {#notes}
|
||||
|
||||
- 对输入会跳过结构验证,以允许格式错误的文件通过。
|
||||
- 修复是尽力而为的;严重损坏的文件可能无法完全恢复。
|
||||
- 由于重建的交叉引用表,修复后的 PDF 大小可能与原始文件略有不同。
|
||||
@@ -0,0 +1,49 @@
|
||||
---
|
||||
description: "将 PDF 中的页面旋转 90、180 或 270 度。"
|
||||
i18n_source_hash: cc2acd091427
|
||||
i18n_provenance: human
|
||||
i18n_output_hash: 87beaf484a08
|
||||
---
|
||||
|
||||
# Rotate PDF {#rotate-pdf}
|
||||
|
||||
将 PDF 中的所有页面或选定页面旋转指定角度。
|
||||
|
||||
## API Endpoint {#api-endpoint}
|
||||
|
||||
`POST /api/v1/tools/pdf/rotate-pdf`
|
||||
|
||||
接受包含一个 PDF 文件和一个 JSON `settings` 字段的 multipart 表单数据。
|
||||
|
||||
## Parameters {#parameters}
|
||||
|
||||
| Parameter | Type | Required | Default | Description |
|
||||
|-----------|------|----------|---------|-------------|
|
||||
| angle | integer | No | `90` | 旋转角度:`90`、`180` 或 `270` |
|
||||
| range | string | No | `"1-z"` | 采用 qpdf 语法的页面范围,例如 `"1-5,8"`(`"1-z"` = 所有页面) |
|
||||
|
||||
## Example Request {#example-request}
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/pdf/rotate-pdf \
|
||||
-H "Authorization: Bearer si_your-api-key" \
|
||||
-F "file=@document.pdf" \
|
||||
-F 'settings={"angle": 90, "range": "1-3"}'
|
||||
```
|
||||
|
||||
## Example Response {#example-response}
|
||||
|
||||
```json
|
||||
{
|
||||
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||||
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/document.pdf",
|
||||
"originalSize": 2450000,
|
||||
"processedSize": 2450000
|
||||
}
|
||||
```
|
||||
|
||||
## Notes {#notes}
|
||||
|
||||
- 旋转为顺时针方向。
|
||||
- 页面范围使用 qpdf 语法:`1-5` 表示第 1 到第 5 页,`z` 表示最后一页,用逗号组合多个范围。
|
||||
- 默认范围 `"1-z"` 会旋转所有页面。
|
||||
@@ -0,0 +1,79 @@
|
||||
---
|
||||
description: "使用归一化的页面放置坐标将上传的签名图像盖印到 PDF 上。"
|
||||
i18n_source_hash: c28f78c2e7fd
|
||||
i18n_provenance: human
|
||||
i18n_output_hash: d0799de1e901
|
||||
---
|
||||
|
||||
# Sign PDF {#sign-pdf}
|
||||
|
||||
将一个或多个上传的签名 PNG 图像盖印到 PDF 的任意页面上。此路由使用自定义的 multipart 契约,因为它需要 PDF、一个或多个签名图像以及放置坐标。
|
||||
|
||||
## API Endpoint {#api-endpoint}
|
||||
|
||||
`POST /api/v1/tools/pdf/sign-pdf`
|
||||
|
||||
接受 multipart 表单数据。PDF 以 `file` 发送;签名以 `sig0`、`sig1` 等发送;放置坐标以 `placements` JSON 字段发送。
|
||||
|
||||
## Parameters {#parameters}
|
||||
|
||||
| Parameter | Type | Required | Default | Description |
|
||||
|-----------|------|----------|---------|-------------|
|
||||
| file | file | Yes | - | 要签名的 PDF 文件 |
|
||||
| sig0 | file | Yes | - | 第一个签名图像。其他图像使用 `sig1`、`sig2` 等 |
|
||||
| placements | JSON string | Yes | - | 放置对象数组:`{ "sig": 0, "page": 0, "x": 0.2, "y": 0.7, "w": 0.25, "h": 0.08 }` |
|
||||
| clientJobId | string | No | - | 用于通过 SSE 跟踪进度的可选 UUID |
|
||||
| fileId | string | No | - | 可选的文件库 ID,用于将签名后的结果保存为新版本 |
|
||||
|
||||
## Placement Coordinates {#placement-coordinates}
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| sig | integer | 签名图像索引。`0` 映射到 `sig0` |
|
||||
| page | integer | 从零开始的 PDF 页面索引 |
|
||||
| x | number | 以页面比例表示的左侧位置 |
|
||||
| y | number | 以页面比例表示的顶部位置 |
|
||||
| w | number | 以页面比例表示的签名宽度 |
|
||||
| h | number | 以页面比例表示的签名高度 |
|
||||
|
||||
坐标使用左上角为原点。数值可能会略微超出页面边缘;PDF 渲染器会将最终盖印裁剪到页面范围内。
|
||||
|
||||
## Example Request {#example-request}
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/pdf/sign-pdf \
|
||||
-H "Authorization: Bearer si_your-api-key" \
|
||||
-F "file=@contract.pdf" \
|
||||
-F "sig0=@signature.png" \
|
||||
-F 'placements=[{"sig":0,"page":0,"x":0.64,"y":0.82,"w":0.22,"h":0.08}]'
|
||||
```
|
||||
|
||||
## Example Response {#example-response}
|
||||
|
||||
```json
|
||||
{
|
||||
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||||
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/contract_signed.pdf",
|
||||
"previewUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/preview.png",
|
||||
"originalSize": 245000,
|
||||
"processedSize": 249000
|
||||
}
|
||||
```
|
||||
|
||||
如果请求无法在同步等待窗口内完成,API 会返回:
|
||||
|
||||
```json
|
||||
{
|
||||
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||||
"async": true
|
||||
}
|
||||
```
|
||||
|
||||
连接到 `/api/v1/jobs/<jobId>/progress`,并在作业完成时下载结果。
|
||||
|
||||
## Notes {#notes}
|
||||
|
||||
- 接受的 PDF 输入格式:`.pdf`。
|
||||
- 签名图像必须是有效的图像文件,通常是带透明度的 PNG。
|
||||
- 最多接受 100 个签名图像和 100 个放置坐标。
|
||||
- `sign-pdf` 是一个自定义路由,不使用标准工具的 `settings` JSON 字段。
|
||||
@@ -0,0 +1,61 @@
|
||||
---
|
||||
description: "提取页面或将 PDF 拆分为多个部分。"
|
||||
i18n_source_hash: 5c8d8041d219
|
||||
i18n_provenance: human
|
||||
i18n_output_hash: 8ea95715d34d
|
||||
---
|
||||
|
||||
# Split PDF {#split-pdf}
|
||||
|
||||
将某个页面范围提取到一个新的 PDF 中,或将文档拆分为每 N 页一块。
|
||||
|
||||
## API Endpoint {#api-endpoint}
|
||||
|
||||
`POST /api/v1/tools/pdf/split-pdf`
|
||||
|
||||
接受包含一个 PDF 文件和一个 JSON `settings` 字段的 multipart 表单数据。
|
||||
|
||||
## Parameters {#parameters}
|
||||
|
||||
| Parameter | Type | Required | Default | Description |
|
||||
|-----------|------|----------|---------|-------------|
|
||||
| mode | string | No | `"range"` | 拆分模式:`range` 或 `every` |
|
||||
| range | string | 当 mode 为 `range` 时 | - | 采用 qpdf 语法的页面范围,例如 `"1-5,8,10-z"` |
|
||||
| everyN | integer | 当 mode 为 `every` 时 | - | 拆分为每 N 页一块(1-500) |
|
||||
|
||||
## Example Request {#example-request}
|
||||
|
||||
提取特定页面:
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/pdf/split-pdf \
|
||||
-H "Authorization: Bearer si_your-api-key" \
|
||||
-F "file=@document.pdf" \
|
||||
-F 'settings={"mode": "range", "range": "1-5,8"}'
|
||||
```
|
||||
|
||||
拆分为每 10 页一块:
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/pdf/split-pdf \
|
||||
-H "Authorization: Bearer si_your-api-key" \
|
||||
-F "file=@document.pdf" \
|
||||
-F 'settings={"mode": "every", "everyN": 10}'
|
||||
```
|
||||
|
||||
## Example Response {#example-response}
|
||||
|
||||
```json
|
||||
{
|
||||
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||||
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/document.pdf",
|
||||
"originalSize": 2450000,
|
||||
"processedSize": 980000
|
||||
}
|
||||
```
|
||||
|
||||
## Notes {#notes}
|
||||
|
||||
- 在 `range` 模式下,返回一个包含选定页面的单个 PDF。
|
||||
- 在 `every` 模式下,结果是一个包含各个部分的 ZIP 归档。
|
||||
- 页面范围使用 qpdf 语法:`1-5` 表示第 1 到第 5 页,`z` 表示最后一页,用逗号组合多个范围(例如 `1-3,7,10-z`)。
|
||||
@@ -0,0 +1,48 @@
|
||||
---
|
||||
description: "移除 PDF 的密码保护。"
|
||||
i18n_source_hash: 14f5165d185c
|
||||
i18n_provenance: human
|
||||
i18n_output_hash: 9252b9dbc9fd
|
||||
---
|
||||
|
||||
# Unlock PDF {#unlock-pdf}
|
||||
|
||||
通过提供正确的密码来移除加密 PDF 的密码保护。
|
||||
|
||||
## API Endpoint {#api-endpoint}
|
||||
|
||||
`POST /api/v1/tools/pdf/unlock-pdf`
|
||||
|
||||
接受包含一个 PDF 文件和一个 JSON `settings` 字段的 multipart 表单数据。
|
||||
|
||||
## Parameters {#parameters}
|
||||
|
||||
| Parameter | Type | Required | Default | Description |
|
||||
|-----------|------|----------|---------|-------------|
|
||||
| password | string | Yes | - | 用于解密 PDF 的密码(1-256 个字符) |
|
||||
|
||||
## Example Request {#example-request}
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/pdf/unlock-pdf \
|
||||
-H "Authorization: Bearer si_your-api-key" \
|
||||
-F "file=@document.pdf" \
|
||||
-F 'settings={"password": "s3cret"}'
|
||||
```
|
||||
|
||||
## Example Response {#example-response}
|
||||
|
||||
```json
|
||||
{
|
||||
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||||
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/document.pdf",
|
||||
"originalSize": 2500000,
|
||||
"processedSize": 2450000
|
||||
}
|
||||
```
|
||||
|
||||
## Notes {#notes}
|
||||
|
||||
- 必须提供正确的密码;密码错误会返回 400 错误。
|
||||
- 用户密码或所有者密码均可用于解密。
|
||||
- 密码会从审计日志中被隐去。
|
||||
@@ -0,0 +1,58 @@
|
||||
---
|
||||
description: "为 PDF 的每一页添加文本水印。"
|
||||
i18n_source_hash: f1f7d8912fbd
|
||||
i18n_provenance: human
|
||||
i18n_output_hash: 8e4059b14f27
|
||||
---
|
||||
|
||||
# Watermark PDF {#watermark-pdf}
|
||||
|
||||
在 PDF 的每一页上盖印文本水印,位置、大小、不透明度和旋转角度均可配置。
|
||||
|
||||
## API Endpoint {#api-endpoint}
|
||||
|
||||
`POST /api/v1/tools/pdf/watermark-pdf`
|
||||
|
||||
接受包含一个 PDF 文件和一个 JSON `settings` 字段的 multipart 表单数据。
|
||||
|
||||
## Parameters {#parameters}
|
||||
|
||||
| Parameter | Type | Required | Default | Description |
|
||||
|-----------|------|----------|---------|-------------|
|
||||
| text | string | Yes | - | 水印文本(1-200 个字符) |
|
||||
| position | string | No | `"c"` | 页面上的位置:`tl`、`tc`、`tr`、`l`、`c`、`r`、`bl`、`bc`、`br` |
|
||||
| fontSize | integer | No | `48` | 以点为单位的字号(6-72) |
|
||||
| opacity | number | No | `0.3` | 水印不透明度(0.05-1) |
|
||||
| rotation | number | No | `45` | 以度为单位的旋转角度(-180 到 180) |
|
||||
|
||||
### Position Values {#position-values}
|
||||
|
||||
- `tl` 左上,`tc` 顶部居中,`tr` 右上
|
||||
- `l` 中部靠左,`c` 居中,`r` 中部靠右
|
||||
- `bl` 左下,`bc` 底部居中,`br` 右下
|
||||
|
||||
## Example Request {#example-request}
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/pdf/watermark-pdf \
|
||||
-H "Authorization: Bearer si_your-api-key" \
|
||||
-F "file=@document.pdf" \
|
||||
-F 'settings={"text": "CONFIDENTIAL", "position": "c", "opacity": 0.2, "rotation": 45}'
|
||||
```
|
||||
|
||||
## Example Response {#example-response}
|
||||
|
||||
```json
|
||||
{
|
||||
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||||
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/document.pdf",
|
||||
"originalSize": 2450000,
|
||||
"processedSize": 2500000
|
||||
}
|
||||
```
|
||||
|
||||
## Notes {#notes}
|
||||
|
||||
- 水印以文本叠加层的形式渲染在每一页上。
|
||||
- 相同的水印文本、位置和样式会统一应用到所有页面。
|
||||
- 对于不遮挡内容的低调水印,请使用较低的不透明度值(0.1-0.3)。
|
||||
Reference in New Issue
Block a user