BladePDF for Node.js
The official @bladepdf/node package brings BladePDF's render client, fluent options, secure local asset pipeline, background submissions, and webhook verification to server-side Node.js.
Use the SDK only in trusted backend code. It uses Node filesystem and stream APIs and must not be bundled into a browser, exposed through client components, or shipped with an API key.
Install
1npm install @bladepdf/nodeNode.js 22 or newer is required. The package ships ESM, CommonJS, and TypeScript declarations and has no runtime dependencies.
1import { BladePdf } from '@bladepdf/node'; 1const { BladePdf } = require('@bladepdf/node');What is in the SDK
| Component | Responsibility |
|---|---|
BladePdf and PendingRender | HTML and cloud-template sources, PDF options, readiness, metadata, storage, webhooks, and delivery. |
BladePdfClient | Native multipart transport, timeouts, retry policy, stored-PDF links, request IDs, and structured failures. |
AssetResolver | Permission-scoped HTML and CSS discovery for local CSS, fonts, images, JavaScript, and SVG. |
| Result types | Buffer, Node Readable, atomic file delivery, stored URL, and request ID. |
verifyWebhookSignature() | Framework-independent HMAC and timestamp verification over exact raw body bytes. |
Bring your own template engine
Handlebars, EJS, Pug, React server rendering, Nunjucks, and other engines remain application concerns. Render a template to a final HTML string, then call fromHtml(). The SDK does not add a template-engine dependency.
Node-native delivery
| Method | Use it for |
|---|---|
render() | Return a RenderResult containing the complete PDF as a Buffer. |
renderStream() | Return a one-shot Node Readable for HTTP responses or custom pipelines. |
renderToFile() | Stream through a temporary sibling and safely commit a complete local file. |
submit() | Accept a stored background render and return its request ID without waiting for PDF generation. |
Next step
Continue with the Node.js SDK quickstart, then configure only the asset roots your documents require.