0.0.1 • Published 1 year ago

nestjs-html-to-pdf v0.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

pipeline status publish status npm

nestjs-html-to-pdf is a NestJS module that provides uses puppeteer to render html as pdf.

Usage

@Module({
  imports: [
    PdfModule
  ],
})

Generating PDF

@Injectable()
export class PdfRenderService {
  constructor(private readonly pdfService: PdfService) {}

  @Get('')
  @ApiResponse({ type: String })
  async sendMail(@Param('template') template: string) {
    const pdf = await this.mailService.renderFromHtml(<your>);
    return new StreamableFile(file, {
      disposition: `test.pdf`,
      type: 'application/pdf',
    });
  }
}