New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@pagewrightjs/engine

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@pagewrightjs/engine

Pagewright report engine: JSON report definitions to pages, PDF (incl. PDF/A), Word, Excel, PowerPoint, HTML and CSV. Node and browsers. Fonts: @pagewrightjs/fonts; CLI: @pagewrightjs/cli.

latest
npmnpm
Version
0.7.3
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

@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';
// the fonts, the text shaper (Arabic, Hebrew, Indic, Thai…) and the PDF subsetter come from @pagewrightjs/fonts;
// for your own fonts: new FontStore((key) => bytesOf(fontFile(key)))
const fonts = defaultFontStore();
const model = await render(JSON.parse(fs.readFileSync('statement.pw.json', 'utf8')), { fontStore: fonts, parameters: { accountId: 'LN-1' } });
// fonts are subset by default (only the glyphs the PDF uses); { subset: false } embeds every font in full
fs.writeFileSync('statement.pdf', await exportPdf(model, fonts, { title: 'Statement' }));
// Excel, CSV, Word, interactive HTML and the accessible PDF rebuild tables from the table data, which render() keeps
// only when asked: render(def, { exportData: true }) (needsExportData(format) says which formats need it)

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        # snapshot tests for reports-as-code

MIT.

FAQs

Package last updated on 05 Oct 2026

Related posts