@pagewrightjs/engine
The Pagewright report engine for Node and browsers: a JSON report definition and data in, pages out, then PDF (also PDF/A-2b), Word, Excel, PowerPoint (exportPptx), HTML or CSV. Includes the pw command line.
npm i @pagewrightjs/engine @pagewrightjs/fonts
import { render, defaultFontStore, exportPdf } from '@pagewrightjs/engine';
import fs from 'node:fs';
const fonts = defaultFontStore();
const model = await render(JSON.parse(fs.readFileSync('statement.pw.json', 'utf8')), { fontStore: fonts, parameters: { accountId: 'LN-1' } });
fs.writeFileSync('statement.pdf', await exportPdf(model, fonts, { title: 'Statement' }));
The pw command line is in @pagewrightjs/cli:
npx -p @pagewrightjs/cli pw render statement.pw.json -p accountId=LN-1 -d loans=data.json -f pdf -o statement.pdf
npx -p @pagewrightjs/cli pw test reports
MIT.