pdf-lite 1.7.4-alpha.0 → 1.7.4-alpha.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.
@@ -46,7 +46,7 @@ export class PdfDefaultAppearance extends PdfString {
46
46
  return `/${this._fontName} ${this._fontSize} Tf ${this._colorOp}`;
47
47
  }
48
48
  static parse(da) {
49
- const fontMatch = da.match(/\/([\w-]+)\s+([\d.]+)\s+Tf/);
49
+ const fontMatch = da.match(/\/([\S]+)\s+([\d.]+)\s+Tf/);
50
50
  if (!fontMatch)
51
51
  return null;
52
52
  const fontName = fontMatch[1];
@@ -42,7 +42,15 @@ export class PdfFont extends PdfIndirectObject {
42
42
  throw new Error('PdfIndirectObject content must be a PdfDictionary');
43
43
  }
44
44
  this.content = fontObj.content;
45
- this.resourceName = fontObj.reference.key;
45
+ // Preserve resourceName from PdfFont sources; fall back to
46
+ // reference key for raw indirect objects already in a document,
47
+ // and finally generate a fresh name for unassigned objects.
48
+ this.resourceName =
49
+ fontObj instanceof PdfFont
50
+ ? fontObj.resourceName
51
+ : fontObj.objectNumber >= 0
52
+ ? fontObj.reference.key
53
+ : PdfFont.nextResourceName();
46
54
  return;
47
55
  }
48
56
  // Handle string parameter (simple fontName)
@@ -1072,7 +1072,7 @@ export class PdfDocument extends PdfObject {
1072
1072
  * (e.g. appearance streams created by generateAppearance).
1073
1073
  */
1074
1074
  registerNewReferences() {
1075
- const missing = this.collectMissingReferences(...this.latestRevision.objects);
1075
+ const missing = this.collectMissingReferences(...this.objects);
1076
1076
  if (missing.length > 0) {
1077
1077
  this.add(...missing);
1078
1078
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pdf-lite",
3
- "version": "1.7.4-alpha.0",
3
+ "version": "1.7.4-alpha.2",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "exports": {
@@ -35,7 +35,7 @@
35
35
  "@vitest/browser-playwright": "^4.0.14",
36
36
  "@vitest/coverage-v8": "^4.0.14",
37
37
  "playwright": "^1.56.1",
38
- "typescript": "6.0.2",
38
+ "typescript": "6.0.3",
39
39
  "vitest": "^4.0.14"
40
40
  },
41
41
  "repository": {