Buffers & Responses
PdfEngine.generate() (and NebulaPdfService.generate()) returns a Promise<Buffer> containing the full PDF. There is no streaming / chunked PDF API yet.
Write to disk
Section titled “Write to disk”import fs from 'fs';
const pdf = await engine.generate(<Page>…</Page>);fs.writeFileSync('output.pdf', pdf);HTTP — Express
Section titled “HTTP — Express”res.setHeader('Content-Type', 'application/pdf');res.setHeader('Content-Disposition', 'inline; filename="doc.pdf"');res.send(pdf);HTTP — Fetch / Next.js Response
Section titled “HTTP — Fetch / Next.js Response”return new Response(pdf, { headers: { 'Content-Type': 'application/pdf', 'Content-Disposition': 'attachment; filename="doc.pdf"', },});NestJS
Section titled “NestJS”Return the buffer from a controller and set @Header('Content-Type', 'application/pdf'), or use @Res() to write manually.
Memory notes
Section titled “Memory notes”Each page is rasterized to PNG before assembly. Large tables + high devicePixelRatio increase peak memory. Prefer lowering DPI or splitting huge documents across multiple generate calls if you hit serverless limits.