Files
SnapOtter/apps/docs/zh-TW/tools/pdf/protect-pdf.md
T
SnapOtterandGitHub 4963ab3bbd 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.
2026-07-11 13:52:47 +08:00

51 lines
1.5 KiB
Markdown

---
description: "為 PDF 加上使用 AES-256 加密的密碼保護。"
i18n_source_hash: 869cfbc739ef
i18n_provenance: human
i18n_output_hash: 50e623f2bb96
---
# 保護 PDF {#protect-pdf}
使用 AES-256 加密為 PDF 加上密碼保護。
## API 端點 {#api-endpoint}
`POST /api/v1/tools/pdf/protect-pdf`
接受包含 PDF 檔案與 JSON `settings` 欄位的 multipart 表單資料。
## 參數 {#parameters}
| 參數 | 類型 | 必填 | 預設值 | 說明 |
|-----------|------|----------|---------|-------------|
| userPassword | string | 是 | - | 開啟 PDF 所需的密碼(1-256 個字元) |
| ownerPassword | string | 否 | 與 `userPassword` 相同 | 用於權限的擁有者密碼(1-256 個字元) |
## 範例請求 {#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}
```json
{
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/document.pdf",
"originalSize": 2450000,
"processedSize": 2500000
}
```
## 注意事項 {#notes}
- 加密使用 AES-256。
- 若省略 `ownerPassword`,則預設為與 `userPassword` 相同的值。
- 密碼會從稽核日誌中遮蔽。
- 加密後的 PDF 需要使用者密碼才能開啟,並需要擁有者密碼(若不同)才能取得完整權限。