pdfkit 0.20.1 → 0.20.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/CHANGELOG.md +6 -0
- package/js/pdfkit.browser.js +10 -4
- package/js/pdfkit.browser.js.map +1 -1
- package/js/pdfkit.browser.mjs +10 -4
- package/js/pdfkit.browser.mjs.map +1 -1
- package/js/pdfkit.js +10 -4
- package/js/pdfkit.js.map +1 -1
- package/js/pdfkit.node.mjs +10 -4
- package/js/pdfkit.node.mjs.map +1 -1
- package/package.json +2 -5
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
### Unreleased
|
|
4
4
|
|
|
5
|
+
### [v0.20.2] - 2026-08-29
|
|
6
|
+
|
|
7
|
+
- Fix bundlers and file tracers packing the ESM copies of the standard font metrics instead of the CommonJS ones the Node build actually loads, which left `Cannot find module` errors for every standard font at runtime, by resolving the internal `#standard-fonts/*` mapping to a single file under all conditions
|
|
8
|
+
- Fix `doc.file()` throwing when the same in-memory attachment is embedded twice under one name, because the creation and modified dates the deduplication check compares are absent for sources that are not read from disk
|
|
9
|
+
- Fix `doc.text()` throwing `unsupported number: NaN` when `lineBreak: false` is combined with `underline`, `strike`, `link` or `goTo`, because the rendered width was computed from the line wrapper's measurements, which are never produced when wrapping is disabled
|
|
10
|
+
|
|
5
11
|
### [v0.20.1] - 2026-08-23
|
|
6
12
|
|
|
7
13
|
- Add a Node ESM build so `import 'pdfkit'` in Node resolves to the Node build (real file system, native zlib, Node streams, self-registering standard fonts) instead of the browser bundle
|
package/js/pdfkit.browser.js
CHANGED
|
@@ -2222,8 +2222,8 @@ var ColorMixin = {
|
|
|
2222
2222
|
}
|
|
2223
2223
|
const hex = parseInt(color.slice(1), 16);
|
|
2224
2224
|
color = [hex >> 16, hex >> 8 & 0xff, hex & 0xff];
|
|
2225
|
-
} else if (namedColors[color]) {
|
|
2226
|
-
color = namedColors[color];
|
|
2225
|
+
} else if (namedColors[color.toLowerCase()]) {
|
|
2226
|
+
color = namedColors[color.toLowerCase()];
|
|
2227
2227
|
} else if (this.spotColors[color]) {
|
|
2228
2228
|
return this.spotColors[color];
|
|
2229
2229
|
}
|
|
@@ -4604,7 +4604,9 @@ var TextMixin = {
|
|
|
4604
4604
|
}
|
|
4605
4605
|
dy = dy / 1000 * this._fontSize;
|
|
4606
4606
|
}
|
|
4607
|
-
const
|
|
4607
|
+
const measuredWidth = options.textWidth ?? this.widthOfString(text, options) - characterSpacing * (text.length - 1);
|
|
4608
|
+
const measuredWordCount = options.wordCount ?? (text.trim() ? text.trim().split(/\s+/).length : 0);
|
|
4609
|
+
const renderedWidth = measuredWidth + wordSpacing * (measuredWordCount - 1) + characterSpacing * (text.length - 1);
|
|
4608
4610
|
if (options.link != null) {
|
|
4609
4611
|
const linkOptions = {};
|
|
4610
4612
|
if (this._currentStructureElement && this._currentStructureElement.dictionary.data.S === 'Link') {
|
|
@@ -6214,7 +6216,11 @@ var AttachmentsMixin = {
|
|
|
6214
6216
|
}
|
|
6215
6217
|
};
|
|
6216
6218
|
function isEqual(a, b) {
|
|
6217
|
-
return a.Subtype === b.Subtype && a.Params.CheckSum.toString() === b.Params.CheckSum.toString() && a.Params.Size === b.Params.Size && a.Params.CreationDate
|
|
6219
|
+
return a.Subtype === b.Subtype && a.Params.CheckSum.toString() === b.Params.CheckSum.toString() && a.Params.Size === b.Params.Size && isSameDate(a.Params.CreationDate, b.Params.CreationDate) && isSameDate(a.Params.ModDate, b.Params.ModDate);
|
|
6220
|
+
}
|
|
6221
|
+
function isSameDate(a, b) {
|
|
6222
|
+
if (a === undefined || b === undefined) return a === b;
|
|
6223
|
+
return a.getTime() === b.getTime();
|
|
6218
6224
|
}
|
|
6219
6225
|
|
|
6220
6226
|
const ICC_PROFILE_PATH = new URL('./data/sRGB_IEC61966_2_1.icc', (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('pdfkit.browser.js', document.baseURI).href))).href;
|