Node PDF Report
A library for making Node PDF reporting Easy !
Features
- Pure HTML or ejs Template to PDF, PNG and JPEG Conversion.
- Create File or Get Buffer/Base64 For Further Usage.
- Json to HTML Conversion.
- Typescript Support.
Installation
$ npm install node-pdf-report
ejs Sample Template
<%= name %>
Code Example
const createPDF getPDFBuffer jsonObjectToHTML getImage createImage = ; /** * get PDF as Buffer for further use * options = { * relativePath: <ejs template relative path> * data: <object to be passed in template> * format: <puppteer compatible any pdf format> * html: <direct HTML content> * * } */ const pdfBuffer = await ; console /** * Create PDF from html or ejs * options = { * relativePath: <ejs template relative path> * data: <object to be passed in template> * format: <puppteer compatible any pdf format> * html: <direct HTML content> * outPath: <path of output> * } */ await ; /** * Json to html report */ const html = /** * Get Image from html or ejs (In Base64 or Binary) * options = { * relativePath: <ejs template relative path> * data: <object to be passed in template> * html: <direct HTML content> * type: <jpeg or png> * encoding: <base64 or binary> * } */ const imageBase64 = await ; /** * Create Image from html or ejs (png or jpeg) * options = { * relativePath: <ejs template relative path> * data: <object to be passed in template> * html: <direct HTML content> * outPath: <output image path with image name (png and jpeg extension supported)> * } */
Stay in touch
- Author - Nahid Chowdhury
License
Node PDF Report is MIT licensed.