Skip to content

PSPDFKit-labs/dws-cli

Repository files navigation

dws-cli

DWS CLI for the Nutrient Document Web Services (Processor API). This tool provides a local workflow for preflight checks, HTML‑to‑PDF conversion, benchmarking, reporting, and design skill packs.

Status: Early but functional. Preflight uses /processor/preflight_html (which discards PDF output), and render profiles are sent via experimental headers (backend support required).

Features

  • dws setup — store API key locally
  • dws preflight — validate HTML inputs (calls preflight API, discards output)
  • dws convert — convert HTML → PDF via API
  • dws benchmark — run real conversion benchmarks against the API
  • dws report — generate a markdown report from results
  • dws skills — manage design skill packs

Install

From npm (recommended)

npm install -g @pspdfkit/dws-cli

Or use without installing:

npx @pspdfkit/dws-cli --help

From source

git clone https://github.com/PSPDFKit-labs/dws-cli.git
cd dws-cli
npm install
npm run build

Usage

dws --help
dws setup --api-key <key>
dws preflight <htmlPath>
dws convert <htmlPath> --output output.pdf --deterministic --profile-name deterministic
dws benchmark --suite W1-W6 --out results.json
dws benchmark --suite W1-W6 --out results.json --artifacts-dir ./bench-artifacts
dws report --in results.json --out report.md
dws skills list
dws skills add /path/to/skill
dws skills add https://example.com/design-skill.json
dws skills validate /path/to/skill

Configuration

  • API key can be supplied via DWS_API_KEY or stored in ~/.dws/config.json using dws setup.
  • Override the API base URL with DWS_API_BASE_URL if needed (defaults to https://api.nutrient.io).
  • Config file is written with 0600 permissions.

Design Skill Packs

A design skill pack is a folder containing a design-skill.json manifest, an entry HTML file, and assets (CSS/fonts/images).

Example manifest:

{
  "name": "invoice-modern",
  "version": "0.1.0",
  "description": "Modern invoice template",
  "entry": "index.html",
  "assets": ["styles.css", "fonts/*"],
  "defaults": {"locale": "en-US", "paper": "A4"}
}

Development

  • Node 18+ recommended
  • npm run build compiles to dist/

Release (manual)

  1. Update README/CHANGELOG and version in package.json
  2. npm run build
  3. git tag vX.Y.Z and git push origin vX.Y.Z

License

MIT — see LICENSE

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published