pdf-codec 1.6.0 → 1.8.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.
Files changed (120) hide show
  1. package/README.md +75 -12
  2. package/dist/cff-bounds.cjs +432 -0
  3. package/dist/cff-bounds.d.cts +9 -0
  4. package/dist/cff-bounds.d.ts +9 -0
  5. package/dist/cff-bounds.js +431 -0
  6. package/dist/cff-probe.cjs +8 -106
  7. package/dist/cff-probe.js +9 -107
  8. package/dist/cff.cjs +158 -0
  9. package/dist/cff.d.cts +17 -0
  10. package/dist/cff.d.ts +17 -0
  11. package/dist/cff.js +150 -0
  12. package/dist/filters.cjs +45 -2
  13. package/dist/filters.d.cts +4 -3
  14. package/dist/filters.d.ts +4 -3
  15. package/dist/filters.js +45 -2
  16. package/dist/formula.d.cts +1 -1
  17. package/dist/formula.d.ts +1 -1
  18. package/dist/glyf.cjs +62 -6
  19. package/dist/glyf.d.cts +2 -0
  20. package/dist/glyf.d.ts +2 -0
  21. package/dist/glyf.js +62 -6
  22. package/dist/glyph-bounds-BV_Z40KS.d.cts +10 -0
  23. package/dist/glyph-bounds-BV_Z40KS.d.ts +10 -0
  24. package/dist/glyph-bounds.cjs +12 -0
  25. package/dist/glyph-bounds.d.cts +2 -0
  26. package/dist/glyph-bounds.d.ts +2 -0
  27. package/dist/glyph-bounds.js +11 -0
  28. package/dist/image/jbig2-arith.cjs +432 -0
  29. package/dist/image/jbig2-arith.d.cts +23 -0
  30. package/dist/image/jbig2-arith.d.ts +23 -0
  31. package/dist/image/jbig2-arith.js +426 -0
  32. package/dist/image/jbig2-bitmap.cjs +80 -0
  33. package/dist/image/jbig2-bitmap.d.cts +20 -0
  34. package/dist/image/jbig2-bitmap.d.ts +20 -0
  35. package/dist/image/jbig2-bitmap.js +72 -0
  36. package/dist/image/jbig2-errors.cjs +17 -0
  37. package/dist/image/jbig2-errors.d.cts +2 -0
  38. package/dist/image/jbig2-errors.d.ts +2 -0
  39. package/dist/image/jbig2-errors.js +15 -0
  40. package/dist/image/jbig2-generic.cjs +242 -0
  41. package/dist/image/jbig2-generic.d.cts +27 -0
  42. package/dist/image/jbig2-generic.d.ts +27 -0
  43. package/dist/image/jbig2-generic.js +237 -0
  44. package/dist/image/jbig2-text.cjs +175 -0
  45. package/dist/image/jbig2-text.d.cts +58 -0
  46. package/dist/image/jbig2-text.d.ts +58 -0
  47. package/dist/image/jbig2-text.js +170 -0
  48. package/dist/image/jbig2.cjs +333 -0
  49. package/dist/image/jbig2.d.cts +15 -0
  50. package/dist/image/jbig2.d.ts +15 -0
  51. package/dist/image/jbig2.js +332 -0
  52. package/dist/image/jp2-boxes.cjs +148 -0
  53. package/dist/image/jp2-boxes.d.cts +26 -0
  54. package/dist/image/jp2-boxes.d.ts +26 -0
  55. package/dist/image/jp2-boxes.js +146 -0
  56. package/dist/image/jpeg2000-codestream.cjs +309 -0
  57. package/dist/image/jpeg2000-codestream.d.cts +78 -0
  58. package/dist/image/jpeg2000-codestream.d.ts +78 -0
  59. package/dist/image/jpeg2000-codestream.js +308 -0
  60. package/dist/image/jpeg2000-dwt.cjs +148 -0
  61. package/dist/image/jpeg2000-dwt.d.cts +34 -0
  62. package/dist/image/jpeg2000-dwt.d.ts +34 -0
  63. package/dist/image/jpeg2000-dwt.js +145 -0
  64. package/dist/image/jpeg2000-errors.cjs +17 -0
  65. package/dist/image/jpeg2000-errors.d.cts +9 -0
  66. package/dist/image/jpeg2000-errors.d.ts +9 -0
  67. package/dist/image/jpeg2000-errors.js +15 -0
  68. package/dist/image/jpeg2000-t1.cjs +254 -0
  69. package/dist/image/jpeg2000-t1.d.cts +18 -0
  70. package/dist/image/jpeg2000-t1.d.ts +18 -0
  71. package/dist/image/jpeg2000-t1.js +253 -0
  72. package/dist/image/jpeg2000-t2.cjs +316 -0
  73. package/dist/image/jpeg2000-t2.d.cts +79 -0
  74. package/dist/image/jpeg2000-t2.d.ts +79 -0
  75. package/dist/image/jpeg2000-t2.js +311 -0
  76. package/dist/image/jpeg2000-tagtree.cjs +105 -0
  77. package/dist/image/jpeg2000-tagtree.d.cts +29 -0
  78. package/dist/image/jpeg2000-tagtree.d.ts +29 -0
  79. package/dist/image/jpeg2000-tagtree.js +103 -0
  80. package/dist/image/jpeg2000.cjs +322 -0
  81. package/dist/image/jpeg2000.d.cts +54 -0
  82. package/dist/image/jpeg2000.d.ts +54 -0
  83. package/dist/image/jpeg2000.js +320 -0
  84. package/dist/images-read.cjs +78 -1
  85. package/dist/images-read.js +78 -1
  86. package/dist/index.cjs +17 -0
  87. package/dist/index.d.cts +11 -2
  88. package/dist/index.d.ts +11 -2
  89. package/dist/index.js +7 -1
  90. package/dist/jbig2-errors-Bj6MPxrx.d.cts +9 -0
  91. package/dist/jbig2-errors-Bj6MPxrx.d.ts +9 -0
  92. package/dist/math-content-write.cjs +37 -1
  93. package/dist/math-content-write.d.cts +1 -1
  94. package/dist/math-content-write.d.ts +1 -1
  95. package/dist/math-content-write.js +38 -2
  96. package/dist/math-font-write.cjs +6 -1
  97. package/dist/math-font-write.d.cts +1 -1
  98. package/dist/math-font-write.d.ts +1 -1
  99. package/dist/math-font-write.js +6 -1
  100. package/dist/math-font.cjs +91 -18
  101. package/dist/math-font.d.cts +8 -1
  102. package/dist/math-font.d.ts +8 -1
  103. package/dist/math-font.js +91 -18
  104. package/dist/math-stretch-Bwk_bxh1.d.ts +24 -0
  105. package/dist/math-stretch-DXWjs8gL.d.cts +24 -0
  106. package/dist/math-stretch.cjs +96 -0
  107. package/dist/math-stretch.d.cts +2 -0
  108. package/dist/math-stretch.d.ts +2 -0
  109. package/dist/math-stretch.js +94 -0
  110. package/dist/math-table-DhPrNoPa.d.ts +70 -0
  111. package/dist/math-table-gFNB8DmQ.d.cts +70 -0
  112. package/dist/math-table.cjs +69 -1
  113. package/dist/math-table.d.cts +2 -45
  114. package/dist/math-table.d.ts +2 -45
  115. package/dist/math-table.js +69 -1
  116. package/dist/{math-types-Ba8qAf1p.d.ts → math-types-BZkWO5Ow.d.cts} +30 -2
  117. package/dist/{math-types-Ba8qAf1p.d.cts → math-types-Bq7tyV4g.d.ts} +30 -2
  118. package/dist/math-types.d.cts +3 -2
  119. package/dist/math-types.d.ts +3 -2
  120. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ import { t as MathStretchAxis } from "./math-stretch-DXWjs8gL.cjs";
