CLI · Level 2
Outputs
Generate specific deliverables outside the standard HTML bundle: page-by-page PNG images, PDFs, and deployment artifacts.
This document describes OpenPress Level 2 CLI commands, which are responsible for generating output formats (PDF, PNG images) and deployment artifacts outside of the HTML bundle. These commands wrap dependencies (Chromium, adapter SDKs) to execute specific tasks, independent of the base build command.
Generates PDF output locally via Chromium.
npm run openpress:pdf Flags
| Name | Type | Default | Description |
|---|---|---|---|
--output | string | Overrides output path. Defaults to the path defined by `config.pdf.filename`. | |
--no-build | flag | Bypasses the build phase, reusing existing `dist-react/` output. | |
--host | string | "127.0.0.1" | Specifies static server host IP for Chromium to connect to during printing. |
--port | string | "5185" | Specifies static server port. |
--dry-run | flag | Only outputs the command sequence to be executed, without starting the server or invoking Chromium. |
Example: Export PDF
npm run openpress:pdf Generates page-by-page PNG image output via Chromium.
npm run openpress:image Flags
| Name | Type | Default | Description |
|---|---|---|---|
--output | string | Overrides output directory path. Defaults to `dist-react/images`. | |
--no-build | flag | Bypasses the build phase, reusing existing `dist-react/` output. | |
--host | string | "127.0.0.1" | Specifies static server host IP for Chromium to connect to during capture. |
--port | string | "5186" | Specifies static server port. |
--dry-run | flag | Only outputs the command sequence to be executed, without starting the server or invoking Chromium. |
Example: Export Images
npm run openpress:image Executes the deployment flow according to the specified adapter.
npm run openpress:deploy This command sequentially executes the build, generates PDF artifacts, writes deployment metadata to deploy.json, and invokes the configured deployment adapter.
Flags
| Name | Type | Default | Description |
|---|---|---|---|
--confirm | flag | Required parameter for actual deployment publishing. Bypasses interactive prompts, suitable for CI environments. | |
--dry-run | flag | Executes pre-flight checks and prints command sequence. Does not perform actual publishing and upload. |
Example: Deployment Operation
# Preview deployment flow (Dry run)
npm run openpress:deploy:dry-run
# Execute actual deployment (with confirm flag)
npm run openpress:deploy -- --confirm Deployment Adapters
The active adapter is determined by the "openpress.deploy.adapter" property in package.json.
Invokes npx wrangler pages deploy. Required property: projectName. Optional property: commitDirty.
// package.json
"openpress": {
"deploy": { "adapter": "cloudflare-pages", "projectName": "...", "source": ".deploy" }
} The Wrangler environment must be pre-authenticated on the machine executing the deployment command. For host environments without a dedicated adapter, please use the standard static build output directly.