Client constructor
new HookPDF(apiKey, options?)
Create a new SDK client.
| Parameter | Type | Default | Description |
|---|---|---|---|
apiKey | string | - | Your HookPDF API key |
options.baseUrl | string | https://api.hookpdf.com | Base URL for API requests |
options.timeout | number | 30000 | Request timeout in milliseconds |
Methods
client.render(params)
Queue a production PDF render job.
client.renderPreview(params)
Queue a preview render job. The generated PDF is watermarked and short-lived.
client.getReport(jobId)
Get the current status for a render job.
client.waitForReport(jobId, options?)
Poll the API until the job completes or fails.
| Parameter | Type | Default | Description |
|---|---|---|---|
options.interval | number | 2000 | Polling interval in milliseconds |
options.timeout | number | 120000 | Maximum wait time in milliseconds |
Error handling
SDK methods throwHookPDFError for API and transport failures.