@ricktechs/nestjs-puppeteer
v1.0.9
Published
nestjs pdf generating package build on top of puppeteer
Downloads
5
Readme
About
Nestjs module for generating pdf from handlebars templates
Usage
To import the Puppeteer module:
import { PuppeteerModule } from "@ricktechs/nestjs-puppeteer";
@Module({
imports: [
PuppeteerModule.forRoot({
path: path.join(process.cwd(), "src/pdf/templates"), //path to handlebars templates
outDir: "temp",
}),
],
providers: [PdfService],
})
export class PdfModule {}
To use the Puppeteer service:
import { PuppeteerService } from "@ricktechs/nestjs-puppeteer";
@Injectable()
export class PdfService {
constructor(private readonly puppeteerService: PuppeteerService) {}
async generate(input: PDFInput) {
return await this.puppeteerService.toPDFStream(input);
}
async generateFromUrl(input: UrlToPDFInput) {
return await this.puppeteerService.urlToPDFStream(input);
}
}
Change Log
See Changelog for more information.
Contributing
Contributions welcome! See Contributing.
Author
Eric Wahome (Y Prospect on Discord)
License
Licensed under the MIT License - see the LICENSE file for details.