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, HTML and CSV. Node and browsers. Includes the pw CLI.

npmnpm
Version
0.7.0
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, HTML or CSV. Includes the pw command line.

import { render, FontStore, fontFile, exportPdf, createSubsetter } from '@pagewrightjs/engine';
import fs from 'node:fs';
const pub = new URL('./node_modules/@pagewrightjs/engine/public/', import.meta.url);
// fontFile(key) names the file behind a key: a .ttf face, or harfbuzz.wasm for the text shaper (Arabic, Hebrew, Indic, Thai…)
const fonts = new FontStore((key) => fs.readFileSync(new URL(`fonts/${fontFile(key)}`, pub)));
// embed only the glyphs a PDF uses (without it, every font embeds in full: a few hundred KB each)
const subset = createSubsetter(() => fs.promises.readFile(new URL('harfbuzz-subset.wasm', pub)));
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', subset }));
// 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)
npx pw render statement.pw.json -p accountId=LN-1 -d loans=data.json -f pdf -o statement.pdf
npx pw test reports        # snapshot tests for reports-as-code

MIT. The fonts in public/fonts are under the SIL Open Font License.

FAQs

Package last updated on 05 Oct 2026

Related posts