Nestjs Reportes Genera Pdfs Desde Node Full -mega- ⇒
FROM ghcr.io/puppeteer/puppeteer:20.0.0 WORKDIR /app COPY package*.json ./ RUN npm ci COPY . .
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'); NestJs Reportes Genera PDFs desde Node Full -Mega-
res.set( 'Content-Type': 'application/pdf', 'Content-Disposition': `attachment; filename=invoice-$data.invoiceNumber.pdf`, 'Content-Length': pdfBuffer.length, ); res.send(pdfBuffer); FROM ghcr
// Option 2: Inline preview @Post('preview') async previewReport(@Body() data: any, @Res() res: Response) const pdfBuffer = await this.pdfService.generateReport('dashboard', data); res.set( 'Content-Type': 'application/pdf' ); res.send(pdfBuffer); // Opens in browser data: any): Promise<
/pic7779581.png)