@projektemacher/vivliostyle-batch-cli 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -79,6 +79,8 @@ vivliostyle-cli -i index.html -o output.pdf -- --size A4 --viewer-param pixelRat
79
79
  | `--pdfa <level>` | Label the output as PDF/A: `1a`, `1b`, `2a`, `2b`, `2u`, `3a`, `3b`, `3u`, `4`. Embeds the sRGB output intent unless overridden |
80
80
  | `--pdfx <version>` | Label the output as PDF/X: `X-4` or `X-1a:2003` (requires `--icc-profile`) |
81
81
  | `--icc-profile <path>` | ICC profile embedded as the PDF output intent (required for `--pdfx`) |
82
+ | `--no-validate` | Skip the built-in compliance checks run for `--pdfa`/`--pdfx` output |
83
+ | `--verapdf` | Additionally run the verapdf binary (must be on the PATH) against the output and fail the build on full ISO rule-set violations |
82
84
  | `--static <mapping>` | Map virtual path to local path: `/virtual/path:/local/path` (repeatable) |
83
85
  | `--no-scripts` | Do not map `<script src>` tags as static assets |
84
86
  | `--asset-base <urlBase=localBase>` | Map URLs starting with `urlBase` to files under `localBase` (repeatable) |
@@ -100,6 +102,9 @@ vivliostyle-cli -i index.html -o output.pdf -- --size A4 --viewer-param pixelRat
100
102
  ## Notes
101
103
 
102
104
  - **PDF metadata and standards labeling**: every build stamps a producer/creator identity (`vivliostyle-batch-cli`) and a document language. Title, author, subject, keywords and language resolve with this precedence: CLI flags → publication manifest (`.json` input) → the document itself (`<title>`, `<meta name="author">`/`dc.creator`, `<meta name="description">`, `<meta name="keywords">`, `html[lang]`) → language fallback `de`. The values land in both the PDF information dictionary and an XMP metadata stream kept consistent with it, plus the catalog `/Lang` entry. `--pdfa <level>` and `--pdfx <version>` additionally write the standards identification (XMP `pdfaid`/`pdfxid` properties, an OutputIntent with an embedded ICC profile and a file identifier). This is a **label, not a conversion**: the rendered content is neither converted nor checked, so conformance of the content is the author's responsibility — verify with veraPDF when it matters. Chrome's output carries transparency, so `--pdfa 2b` (or newer) is the realistic level; PDF/A-1b will usually fail validation.
105
+
106
+ Validation happens in two layers: every labeled build runs the built-in checks (a practical subset covering the PDF version of the labeled part, the XMP identification, the OutputIntent, the file identifier, embedded fonts and the absence of JavaScript; `--no-validate` skips them), and `--verapdf` additionally runs the [veraPDF](https://verapdf.org/) binary against the output for the full ISO rule set. `--verapdf` requires a veraPDF installation on the PATH (it needs a Java runtime) and makes the build fail if either the binary is missing or the output violates the labeled standard. For CI, the repository ships a reusable setup action (`.github/actions/setup-verapdf`) that installs veraPDF unattended.
107
+
103
108
  - The bundled `src/render/srgb.icc` is the ICC's `sRGB_v4_ICC_preference.icc`, redistributed unchanged under its license ("permission to use, copy and distribute this file for any purpose… provided that the file is not changed"), see <https://www.color.org/srgbprofiles.xalter>. Pass `--icc-profile` to embed a print provider's profile instead.
104
109
  - HTML input (`.html`/`.htm`) is auto-detected by file extension.
105
110
  - For HTML input, `<link href>` and `<script src>` tags are parsed and automatically mapped.
package/dist/index.d.ts CHANGED
@@ -64,6 +64,10 @@ type DocumentMetadata = {
64
64
  subject?: string;
65
65
  keywords?: string;
66
66
  language?: string;
67
+ /** ISO 8601 creation date (information dictionary and XMP CreateDate). */
68
+ created?: string;
69
+ /** ISO 8601 modification date (information dictionary and XMP ModifyDate). */
70
+ modified?: string;
67
71
  };
68
72
 
69
73
  type CliOptions = {
@@ -74,9 +78,14 @@ type CliOptions = {
74
78
  subject?: string;
75
79
  keywords?: string;
76
80
  language?: string;
81
+ created?: string;
82
+ modified?: string;
77
83
  pdfa?: string;
78
84
  pdfx?: string;
79
85
  iccProfile?: string;
86
+ /** Commander's negatable form of --no-validate. */
87
+ validate?: boolean;
88
+ verapdf?: boolean;
80
89
  static: string[];
81
90
  scripts: boolean;
82
91
  format: string;
@@ -104,6 +113,8 @@ type HtmlRewriteOptions = {
104
113
  dumpDir?: string | null;
105
114
  /** Let the browser load references without a local file from the web. */
106
115
  fetchMissing?: boolean;
116
+ /** Origins mapped via --asset-base; page-script fetches route to the server. */
117
+ mappedOrigins?: string[];
107
118
  /** Delay pagination until the page's own async work finished. */
108
119
  settle?: SettleGate | null;
109
120
  /** Origin that page-script requests are routed to. */
@@ -135,6 +146,13 @@ type RuntimeScriptOptions = {
135
146
  origin: string;
136
147
  documentBaseUrl: string;
137
148
  gate: SettleGate | null;
149
+ /**
150
+ * Origins mapped via --asset-base. Page scripts fetch data from these
151
+ * (the blog's sparql/graph components fetch their datasets from the site
152
+ * origin); routing them to the static server keeps builds deterministic
153
+ * instead of silently depending on the live site.
154
+ */
155
+ mappedOrigins?: string[];
138
156
  /**
139
157
  * Open every `<details>` element. Vivliostyle loads the page's scripts itself
140
158
  * and only re-dispatches `DOMContentLoaded` on the window, so scripts that
@@ -349,7 +367,7 @@ declare function resolveIccProfile(options: Pick<CliOptions, "iccProfile">, labe
349
367
  * input (HTML meta tags or a publication manifest); the language falls back
350
368
  * to "de" when no source provides one.
351
369
  */
352
- declare function resolvePdfMetadata(options: Pick<CliOptions, "title" | "author" | "subject" | "keywords" | "language">, inputAbs: string, htmlMode: boolean): DocumentMetadata & {
370
+ declare function resolvePdfMetadata(options: Pick<CliOptions, "title" | "author" | "subject" | "keywords" | "language" | "created" | "modified">, inputAbs: string, htmlMode: boolean): DocumentMetadata & {
353
371
  language: string;
354
372
  };
355
373
  declare function execute(options: CliOptions, extraArgs?: string[]): Promise<void>;