SKILL.md
readonlyread-only
name
nutrient-document-processing
description
使用 Nutrient DWS API 處理、轉換、OCR、擷取、編輯、簽署和填寫文件。支援 PDF、DOCX、XLSX、PPTX、HTML 和圖片。
Nutrient Document Processing
注意: 此技能整合了 Nutrient 商業 API,使用前請詳閱其條款。
使用 Nutrient DWS Processor API 處理文件。可轉換格式、擷取文字與表格、對掃描文件進行 OCR、編輯 PII、加入浮水印、數位簽署以及填寫 PDF 表單。
設定
前往 nutrient.io 取得免費 API 金鑰
export NUTRIENT_API_KEY="pdf_live_..."
所有請求皆以 multipart POST 方式傳送至 https://api.nutrient.io/build,並包含 instructions JSON 欄位。
操作
轉換文件
# DOCX 轉 PDF
curl -X POST https://api.nutrient.io/build \
-H "Authorization: Bearer $NUTRIENT_API_KEY" \
-F "document.docx=@document.docx" \
-F 'instructions={"parts":[{"file":"document.docx"}]}' \
-o output.pdf
# PDF 轉 DOCX
curl -X POST https://api.nutrient.io/build \
-H "Authorization: Bearer $NUTRIENT_API_KEY" \
-F "document.pdf=@document.pdf" \
-F 'instructions={"parts":[{"file":"document.pdf"}],"output":{"type":"docx"}}' \
-o output.docx
# HTML 轉 PDF
curl -X POST https://api.nutrient.io/build \
-H "Authorization: Bearer $NUTRIENT_API_KEY" \
-F "index.html=@index.html" \
-F 'instructions={"parts":[{"html":"index.html"}]}' \
-o output.pdf
支援的輸入格式:PDF、DOCX、XLSX、PPTX、DOC、XLS、PPT、PPS、PPSX、ODT、RTF、HTML、JPG、PNG、TIFF、HEIC、GIF、WebP、SVG、TGA、EPS。
擷取文字與資料
# 擷取純文字
curl -X POST https://api.nutrient.io/build \
-H "Authorization: Bearer $NUTRIENT_API_KEY" \
-F "document.pdf=@document.pdf" \
-F 'instructions={"parts":[{"file":"document.pdf"}],"output":{"type":"text"}}' \
-o output.txt
# 擷取表格為 Excel
curl -X POST https://api.nutrient.io/build \
-H "Authorization: Bearer $NUTRIENT_API_KEY" \
-F "document.pdf=@document.pdf" \
-F 'instructions={"parts":[{"file":"document.pdf"}],"output":{"type":"xlsx"}}' \
-o tables.xlsx
OCR 掃描文件
# OCR 轉為可搜尋 PDF(支援 100 種以上語言)
curl -X POST https://api.nutrient.io/build \
-H "Authorization: Bearer $NUTRIENT_API_KEY" \
-F "scanned.pdf=@scanned.pdf" \
-F 'instructions={"parts":[{"file":"scanned.pdf"}],"actions":[{"type":"ocr","language":"english"}]}' \
-o searchable.pdf
語言:透過 ISO 639-2 代碼支援 100 種以上語言(例如 eng、deu、fra、spa、jpn、kor、chi_sim、chi_tra、ara、hin、rus)。也可使用完整語言名稱如 english 或 german。完整支援代碼請參閱 OCR 語言對照表。
編輯敏感資訊
# 基於模式(SSN、電子郵件)
curl -X POST https://api.nutrient.io/build \
-H "Authorization: Bearer $NUTRIENT_API_KEY" \
-F "document.pdf=@document.pdf" \
-F 'instructions={"parts":[{"file":"document.pdf"}],"actions":[{"type":"redaction","strategy":"preset","strategyOptions":{"preset":"social-security-number"}},{"type":"redaction","strategy":"preset","strategyOptions":{"preset":"email-address"}}]}' \
-o redacted.pdf
# 基於正規表達式
curl -X POST https://api.nutrient.io/build \
-H "Authorization: Bearer $NUTRIENT_API_KEY" \
-F "document.pdf=@document.pdf" \
-F 'instructions={"parts":[{"file":"document.pdf"}],"actions":[{"type":"redaction","strategy":"regex","strategyOptions":{"regex":"\\b[A-Z]{2}\\d{6}\\b"}}]}' \
-o redacted.pdf
預設模式:social-security-number、email-address、credit-card-number、international-phone-number、north-american-phone-number、date、time、url、ipv4、ipv6、mac-address、us-zip-code、vin。
加入浮水印
curl -X POST https://api.nutrient.io/build \
-H "Authorization: Bearer $NUTRIENT_API_KEY" \
-F "document.pdf=@document.pdf" \
-F 'instructions={"parts":[{"file":"document.pdf"}],"actions":[{"type":"watermark","text":"CONFIDENTIAL","fontSize":72,"opacity":0.3,"rotation":-45}]}' \
-o watermarked.pdf
數位簽章
# 自簽 CMS 簽章
curl -X POST https://api.nutrient.io/build \
-H "Authorization: Bearer $NUTRIENT_API_KEY" \
-F "document.pdf=@document.pdf" \
-F 'instructions={"parts":[{"file":"document.pdf"}],"actions":[{"type":"sign","signatureType":"cms"}]}' \
-o signed.pdf
填寫 PDF 表單
curl -X POST https://api.nutrient.io/build \
-H "Authorization: Bearer $NUTRIENT_API_KEY" \
-F "form.pdf=@form.pdf" \
-F 'instructions={"parts":[{"file":"form.pdf"}],"actions":[{"type":"fillForm","formFields":{"name":"Jane Smith","email":"jane@example.com","date":"2026-02-06"}}]}' \
-o filled.pdf
MCP 伺服器(替代方案)
若需原生工具整合,可使用 MCP 伺服器取代 curl:
{
"mcpServers": {
"nutrient-dws": {
"command": "npx",
"args": ["-y", "@nutrient-sdk/dws-mcp-server"],
"env": {
"NUTRIENT_DWS_API_KEY": "YOUR_API_KEY",
"SANDBOX_PATH": "/path/to/working/directory"
}
}
}
}
使用時機
- 在不同格式間轉換文件(PDF、DOCX、XLSX、PPTX、HTML、圖片)
- 從 PDF 擷取文字、表格或鍵值對
- 對掃描文件或圖片進行 OCR
- 在分享文件前編輯 PII
- 在草稿或機密文件上加入浮水印
- 數位簽署合約或協議
- 以程式方式填寫 PDF 表單






