You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove client-side PDF parsing and add URL support to methods
- Remove getPdfPageCount, isValidPdf, and processRemoteFileInput functions
- Remove allowUrlFetch client option (SSRF protection by design)
- Most methods now accept FileInputWithUrl - URLs passed to server
- Leverage API's native negative index support (-1 = last page)
- sign() remains the only method requiring local files (API limitation)
- Reduces bundle size by ~400 lines of PDF parsing code
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: README.md
+20-9Lines changed: 20 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,21 +67,32 @@ const client = new NutrientClient({
67
67
});
68
68
```
69
69
70
-
### URL Fetching (SSRF Protection)
70
+
### Working with URLs
71
71
72
-
By default, the SDK blocks automatic fetching of content from URLs to protect against Server-Side Request Forgery (SSRF) attacks. To enable URL fetching for trusted sources:
72
+
Most methods accept URLs directly. The URL is passed to the server, which fetches the content—this avoids SSRF vulnerabilities since the client never fetches URLs itself.
73
73
74
74
```typescript
75
-
const client =newNutrientClient({
76
-
apiKey: 'nutr_sk_your_secret_key',
77
-
allowUrlFetch: true// Enable URL fetching (use with caution)
78
-
});
75
+
// Pass URL as a string
76
+
const result =awaitclient.convert('https://example.com/document.pdf', 'docx');
79
77
80
-
// Now you can pass URLs directly
81
-
const result =awaitclient.convert('https://trusted-source.com/document.pdf', 'pdf');
78
+
// Or as an object (useful for TypeScript type narrowing)
79
+
const result =awaitclient.convert({ type: 'url', url: 'https://example.com/document.pdf' }, 'docx');
80
+
81
+
// URLs also work with the workflow builder
82
+
const result =awaitclient.workflow()
83
+
.addFilePart('https://example.com/document.pdf')
84
+
.outputPdf()
85
+
.execute();
82
86
```
83
87
84
-
**⚠️ Security Warning:** Only enable `allowUrlFetch` if you control the URLs being processed. Never enable it when processing untrusted user input.
88
+
**Exception:** The `sign()` method only accepts local files (file paths, Buffers, streams) because the underlying API endpoint doesn't support URL inputs. For signing remote files, fetch the content first:
0 commit comments