Nestjs Reportes Genera Pdfs Desde Node Full -mega- May 2026

res.set( 'Content-Type': 'application/pdf', 'Content-Disposition': `attachment; filename=invoice-$data.invoiceNumber.pdf`, 'Content-Length': pdfBuffer.length, ); res.send(pdfBuffer);

// Option 1: Download as file @Post('invoice') async generateInvoice(@Body() data: any, @Res() res: Response) const pdfBuffer = await this.pdfService.generateReport('invoice', data); NestJs Reportes Genera PDFs desde Node Full -Mega-

async generateReport(templateName: string, data: any): Promise<Buffer> try // 1. Load HTML template const templatePath = join(process.cwd(), 'templates', $templateName.hbs ); const htmlTemplate = await fs.readFile(templatePath, 'utf-8'); res.set( 'Content-Type': 'application/pdf'

FROM ghcr.io/puppeteer/puppeteer:20.0.0 WORKDIR /app COPY package*.json ./ RUN npm ci COPY . . async generateReport(templateName: string