|
| 1 | +--- |
| 2 | +name: nutrient-document-processing |
| 3 | +description: Process, convert, OCR, extract, redact, sign, and fill documents using the Nutrient DWS API. Works with PDFs, DOCX, XLSX, PPTX, HTML, and images. |
| 4 | +--- |
| 5 | + |
| 6 | +# Nutrient Document Processing |
| 7 | + |
| 8 | +Process documents with the [Nutrient DWS Processor API](https://www.nutrient.io/api/). Convert formats, extract text and tables, OCR scanned documents, redact PII, add watermarks, digitally sign, and fill PDF forms. |
| 9 | + |
| 10 | +## Setup |
| 11 | + |
| 12 | +Get a free API key at **https://dashboard.nutrient.io/sign_up/?product=processor** |
| 13 | + |
| 14 | +```bash |
| 15 | +export NUTRIENT_API_KEY="pdf_live_..." |
| 16 | +``` |
| 17 | + |
| 18 | +All requests go to `https://api.nutrient.io/build` as multipart POST with an `instructions` JSON field. |
| 19 | + |
| 20 | +## Operations |
| 21 | + |
| 22 | +### Convert Documents |
| 23 | + |
| 24 | +```bash |
| 25 | +# DOCX to PDF |
| 26 | +curl -X POST https://api.nutrient.io/build \ |
| 27 | + -H "Authorization: Bearer $NUTRIENT_API_KEY" \ |
| 28 | + |
| 29 | + -F 'instructions={"parts":[{"file":"document.docx"}]}' \ |
| 30 | + -o output.pdf |
| 31 | + |
| 32 | +# PDF to DOCX |
| 33 | +curl -X POST https://api.nutrient.io/build \ |
| 34 | + -H "Authorization: Bearer $NUTRIENT_API_KEY" \ |
| 35 | + |
| 36 | + -F 'instructions={"parts":[{"file":"document.pdf"}],"output":{"type":"docx"}}' \ |
| 37 | + -o output.docx |
| 38 | + |
| 39 | +# HTML to PDF |
| 40 | +curl -X POST https://api.nutrient.io/build \ |
| 41 | + -H "Authorization: Bearer $NUTRIENT_API_KEY" \ |
| 42 | + |
| 43 | + -F 'instructions={"parts":[{"html":"index.html"}]}' \ |
| 44 | + -o output.pdf |
| 45 | +``` |
| 46 | + |
| 47 | +Supported inputs: PDF, DOCX, XLSX, PPTX, DOC, XLS, PPT, PPS, PPSX, ODT, RTF, HTML, JPG, PNG, TIFF, HEIC, GIF, WebP, SVG, TGA, EPS. |
| 48 | + |
| 49 | +### Extract Text and Data |
| 50 | + |
| 51 | +```bash |
| 52 | +# Extract plain text |
| 53 | +curl -X POST https://api.nutrient.io/build \ |
| 54 | + -H "Authorization: Bearer $NUTRIENT_API_KEY" \ |
| 55 | + |
| 56 | + -F 'instructions={"parts":[{"file":"document.pdf"}],"output":{"type":"text"}}' \ |
| 57 | + -o output.txt |
| 58 | + |
| 59 | +# Extract tables as Excel |
| 60 | +curl -X POST https://api.nutrient.io/build \ |
| 61 | + -H "Authorization: Bearer $NUTRIENT_API_KEY" \ |
| 62 | + |
| 63 | + -F 'instructions={"parts":[{"file":"document.pdf"}],"output":{"type":"xlsx"}}' \ |
| 64 | + -o tables.xlsx |
| 65 | +``` |
| 66 | + |
| 67 | +### OCR Scanned Documents |
| 68 | + |
| 69 | +```bash |
| 70 | +# OCR to searchable PDF (supports 100+ languages) |
| 71 | +curl -X POST https://api.nutrient.io/build \ |
| 72 | + -H "Authorization: Bearer $NUTRIENT_API_KEY" \ |
| 73 | + |
| 74 | + -F 'instructions={"parts":[{"file":"scanned.pdf"}],"actions":[{"type":"ocr","language":"english"}]}' \ |
| 75 | + -o searchable.pdf |
| 76 | +``` |
| 77 | + |
| 78 | +Languages: Supports 100+ languages via ISO 639-2 codes (e.g., `eng`, `deu`, `fra`, `spa`, `jpn`, `kor`, `chi_sim`, `chi_tra`, `ara`, `hin`, `rus`). Full language names like `english` or `german` also work. See the [complete OCR language table](https://www.nutrient.io/guides/document-engine/ocr/language-support/) for all supported codes. |
| 79 | + |
| 80 | +### Redact Sensitive Information |
| 81 | + |
| 82 | +```bash |
| 83 | +# Pattern-based (SSN, email) |
| 84 | +curl -X POST https://api.nutrient.io/build \ |
| 85 | + -H "Authorization: Bearer $NUTRIENT_API_KEY" \ |
| 86 | + |
| 87 | + -F 'instructions={"parts":[{"file":"document.pdf"}],"actions":[{"type":"redaction","strategy":"preset","strategyOptions":{"preset":"social-security-number"}},{"type":"redaction","strategy":"preset","strategyOptions":{"preset":"email-address"}}]}' \ |
| 88 | + -o redacted.pdf |
| 89 | + |
| 90 | +# Regex-based |
| 91 | +curl -X POST https://api.nutrient.io/build \ |
| 92 | + -H "Authorization: Bearer $NUTRIENT_API_KEY" \ |
| 93 | + |
| 94 | + -F 'instructions={"parts":[{"file":"document.pdf"}],"actions":[{"type":"redaction","strategy":"regex","strategyOptions":{"regex":"\\b[A-Z]{2}\\d{6}\\b"}}]}' \ |
| 95 | + -o redacted.pdf |
| 96 | +``` |
| 97 | + |
| 98 | +Presets: `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`. |
| 99 | + |
| 100 | +### Add Watermarks |
| 101 | + |
| 102 | +```bash |
| 103 | +curl -X POST https://api.nutrient.io/build \ |
| 104 | + -H "Authorization: Bearer $NUTRIENT_API_KEY" \ |
| 105 | + |
| 106 | + -F 'instructions={"parts":[{"file":"document.pdf"}],"actions":[{"type":"watermark","text":"CONFIDENTIAL","fontSize":72,"opacity":0.3,"rotation":-45}]}' \ |
| 107 | + -o watermarked.pdf |
| 108 | +``` |
| 109 | + |
| 110 | +### Digital Signatures |
| 111 | + |
| 112 | +```bash |
| 113 | +# Self-signed CMS signature |
| 114 | +curl -X POST https://api.nutrient.io/build \ |
| 115 | + -H "Authorization: Bearer $NUTRIENT_API_KEY" \ |
| 116 | + |
| 117 | + -F 'instructions={"parts":[{"file":"document.pdf"}],"actions":[{"type":"sign","signatureType":"cms"}]}' \ |
| 118 | + -o signed.pdf |
| 119 | +``` |
| 120 | + |
| 121 | +### Fill PDF Forms |
| 122 | + |
| 123 | +```bash |
| 124 | +curl -X POST https://api.nutrient.io/build \ |
| 125 | + -H "Authorization: Bearer $NUTRIENT_API_KEY" \ |
| 126 | + |
| 127 | + -F 'instructions={"parts":[{"file":"form.pdf"}],"actions":[{"type":"fillForm","formFields":{"name":"Jane Smith","email":"[email protected]","date":"2026-02-06"}}]}' \ |
| 128 | + -o filled.pdf |
| 129 | +``` |
| 130 | + |
| 131 | +## MCP Server (Alternative) |
| 132 | + |
| 133 | +For native tool integration, use the MCP server instead of curl: |
| 134 | + |
| 135 | +```json |
| 136 | +{ |
| 137 | + "mcpServers": { |
| 138 | + "nutrient-dws": { |
| 139 | + "command": "npx", |
| 140 | + "args": ["-y", "@nutrient-sdk/dws-mcp-server"], |
| 141 | + "env": { |
| 142 | + "NUTRIENT_DWS_API_KEY": "YOUR_API_KEY", |
| 143 | + "SANDBOX_PATH": "/path/to/working/directory" |
| 144 | + } |
| 145 | + } |
| 146 | + } |
| 147 | +} |
| 148 | +``` |
| 149 | + |
| 150 | +## When to Use |
| 151 | + |
| 152 | +- Converting documents between formats (PDF, DOCX, XLSX, PPTX, HTML, images) |
| 153 | +- Extracting text, tables, or key-value pairs from PDFs |
| 154 | +- OCR on scanned documents or images |
| 155 | +- Redacting PII before sharing documents |
| 156 | +- Adding watermarks to drafts or confidential documents |
| 157 | +- Digitally signing contracts or agreements |
| 158 | +- Filling PDF forms programmatically |
| 159 | + |
| 160 | +## Links |
| 161 | + |
| 162 | +- [API Playground](https://dashboard.nutrient.io/processor-api/playground/) |
| 163 | +- [Full API Docs](https://www.nutrient.io/guides/dws-processor/) |
| 164 | +- [Agent Skill Repo](https://github.com/PSPDFKit-labs/nutrient-agent-skill) |
| 165 | +- [npm MCP Server](https://www.npmjs.com/package/@nutrient-sdk/dws-mcp-server) |
0 commit comments