1
2
  //#region src/math-types.d.ts
2
3
  interface MathColor {
3
4
  readonly r: number;
@@ -29,7 +30,19 @@ interface MathStroke {
29
30
  readonly widthPt: number;
30
31
  readonly color: MathColor;
31
32
  }
32
- type MathLayoutItem = MathGlyphRun | MathRule | MathStroke;
33
+ interface MathGlyphPlacement {
34
+ readonly glyphId: number;
35
+ readonly xPt: number;
36
+ readonly yPt: number;
37
+ }
38
+ interface MathAssembledGlyphs {
39
+ readonly kind: 'assembled-glyphs';
40
+ readonly placements: readonly MathGlyphPlacement[];
41
+ readonly text: string;
42
+ readonly sizePt: number;
43
+ readonly color: MathColor;
44
+ }
45
+ type MathLayoutItem = MathGlyphRun | MathRule | MathStroke | MathAssembledGlyphs;
33
46
  interface MathBox {
34
47
  readonly widthPt: number;
35
48
  readonly heightPt: number;
@@ -41,6 +54,20 @@ interface MathGlyphMetrics {
41
54
  readonly advanceWidthPt: number;
42
55
  readonly italicCorrectionPt: number;
43
56
  readonly topAccentXPt?: number;
57
+ readonly inkAscentPt?: number;
58
+ readonly inkDescentPt?: number;
59
+ }
60
+ interface MathStretchGlyph {
61
+ readonly glyphId: number;
62
+ readonly offsetPt: number;
63
+ }
64
+ interface MathStretchResult {
65
+ readonly kind: 'base' | 'variant' | 'assembly';
66
+ readonly sizePt: number;
67
+ readonly advanceWidthPt: number;
68
+ readonly inkAscentPt: number;
69
+ readonly inkDescentPt: number;
70
+ readonly placements: readonly MathStretchGlyph[];
44
71
  }
45
72
  interface MathFontMetrics {
46
73
  readonly ascentPerEm: number;
@@ -77,6 +104,7 @@ interface MathFontMetrics {
77
104
  readonly scriptScriptPercentScaleDown: number;
78
105
  readonly defaultRuleThicknessPt: number;
79
106
  glyph(codePoint: number, sizePt: number): MathGlyphMetrics | undefined;
107
+ stretch(codePoint: number, axis: MathStretchAxis, targetSizePt: number, sizePt: number): MathStretchResult | undefined;
80
108
  }
81
109
  //#endregion
82
- export { MathGlyphRun as a, MathStroke as c, MathGlyphMetrics as i, MathColor as n, MathLayoutItem as o, MathFontMetrics as r, MathRule as s, MathBox as t };
110
+ export { MathGlyphMetrics as a, MathLayoutItem as c, MathStretchResult as d, MathStroke as f, MathFontMetrics as i, MathRule as l, MathBox as n, MathGlyphPlacement as o, MathColor as r, MathGlyphRun as s, MathAssembledGlyphs as t, MathStretchGlyph as u };
@@ -1,3 +1,4 @@
1
+ import { t as MathStretchAxis } from "./math-stretch-Bwk_bxh1.js";
1
2
  //#region src/math-types.d.ts
2
3
  interface MathColor {
3
4
  readonly r: number;
@@ -29,7 +30,19 @@ interface MathStroke {
29
30
  readonly widthPt: number;
30
31
  readonly color: MathColor;
31
32
  }
32
- type MathLayoutItem = MathGlyphRun | MathRule | MathStroke;
33
+ interface MathGlyphPlacement {
34
+ readonly glyphId: number;
35
+ readonly xPt: number;
36
+ readonly yPt: number;
37
+ }
38
+ interface MathAssembledGlyphs {
39
+ readonly kind: 'assembled-glyphs';
40
+ readonly placements: readonly MathGlyphPlacement[];
41
+ readonly text: string;
42
+ readonly sizePt: number;
43
+ readonly color: MathColor;
44
+ }
45
+ type MathLayoutItem = MathGlyphRun | MathRule | MathStroke | MathAssembledGlyphs;
33
46
  interface MathBox {
34
47
  readonly widthPt: number;
35
48
  readonly heightPt: number;
@@ -41,6 +54,20 @@ interface MathGlyphMetrics {
41
54
  readonly advanceWidthPt: number;
42
55
  readonly italicCorrectionPt: number;
43
56
  readonly topAccentXPt?: number;
57
+ readonly inkAscentPt?: number;
58
+ readonly inkDescentPt?: number;
59
+ }
60
+ interface MathStretchGlyph {
61
+ readonly glyphId: number;
62
+ readonly offsetPt: number;
63
+ }
64
+ interface MathStretchResult {
65
+ readonly kind: 'base' | 'variant' | 'assembly';
66
+ readonly sizePt: number;
67
+ readonly advanceWidthPt: number;
68
+ readonly inkAscentPt: number;
69
+ readonly inkDescentPt: number;
70
+ readonly placements: readonly MathStretchGlyph[];
44
71
  }
45
72
  interface MathFontMetrics {
46
73
  readonly ascentPerEm: number;
@@ -77,6 +104,7 @@ interface MathFontMetrics {
77
104
  readonly scriptScriptPercentScaleDown: number;
78
105
  readonly defaultRuleThicknessPt: number;
79
106
  glyph(codePoint: number, sizePt: number): MathGlyphMetrics | undefined;
107
+ stretch(codePoint: number, axis: MathStretchAxis, targetSizePt: number, sizePt: number): MathStretchResult | undefined;
80
108
  }
81
109
  //#endregion
82
- export { MathGlyphRun as a, MathStroke as c, MathGlyphMetrics as i, MathColor as n, MathLayoutItem as o, MathFontMetrics as r, MathRule as s, MathBox as t };
110
+ export { MathGlyphMetrics as a, MathLayoutItem as c, MathStretchResult as d, MathStroke as f, MathFontMetrics as i, MathRule as l, MathBox as n, MathGlyphPlacement as o, MathColor as r, MathGlyphRun as s, MathAssembledGlyphs as t, MathStretchGlyph as u };
@@ -1,2 +1,3 @@
1
- import { a as MathGlyphRun, c as MathStroke, i as MathGlyphMetrics, n as MathColor, o as MathLayoutItem, r as MathFontMetrics, s as MathRule, t as MathBox } from "./math-types-Ba8qAf1p.cjs";
2
- export { MathBox, MathColor, MathFontMetrics, MathGlyphMetrics, MathGlyphRun, MathLayoutItem, MathRule, MathStroke };
1
+ import { t as MathStretchAxis } from "./math-stretch-DXWjs8gL.cjs";
2
+ import { a as MathGlyphMetrics, c as MathLayoutItem, d as MathStretchResult, f as MathStroke, i as MathFontMetrics, l as MathRule, n as MathBox, o as MathGlyphPlacement, r as MathColor, s as MathGlyphRun, t as MathAssembledGlyphs, u as MathStretchGlyph } from "./math-types-BZkWO5Ow.cjs";
3
+ export { MathAssembledGlyphs, MathBox, MathColor, MathFontMetrics, MathGlyphMetrics, MathGlyphPlacement, MathGlyphRun, MathLayoutItem, MathRule, type MathStretchAxis, MathStretchGlyph, MathStretchResult, MathStroke };
@@ -1,2 +1,3 @@
1
- import { a as MathGlyphRun, c as MathStroke, i as MathGlyphMetrics, n as MathColor, o as MathLayoutItem, r as MathFontMetrics, s as MathRule, t as MathBox } from "./math-types-Ba8qAf1p.js";
2
- export { MathBox, MathColor, MathFontMetrics, MathGlyphMetrics, MathGlyphRun, MathLayoutItem, MathRule, MathStroke };
1
+ import { t as MathStretchAxis } from "./math-stretch-Bwk_bxh1.js";
2
+ import { a as MathGlyphMetrics, c as MathLayoutItem, d as MathStretchResult, f as MathStroke, i as MathFontMetrics, l as MathRule, n as MathBox, o as MathGlyphPlacement, r as MathColor, s as MathGlyphRun, t as MathAssembledGlyphs, u as MathStretchGlyph } from "./math-types-Bq7tyV4g.js";
3
+ export { MathAssembledGlyphs, MathBox, MathColor, MathFontMetrics, MathGlyphMetrics, MathGlyphPlacement, MathGlyphRun, MathLayoutItem, MathRule, type MathStretchAxis, MathStretchGlyph, MathStretchResult, MathStroke };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pdf-codec",
3
- "version": "1.6.0",
3
+ "version": "1.8.0",
4
4
  "description": "Hand-written, dependency-minimal PDF codec: parses arbitrary real-world PDFs and generates new ones, built on document-schema.js's LayoutDocument pivot and Zod 4 codecs.",
5
5
  "type": "module",
6
6
  "repository": {