NestJS
Nebula ships optional NestJS integration via peer dependencies (@nestjs/common, @nestjs/core, reflect-metadata).
Register the module
Section titled “Register the module”import { Module } from '@nestjs/common';import { NebulaPdfModule } from 'nebula-pdf-engine';
@Module({ imports: [ NebulaPdfModule.forRoot({ fonts: [{ name: 'Inter', data: fontBuffer, weight: 400 }], }), ],})export class AppModule {}Inject and generate
Section titled “Inject and generate”import { Injectable } from '@nestjs/common';import { NebulaPdfService, Page, Text } from 'nebula-pdf-engine';
@Injectable()export class ReportService { constructor(private readonly pdfService: NebulaPdfService) {}
async generateReport(data: { name: string }) { return await this.pdfService.generate( <Page padding={40}> <Text>Report for {data.name}</Text> </Page>, ); }}Return the Buffer from a controller with Content-Type: application/pdf, or write it to disk.