# 转换与翻译参数

[HTML](https://pdfcraft.ai/zh-CN/docs/api/conversion/) · [Site index](https://pdfcraft.ai/llms.txt)

支持的文件格式、翻译模式和脚注选项。


创建任务时设置 `input_format`；调用 `POST /transforms/{uuid}/launch` 时设置本页参数。启动请求被接受后，参数不能修改。

## 支持的格式组合

| 输入 | 输出 | 翻译 | 排版模式 |
| --- | --- | --- | --- |
| PDF | Markdown ZIP 或 EPUB | 可选 | 不翻译使用 `source`；翻译可用 `replace`、`bilingual`、`bilingual-inline` |
| PDF | PDF | 必须 | 仅 `replace` |
| EPUB | EPUB | 必须 | `replace`、`bilingual`、`bilingual-inline` |

此 API 不支持 EPUB 转 PDF/Markdown，也不支持不翻译的 PDF 转 PDF。

## 保留原文语言

PDF 转 EPUB 时，省略 `target_language`：

```json
{"output_format":"epub"}
```

输出 Markdown ZIP 则使用 `"output_format":"markdown"`。不翻译时，`rendering_mode` 默认是 `source`，不能提供翻译提示或双语模式。

## 翻译文档

将 PDF 或 EPUB 翻译为英文 EPUB：

```json
{
  "output_format": "epub",
  "target_language": "en",
  "rendering_mode": "bilingual",
  "translation_prompt": "Keep product names unchanged."
}
```

`replace` 仅输出译文，是翻译时的默认值。`bilingual` 按文本块追加译文；`bilingual-inline` 在同一文本流内追加译文。这两种模式均不生成左右双栏 PDF。

输出翻译后的 PDF：

```json
{"output_format":"pdf","target_language":"en","rendering_mode":"replace"}
```

可通过 `translation_prompt` 指定术语或人名的译法。该字段可省略；填写时不能全为空白，服务会去除首尾空白。它不支持指定模型。

请求中包含未知字段，或参数不适用于当前转换时，返回 `400 INVALID_REQUEST`。

## PDF 脚注

| `footnotes` | 行为 |
| --- | --- |
| `disabled` | 禁用脚注提取，默认值 |
| `basic` | 基础脚注提取 |
| `refined` | 精细脚注处理 |

```json
{"output_format":"epub","footnotes":"refined"}
```

EPUB 输入不能传入 `footnotes`，包括 `"footnotes":"disabled"`。该选项只控制 PDF 脚注，API 暂不提供页眉、页脚的独立开关。

## 翻译目标语言

`target_language` 仅接受以下区分大小写的代码：

| 代码 | 语言 | 代码 | 语言 |
| --- | --- | --- | --- |
| `zh-CN` | 中文 | `en` | 英语 |
| `de` | 德语 | `es` | 西班牙语 |
| `fr` | 法语 | `it` | 意大利语 |
| `ja` | 日语 | `ko` | 韩语 |
| `pt` | 葡萄牙语 | `ru` | 俄语 |
| `ar` | 阿拉伯语 | `hi` | 印地语 |
| `nl` | 荷兰语 | `pl` | 波兰语 |
| `tr` | 土耳其语 | `vi` | 越南语 |
| `th` | 泰语 | `id` | 印度尼西亚语 |
| `sv` | 瑞典语 | `da` | 丹麦语 |
| `no` | 挪威语 | `fi` | 芬兰语 |

网站界面的语言标签不一定等于 API 语言代码。`zh`、`zh-Hant`、`it-IT`、`pt-BR`、语言全名以及带首尾空白的值都会被拒绝。

HTTP 字段与响应码见[接口参考](https://pdfcraft.ai/zh-CN/docs/api/overview/)，中断和失败后的处理见[任务生命周期](https://pdfcraft.ai/zh-CN/docs/api/lifecycle/)。
