@nowline/export-pdf 0.8.5 → 0.9.0
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/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -1
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
- package/src/index.ts +23 -2
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export interface PdfOptions {
|
|
|
10
10
|
author?: string;
|
|
11
11
|
/** Title baked into the PDF Info dict. Defaults to roadmap title. */
|
|
12
12
|
title?: string;
|
|
13
|
-
/** Subject. Defaults to the source filename. */
|
|
13
|
+
/** Subject. Defaults to the source filename (basename, no directory). */
|
|
14
14
|
subject?: string;
|
|
15
15
|
/** Producer string. Defaults to `nowline (m2c)`. */
|
|
16
16
|
producer?: string;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EACR,YAAY,EACZ,cAAc,EACd,WAAW,EACX,gBAAgB,EACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAGH,KAAK,YAAY,EAIpB,MAAM,sBAAsB,CAAC;AAG9B,MAAM,WAAW,UAAU;IACvB,QAAQ,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAChC,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,sDAAsD;IACtD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AASD,wBAAsB,SAAS,CAC3B,MAAM,EAAE,YAAY,EACpB,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,UAAe,GACzB,OAAO,CAAC,UAAU,CAAC,CAsErB;AA8CD,YAAY,EAAE,YAAY,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -21,8 +21,17 @@
|
|
|
21
21
|
// (since 0.13), so a fixed CreationDate yields a stable ID.
|
|
22
22
|
// - `pdfVersion: '1.7'` pins the PDF spec.
|
|
23
23
|
// - Producer / Creator strings are explicit, version-stable.
|
|
24
|
+
// - `info.Subject` defaults to the source *basename*, never the absolute
|
|
25
|
+
// `inputs.sourcePath`. The `/ID` hashes the Info dict and every xref
|
|
26
|
+
// offset shifts with its length, so an absolute path would make the bytes
|
|
27
|
+
// depend on where the source lives (and leak the author's filesystem
|
|
28
|
+
// layout into a file they share).
|
|
24
29
|
// - Fonts: registered explicitly via PDFKit `registerFont(name, bytes,
|
|
25
30
|
// family?)` so glyph subsets are byte-identical across hosts.
|
|
31
|
+
// - PDFKit's default Helvetica is never loaded (`font: null` below). PDFKit
|
|
32
|
+
// 0.20 resolves its standard-font metrics through `createRequire` at
|
|
33
|
+
// runtime, which `bun build --compile` cannot embed in the standalone
|
|
34
|
+
// binary; every glyph comes from the registered pair anyway.
|
|
26
35
|
import { PassThrough } from 'node:stream';
|
|
27
36
|
import SVGtoPDF from '@kittl/svg-to-pdfkit';
|
|
28
37
|
import { fitContent, parsePageSize, resolveFonts, resolvePage, validateMargin, } from '@nowline/export-core';
|
|
@@ -47,12 +56,15 @@ export async function exportPdf(inputs, svg, options = {}) {
|
|
|
47
56
|
const creationDate = new Date(Date.UTC(today.getUTCFullYear(), today.getUTCMonth(), today.getUTCDate(), 0, 0, 0, 0));
|
|
48
57
|
const doc = new PDFDocument({
|
|
49
58
|
autoFirstPage: false,
|
|
59
|
+
// Skip the default Helvetica load; see the determinism contract above.
|
|
60
|
+
// @types/pdfkit types `font` as string only, hence the cast.
|
|
61
|
+
font: null,
|
|
50
62
|
compress: options.compress ?? true,
|
|
51
63
|
pdfVersion: '1.7',
|
|
52
64
|
info: {
|
|
53
65
|
Title: options.title ?? (inputs.model.header.title || 'Nowline Roadmap'),
|
|
54
66
|
Author: options.author ?? inputs.model.header.author ?? '',
|
|
55
|
-
Subject: options.subject ?? inputs.sourcePath,
|
|
67
|
+
Subject: options.subject ?? sourceBasename(inputs.sourcePath),
|
|
56
68
|
Producer: options.producer ?? 'nowline (m2c)',
|
|
57
69
|
Creator: options.producer ?? 'nowline (m2c)',
|
|
58
70
|
CreationDate: creationDate,
|
|
@@ -113,6 +125,14 @@ async function resolveFontsFor() {
|
|
|
113
125
|
const result = await resolveFonts();
|
|
114
126
|
return { sans: result.sans, mono: result.mono };
|
|
115
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* Final segment of `sourcePath`. Splits on both `/` and `\` rather than using
|
|
130
|
+
* `node:path`, so a Windows path reduces to the same basename on any host.
|
|
131
|
+
*/
|
|
132
|
+
function sourceBasename(sourcePath) {
|
|
133
|
+
const sep = Math.max(sourcePath.lastIndexOf('/'), sourcePath.lastIndexOf('\\'));
|
|
134
|
+
return sourcePath.slice(sep + 1);
|
|
135
|
+
}
|
|
116
136
|
function bufferOf(bytes) {
|
|
117
137
|
return Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
118
138
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,EAAE;AACF,iEAAiE;AACjE,EAAE;AACF,2EAA2E;AAC3E,2EAA2E;AAC3E,4EAA4E;AAC5E,8DAA8D;AAC9D,EAAE;AACF,4EAA4E;AAC5E,sEAAsE;AACtE,iBAA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AE,CAAC,CAAC;IACnE,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,MAAM,CAAC;IAClD,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC;IACxC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,MAAM,eAAe,EAAE,CAAC,CAAC;IACzD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AACtD,CAAC;AAED,KAAK,UAAU,eAAe;IAC1B,MAAM,MAAM,GAAG,MAAM,YAAY,EAAE,CAAC;IACpC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;AACpD,CAAC;AAED;;;GAGG;AACH,SAAS,cAAc,CAAC,UAAkB;IACtC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;IAChF,OAAO,UAAU,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;AACrC,CAAC;AAED,SAAS,QAAQ,CAAC,KAAiB;IAC/B,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;AACzE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nowline/export-pdf",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Exports a Nowline roadmap as a crisp, vector PDF.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"engines": {
|
|
@@ -22,18 +22,18 @@
|
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@kittl/svg-to-pdfkit": "^0.1.12",
|
|
25
|
-
"
|
|
26
|
-
"
|
|
25
|
+
"@nowline/export-core": "0.9.0",
|
|
26
|
+
"pdfkit": "^0.20.2"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@
|
|
29
|
+
"@nowline/core": "0.9.0",
|
|
30
|
+
"@nowline/layout": "0.9.0",
|
|
31
|
+
"@nowline/renderer": "0.9.0",
|
|
32
|
+
"@types/node": "^26.6.5",
|
|
30
33
|
"@types/pdfkit": "^0.17.6",
|
|
31
|
-
"langium": "~4.
|
|
32
|
-
"typescript": "^
|
|
33
|
-
"vitest": "^
|
|
34
|
-
"@nowline/core": "0.8.5",
|
|
35
|
-
"@nowline/layout": "0.8.5",
|
|
36
|
-
"@nowline/renderer": "0.8.5"
|
|
34
|
+
"langium": "~4.4.0",
|
|
35
|
+
"typescript": "^7.0.2",
|
|
36
|
+
"vitest": "^5.0.5"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "tsc -b tsconfig.json",
|
package/src/index.ts
CHANGED
|
@@ -21,8 +21,17 @@
|
|
|
21
21
|
// (since 0.13), so a fixed CreationDate yields a stable ID.
|
|
22
22
|
// - `pdfVersion: '1.7'` pins the PDF spec.
|
|
23
23
|
// - Producer / Creator strings are explicit, version-stable.
|
|
24
|
+
// - `info.Subject` defaults to the source *basename*, never the absolute
|
|
25
|
+
// `inputs.sourcePath`. The `/ID` hashes the Info dict and every xref
|
|
26
|
+
// offset shifts with its length, so an absolute path would make the bytes
|
|
27
|
+
// depend on where the source lives (and leak the author's filesystem
|
|
28
|
+
// layout into a file they share).
|
|
24
29
|
// - Fonts: registered explicitly via PDFKit `registerFont(name, bytes,
|
|
25
30
|
// family?)` so glyph subsets are byte-identical across hosts.
|
|
31
|
+
// - PDFKit's default Helvetica is never loaded (`font: null` below). PDFKit
|
|
32
|
+
// 0.20 resolves its standard-font metrics through `createRequire` at
|
|
33
|
+
// runtime, which `bun build --compile` cannot embed in the standalone
|
|
34
|
+
// binary; every glyph comes from the registered pair anyway.
|
|
26
35
|
|
|
27
36
|
import { PassThrough } from 'node:stream';
|
|
28
37
|
import SVGtoPDF from '@kittl/svg-to-pdfkit';
|
|
@@ -52,7 +61,7 @@ export interface PdfOptions {
|
|
|
52
61
|
author?: string;
|
|
53
62
|
/** Title baked into the PDF Info dict. Defaults to roadmap title. */
|
|
54
63
|
title?: string;
|
|
55
|
-
/** Subject. Defaults to the source filename. */
|
|
64
|
+
/** Subject. Defaults to the source filename (basename, no directory). */
|
|
56
65
|
subject?: string;
|
|
57
66
|
/** Producer string. Defaults to `nowline (m2c)`. */
|
|
58
67
|
producer?: string;
|
|
@@ -101,12 +110,15 @@ export async function exportPdf(
|
|
|
101
110
|
|
|
102
111
|
const doc = new PDFDocument({
|
|
103
112
|
autoFirstPage: false,
|
|
113
|
+
// Skip the default Helvetica load; see the determinism contract above.
|
|
114
|
+
// @types/pdfkit types `font` as string only, hence the cast.
|
|
115
|
+
font: null as unknown as string,
|
|
104
116
|
compress: options.compress ?? true,
|
|
105
117
|
pdfVersion: '1.7',
|
|
106
118
|
info: {
|
|
107
119
|
Title: options.title ?? (inputs.model.header.title || 'Nowline Roadmap'),
|
|
108
120
|
Author: options.author ?? inputs.model.header.author ?? '',
|
|
109
|
-
Subject: options.subject ?? inputs.sourcePath,
|
|
121
|
+
Subject: options.subject ?? sourceBasename(inputs.sourcePath),
|
|
110
122
|
Producer: options.producer ?? 'nowline (m2c)',
|
|
111
123
|
Creator: options.producer ?? 'nowline (m2c)',
|
|
112
124
|
CreationDate: creationDate,
|
|
@@ -175,6 +187,15 @@ async function resolveFontsFor(): Promise<ResolvedFontPair> {
|
|
|
175
187
|
return { sans: result.sans, mono: result.mono };
|
|
176
188
|
}
|
|
177
189
|
|
|
190
|
+
/**
|
|
191
|
+
* Final segment of `sourcePath`. Splits on both `/` and `\` rather than using
|
|
192
|
+
* `node:path`, so a Windows path reduces to the same basename on any host.
|
|
193
|
+
*/
|
|
194
|
+
function sourceBasename(sourcePath: string): string {
|
|
195
|
+
const sep = Math.max(sourcePath.lastIndexOf('/'), sourcePath.lastIndexOf('\\'));
|
|
196
|
+
return sourcePath.slice(sep + 1);
|
|
197
|
+
}
|
|
198
|
+
|
|
178
199
|
function bufferOf(bytes: Uint8Array): Buffer {
|
|
179
200
|
return Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
180
201
|
}
|