pdfkit 0.15.1 → 0.15.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 +8 -0
- package/js/pdfkit.es.js +15 -6
- package/js/pdfkit.es.js.map +1 -1
- package/js/pdfkit.js +15 -6
- package/js/pdfkit.js.map +1 -1
- package/js/pdfkit.standalone.js +31691 -31680
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
## pdfkit changelog
|
|
2
2
|
|
|
3
|
+
### [v0.15.2] - 2024-12-15
|
|
4
|
+
|
|
5
|
+
- Fix index not counting when rendering ordered lists (#1517)
|
|
6
|
+
- Fix PDF/A3 compliance of attachments
|
|
7
|
+
- Fix CIDSet generation only for PDF/A1 subset
|
|
8
|
+
- Fix missing acroform font dictionary
|
|
9
|
+
- Fix modify time comparison check equality embedded files
|
|
10
|
+
|
|
3
11
|
### [v0.15.1] - 2024-10-30
|
|
4
12
|
|
|
5
13
|
- Fix browserify transform sRGB_IEC61966_2_1.icc file
|
package/js/pdfkit.es.js
CHANGED
|
@@ -2734,7 +2734,7 @@ class EmbeddedFont extends PDFFont {
|
|
|
2734
2734
|
} else {
|
|
2735
2735
|
descriptor.data.FontFile2 = fontFile;
|
|
2736
2736
|
}
|
|
2737
|
-
if (this.document.subset) {
|
|
2737
|
+
if (this.document.subset && this.document.subset === 1) {
|
|
2738
2738
|
const CIDSet = Buffer.from('FFFFFFFFC0', 'hex');
|
|
2739
2739
|
const CIDSetRef = this.document.ref();
|
|
2740
2740
|
CIDSetRef.write(CIDSet);
|
|
@@ -3375,11 +3375,10 @@ var TextMixin = {
|
|
|
3375
3375
|
return `${text}.`;
|
|
3376
3376
|
}
|
|
3377
3377
|
};
|
|
3378
|
-
const drawListItem = function (listItem) {
|
|
3378
|
+
const drawListItem = function (listItem, i) {
|
|
3379
3379
|
wrapper = new LineWrapper(this, options);
|
|
3380
3380
|
wrapper.on('line', this._line);
|
|
3381
3381
|
level = 1;
|
|
3382
|
-
let i = 0;
|
|
3383
3382
|
wrapper.once('firstLine', () => {
|
|
3384
3383
|
let item, itemType, labelType, bodyType;
|
|
3385
3384
|
if (options.structParent) {
|
|
@@ -3436,7 +3435,7 @@ var TextMixin = {
|
|
|
3436
3435
|
wrapper.wrap(listItem, options);
|
|
3437
3436
|
};
|
|
3438
3437
|
for (let i = 0; i < items.length; i++) {
|
|
3439
|
-
drawListItem.call(this, items[i]);
|
|
3438
|
+
drawListItem.call(this, items[i], i);
|
|
3440
3439
|
}
|
|
3441
3440
|
return this;
|
|
3442
3441
|
},
|
|
@@ -5088,7 +5087,7 @@ var AcroFormMixin = {
|
|
|
5088
5087
|
},
|
|
5089
5088
|
_resolveFont(options) {
|
|
5090
5089
|
// add current font to document-level AcroForm dict if necessary
|
|
5091
|
-
if (this._acroform.fonts[this._font.id]
|
|
5090
|
+
if (this._acroform.fonts[this._font.id] == null) {
|
|
5092
5091
|
this._acroform.fonts[this._font.id] = this._font.ref();
|
|
5093
5092
|
}
|
|
5094
5093
|
|
|
@@ -5160,11 +5159,13 @@ var AttachmentsMixin = {
|
|
|
5160
5159
|
* * options.hidden: if true, do not add attachment to EmbeddedFiles dictionary. Useful for file attachment annotations
|
|
5161
5160
|
* * options.creationDate: override creation date
|
|
5162
5161
|
* * options.modifiedDate: override modified date
|
|
5162
|
+
* * options.relationship: Relationship between the PDF document and its attached file. Can be 'Alternative', 'Data', 'Source', 'Supplement' or 'Unspecified'.
|
|
5163
5163
|
* @returns filespec reference
|
|
5164
5164
|
*/
|
|
5165
5165
|
file(src) {
|
|
5166
5166
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
5167
5167
|
options.name = options.name || src;
|
|
5168
|
+
options.relationship = options.relationship || 'Unspecified';
|
|
5168
5169
|
const refBody = {
|
|
5169
5170
|
Type: 'EmbeddedFile',
|
|
5170
5171
|
Params: {}
|
|
@@ -5235,6 +5236,7 @@ var AttachmentsMixin = {
|
|
|
5235
5236
|
// add filespec for embedded file
|
|
5236
5237
|
const fileSpecBody = {
|
|
5237
5238
|
Type: 'Filespec',
|
|
5239
|
+
AFRelationship: options.relationship,
|
|
5238
5240
|
F: new String(options.name),
|
|
5239
5241
|
EF: {
|
|
5240
5242
|
F: ref
|
|
@@ -5249,13 +5251,20 @@ var AttachmentsMixin = {
|
|
|
5249
5251
|
if (!options.hidden) {
|
|
5250
5252
|
this.addNamedEmbeddedFile(options.name, filespec);
|
|
5251
5253
|
}
|
|
5254
|
+
|
|
5255
|
+
// Add file to the catalogue to be PDF/A3 compliant
|
|
5256
|
+
if (this._root.data.AF) {
|
|
5257
|
+
this._root.data.AF.push(filespec);
|
|
5258
|
+
} else {
|
|
5259
|
+
this._root.data.AF = [filespec];
|
|
5260
|
+
}
|
|
5252
5261
|
return filespec;
|
|
5253
5262
|
}
|
|
5254
5263
|
};
|
|
5255
5264
|
|
|
5256
5265
|
/** check two embedded file metadata objects for equality */
|
|
5257
5266
|
function isEqual(a, b) {
|
|
5258
|
-
return a.Subtype === b.Subtype && a.Params.CheckSum.toString() === b.Params.CheckSum.toString() && a.Params.Size === b.Params.Size && a.Params.CreationDate.getTime() === b.Params.CreationDate.getTime() && a.Params.ModDate.getTime() === b.Params.ModDate.getTime();
|
|
5267
|
+
return a.Subtype === b.Subtype && a.Params.CheckSum.toString() === b.Params.CheckSum.toString() && a.Params.Size === b.Params.Size && a.Params.CreationDate.getTime() === b.Params.CreationDate.getTime() && (a.Params.ModDate === undefined && b.Params.ModDate === undefined || a.Params.ModDate.getTime() === b.Params.ModDate.getTime());
|
|
5259
5268
|
}
|
|
5260
5269
|
|
|
5261
5270
|
var PDFA = {
|