pdf-parser.js 5.2.30 → 5.3.1

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 (189) hide show
  1. package/dist/{afm-widths-BHD2HZIL.cjs → afm-widths-C6U0SQj9.cjs} +5 -1448
  2. package/dist/{afm-widths-B_IGbGky.js → afm-widths-p3UfaXme.js} +3 -1398
  3. package/dist/afm-widths.cjs +1 -1
  4. package/dist/afm-widths.js +1 -1
  5. package/dist/annotations.d.cts +3 -3
  6. package/dist/annotations.d.ts +3 -3
  7. package/dist/attachments.d.cts +2 -2
  8. package/dist/attachments.d.ts +2 -2
  9. package/dist/builtin-encoding.cjs +4 -3
  10. package/dist/builtin-encoding.js +2 -1
  11. package/dist/cmap.d.cts +1 -1
  12. package/dist/cmap.d.ts +1 -1
  13. package/dist/content-read.d.cts +1 -1
  14. package/dist/content-read.d.ts +1 -1
  15. package/dist/content-write.cjs +1 -1
  16. package/dist/content-write.d.cts +1 -1
  17. package/dist/content-write.d.ts +1 -1
  18. package/dist/content-write.js +1 -1
  19. package/dist/diagnostics-C9FxfZ6H.d.cts +22 -0
  20. package/dist/diagnostics-C9FxfZ6H.d.ts +22 -0
  21. package/dist/diagnostics.d.cts +1 -21
  22. package/dist/diagnostics.d.ts +1 -21
  23. package/dist/document.d.cts +1 -1
  24. package/dist/document.d.ts +1 -1
  25. package/dist/{embedded-font-ByD7ZiQS.d.ts → embedded-font-CQZbTTDM.d.ts} +1 -1
  26. package/dist/{embedded-font-DgVBedw6.d.cts → embedded-font-CqePfvrl.d.cts} +1 -1
  27. package/dist/embedded-font-write.d.cts +1 -1
  28. package/dist/embedded-font-write.d.ts +1 -1
  29. package/dist/embedded-font.cjs +2 -2
  30. package/dist/embedded-font.d.cts +1 -1
  31. package/dist/embedded-font.d.ts +1 -1
  32. package/dist/embedded-font.js +2 -2
  33. package/dist/encoding-glyph-unicode.cjs +353 -0
  34. package/dist/encoding-glyph-unicode.d.cts +4 -0
  35. package/dist/encoding-glyph-unicode.d.ts +4 -0
  36. package/dist/encoding-glyph-unicode.js +352 -0
  37. package/dist/encoding-standard-tables.cjs +531 -0
  38. package/dist/encoding-standard-tables.d.cts +7 -0
  39. package/dist/encoding-standard-tables.d.ts +7 -0
  40. package/dist/encoding-standard-tables.js +527 -0
  41. package/dist/encoding-symbol-tables.cjs +533 -0
  42. package/dist/encoding-symbol-tables.d.cts +7 -0
  43. package/dist/encoding-symbol-tables.d.ts +7 -0
  44. package/dist/encoding-symbol-tables.js +529 -0
  45. package/dist/encoding.cjs +1 -9
  46. package/dist/encoding.d.cts +1 -9
  47. package/dist/encoding.d.ts +1 -9
  48. package/dist/encoding.js +2 -2
  49. package/dist/encrypt.d.cts +1 -1
  50. package/dist/encrypt.d.ts +1 -1
  51. package/dist/filters.d.cts +1 -1
  52. package/dist/filters.d.ts +1 -1
  53. package/dist/font-read.cjs +4 -3
  54. package/dist/font-read.d.cts +2 -2
  55. package/dist/font-read.d.ts +2 -2
  56. package/dist/font-read.js +2 -1
  57. package/dist/font-registry.d.cts +1 -1
  58. package/dist/font-registry.d.ts +1 -1
  59. package/dist/form.d.cts +2 -2
  60. package/dist/form.d.ts +2 -2
  61. package/dist/gdef-table-D0Hzn4KD.d.cts +15 -0
  62. package/dist/gdef-table-DL0V8wEZ.d.ts +15 -0
  63. package/dist/gdef-table.d.cts +1 -14
  64. package/dist/gdef-table.d.ts +1 -14
  65. package/dist/glyf-contours.d.cts +12 -1
  66. package/dist/glyf-contours.d.ts +12 -1
  67. package/dist/gsub-context.cjs +13 -0
  68. package/dist/gsub-context.d.cts +34 -0
  69. package/dist/gsub-context.d.ts +34 -0
  70. package/dist/gsub-context.js +2 -0
  71. package/dist/gsub-table-BDpJWqpf.d.ts +52 -0
  72. package/dist/gsub-table-D6niKeLi.js +556 -0
  73. package/dist/gsub-table-DW7Wmi9V.d.cts +52 -0
  74. package/dist/gsub-table-hFfYmf1W.cjs +741 -0
  75. package/dist/gsub-table.cjs +21 -556
  76. package/dist/gsub-table.d.cts +2 -2
  77. package/dist/gsub-table.d.ts +2 -2
  78. package/dist/gsub-table.js +2 -554
  79. package/dist/images-read.d.cts +2 -2
  80. package/dist/images-read.d.ts +2 -2
  81. package/dist/index.cjs +6 -6
  82. package/dist/index.d.cts +2 -2
  83. package/dist/index.d.ts +2 -2
  84. package/dist/index.js +6 -6
  85. package/dist/interpret-CqXdXgkY.cjs +712 -0
  86. package/dist/interpret-aWWhdIzr.js +677 -0
  87. package/dist/interpret-colors.cjs +6 -0
  88. package/dist/interpret-colors.d.cts +9 -0
  89. package/dist/interpret-colors.d.ts +9 -0
  90. package/dist/interpret-colors.js +2 -0
  91. package/dist/interpret-marked.cjs +25 -0
  92. package/dist/interpret-marked.d.cts +11 -0
  93. package/dist/interpret-marked.d.ts +11 -0
  94. package/dist/interpret-marked.js +23 -0
  95. package/dist/interpret-shapes.cjs +212 -0
  96. package/dist/interpret-shapes.d.cts +32 -0
  97. package/dist/interpret-shapes.d.ts +32 -0
  98. package/dist/interpret-shapes.js +199 -0
  99. package/dist/interpret-types.cjs +0 -0
  100. package/dist/interpret-types.d.cts +123 -0
  101. package/dist/interpret-types.d.ts +123 -0
  102. package/dist/interpret-types.js +0 -0
  103. package/dist/interpret.cjs +3 -887
  104. package/dist/interpret.d.cts +5 -116
  105. package/dist/interpret.d.ts +5 -116
  106. package/dist/interpret.js +2 -887
  107. package/dist/math-font.cjs +1 -1
  108. package/dist/math-font.js +1 -1
  109. package/dist/measure.cjs +1 -1
  110. package/dist/measure.js +1 -1
  111. package/dist/names.d.cts +2 -2
  112. package/dist/names.d.ts +2 -2
  113. package/dist/navigation.d.cts +2 -2
  114. package/dist/navigation.d.ts +2 -2
  115. package/dist/optional-content.d.cts +2 -2
  116. package/dist/optional-content.d.ts +2 -2
  117. package/dist/ot-layout-common-BcsGRFBS.d.cts +10 -0
  118. package/dist/ot-layout-common-BcsGRFBS.d.ts +10 -0
  119. package/dist/ot-layout-common.d.cts +1 -9
  120. package/dist/ot-layout-common.d.ts +1 -9
  121. package/dist/parse.d.cts +1 -1
  122. package/dist/parse.d.ts +1 -1
  123. package/dist/predictors.d.cts +1 -1
  124. package/dist/predictors.d.ts +1 -1
  125. package/dist/raster-Cdm3idP_.js +794 -0
  126. package/dist/raster-EG2KYRZ0.cjs +829 -0
  127. package/dist/raster-text.cjs +5 -0
  128. package/dist/raster-text.d.cts +20 -0
  129. package/dist/raster-text.d.ts +20 -0
  130. package/dist/raster-text.js +2 -0
  131. package/dist/raster.cjs +4 -795
  132. package/dist/raster.d.cts +17 -6
  133. package/dist/raster.d.ts +17 -6
  134. package/dist/raster.js +2 -792
  135. package/dist/read-convert.cjs +310 -0
  136. package/dist/read-convert.d.cts +58 -0
  137. package/dist/read-convert.d.ts +58 -0
  138. package/dist/read-convert.js +295 -0
  139. package/dist/read.cjs +5 -293
  140. package/dist/read.d.cts +1 -1
  141. package/dist/read.d.ts +1 -1
  142. package/dist/read.js +4 -292
  143. package/dist/structure.d.cts +2 -2
  144. package/dist/structure.d.ts +2 -2
  145. package/dist/winansi.cjs +1 -1
  146. package/dist/winansi.js +1 -1
  147. package/dist/write-annotations.cjs +132 -0
  148. package/dist/write-annotations.d.cts +29 -0
  149. package/dist/write-annotations.d.ts +29 -0
  150. package/dist/write-annotations.js +121 -0
  151. package/dist/write-font-objects.cjs +76 -0
  152. package/dist/write-font-objects.d.cts +35 -0
  153. package/dist/write-font-objects.d.ts +35 -0
  154. package/dist/write-font-objects.js +75 -0
  155. package/dist/write-form.cjs +91 -0
  156. package/dist/write-form.d.cts +19 -0
  157. package/dist/write-form.d.ts +19 -0
  158. package/dist/write-form.js +89 -0
  159. package/dist/write-images.cjs +148 -0
  160. package/dist/write-images.d.cts +25 -0
  161. package/dist/write-images.d.ts +25 -0
  162. package/dist/write-images.js +140 -0
  163. package/dist/write-outline.cjs +46 -0
  164. package/dist/write-outline.d.cts +18 -0
  165. package/dist/write-outline.d.ts +18 -0
  166. package/dist/write-outline.js +45 -0
  167. package/dist/write-page-emit.cjs +97 -0
  168. package/dist/write-page-emit.d.cts +63 -0
  169. package/dist/write-page-emit.d.ts +63 -0
  170. package/dist/write-page-emit.js +96 -0
  171. package/dist/write-pages.cjs +37 -0
  172. package/dist/write-pages.d.cts +21 -0
  173. package/dist/write-pages.d.ts +21 -0
  174. package/dist/write-pages.js +36 -0
  175. package/dist/write-strings.cjs +41 -0
  176. package/dist/write-strings.d.cts +9 -0
  177. package/dist/write-strings.d.ts +9 -0
  178. package/dist/write-strings.js +37 -0
  179. package/dist/write.cjs +53 -553
  180. package/dist/write.d.cts +1 -1
  181. package/dist/write.d.ts +1 -1
  182. package/dist/write.js +49 -549
  183. package/dist/xref.d.cts +1 -1
  184. package/dist/xref.d.ts +1 -1
  185. package/package.json +1 -1
  186. package/dist/glyf-contours-B1PsI9oA.d.ts +0 -13
  187. package/dist/glyf-contours-NHBpgks-.d.cts +0 -13
  188. package/dist/gsub-table-Bm9kSMzk.d.cts +0 -16
  189. package/dist/gsub-table-CdfESH2-.d.ts +0 -16
@@ -0,0 +1,310 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ require("./notes-annotation-author.cjs");
3
+ const require_objects = require("./objects.cjs");
4
+ const require_pdf_text = require("./pdf-text.cjs");
5
+ const require_matrix = require("./matrix.cjs");
6
+ const require_bytes_crc32 = require("./bytes/crc32.cjs");
7
+ const require_images_read = require("./images-read.cjs");
8
+ let byte_codec = require("byte-codec");
9
+ //#region src/read-convert.ts
10
+ function convertExtractedItem(item, pageMatrix, fontResolver, images, imageIdCache, resolver, sink) {
11
+ if (item.kind === "text") return convertText(item, pageMatrix, fontResolver);
12
+ if (item.kind === "rect") return convertRect(item, pageMatrix);
13
+ if (item.kind === "ellipse") return convertEllipse(item, pageMatrix);
14
+ if (item.kind === "line") return convertLine(item, pageMatrix);
15
+ if (item.kind === "path") return convertPath(item, pageMatrix);
16
+ if (item.kind === "image") return convertImage(item, pageMatrix, images, imageIdCache, resolver, sink);
17
+ return convertInlineImage(item, pageMatrix, images, resolver, sink);
18
+ }
19
+ function convertText(item, pageMatrix, fontResolver) {
20
+ const font = fontResolver.resolve(item.fontResourceName, item.resources);
21
+ const text = font?.decodeToUnicode(item.codes) ?? "";
22
+ if (text.length === 0) return;
23
+ const startTrm = require_matrix.multiplyMatrices(item.startMatrix, pageMatrix);
24
+ const endTrm = require_matrix.multiplyMatrices(item.endMatrix, pageMatrix);
25
+ const widthPt = Math.hypot(endTrm[4] - startTrm[4], endTrm[5] - startTrm[5]);
26
+ const sizePt = require_matrix.matrixScaleX(startTrm);
27
+ const rotationDeg = require_matrix.matrixRotationDegrees(startTrm);
28
+ const layoutFont = {
29
+ family: font?.family ?? "Helvetica",
30
+ weight: font?.bold === true ? "bold" : "normal",
31
+ style: font?.italic === true ? "italic" : "normal"
32
+ };
33
+ return {
34
+ kind: "text",
35
+ text,
36
+ xPt: startTrm[4],
37
+ yPt: startTrm[5],
38
+ font: layoutFont,
39
+ sizePt: sizePt > 0 ? sizePt : item.sizePt,
40
+ color: item.color,
41
+ widthPt,
42
+ rotationDeg: rotationDeg !== 0 ? rotationDeg : void 0,
43
+ ...item.vertical === true ? { writingMode: "vertical" } : {},
44
+ ...item.layerName !== void 0 ? { layer: item.layerName } : {},
45
+ ...item.actualText !== void 0 ? { actualText: item.actualText } : {},
46
+ ...item.alt !== void 0 ? { alt: item.alt } : {}
47
+ };
48
+ }
49
+ function paintFields(paint) {
50
+ return {
51
+ ...paint.fill !== void 0 ? { fill: paint.fill } : {},
52
+ ...paint.stroke !== void 0 ? { stroke: paint.stroke } : {}
53
+ };
54
+ }
55
+ function transformBox(item, pageMatrix) {
56
+ const p1 = require_matrix.applyMatrix(pageMatrix, {
57
+ x: item.xPt,
58
+ y: item.yPt
59
+ });
60
+ const p2 = require_matrix.applyMatrix(pageMatrix, {
61
+ x: item.xPt + item.widthPt,
62
+ y: item.yPt + item.heightPt
63
+ });
64
+ return {
65
+ xPt: Math.min(p1.x, p2.x),
66
+ yPt: Math.min(p1.y, p2.y),
67
+ widthPt: Math.abs(p2.x - p1.x),
68
+ heightPt: Math.abs(p2.y - p1.y)
69
+ };
70
+ }
71
+ function convertRect(item, pageMatrix) {
72
+ return {
73
+ kind: "rect",
74
+ ...transformBox(item, pageMatrix),
75
+ ...paintFields(item),
76
+ ...item.layerName !== void 0 ? { layer: item.layerName } : {}
77
+ };
78
+ }
79
+ function convertEllipse(item, pageMatrix) {
80
+ return {
81
+ kind: "ellipse",
82
+ ...transformBox(item, pageMatrix),
83
+ ...paintFields(item),
84
+ ...item.layerName !== void 0 ? { layer: item.layerName } : {}
85
+ };
86
+ }
87
+ function convertLine(item, pageMatrix) {
88
+ const p1 = require_matrix.applyMatrix(pageMatrix, {
89
+ x: item.x1Pt,
90
+ y: item.y1Pt
91
+ });
92
+ const p2 = require_matrix.applyMatrix(pageMatrix, {
93
+ x: item.x2Pt,
94
+ y: item.y2Pt
95
+ });
96
+ return {
97
+ kind: "line",
98
+ x1Pt: p1.x,
99
+ y1Pt: p1.y,
100
+ x2Pt: p2.x,
101
+ y2Pt: p2.y,
102
+ color: item.color,
103
+ widthPt: item.widthPt,
104
+ ...item.style !== void 0 ? { style: item.style } : {},
105
+ ...item.layerName !== void 0 ? { layer: item.layerName } : {}
106
+ };
107
+ }
108
+ function transformSubpath(subpath, pageMatrix) {
109
+ const start = require_matrix.applyMatrix(pageMatrix, {
110
+ x: subpath.startXPt,
111
+ y: subpath.startYPt
112
+ });
113
+ const segments = subpath.segments.map((segment) => {
114
+ if (segment.kind === "line") {
115
+ const p = require_matrix.applyMatrix(pageMatrix, {
116
+ x: segment.xPt,
117
+ y: segment.yPt
118
+ });
119
+ return {
120
+ kind: "line",
121
+ xPt: p.x,
122
+ yPt: p.y
123
+ };
124
+ }
125
+ const c1 = require_matrix.applyMatrix(pageMatrix, {
126
+ x: segment.c1xPt,
127
+ y: segment.c1yPt
128
+ });
129
+ const c2 = require_matrix.applyMatrix(pageMatrix, {
130
+ x: segment.c2xPt,
131
+ y: segment.c2yPt
132
+ });
133
+ const p = require_matrix.applyMatrix(pageMatrix, {
134
+ x: segment.xPt,
135
+ y: segment.yPt
136
+ });
137
+ return {
138
+ kind: "cubic",
139
+ c1xPt: c1.x,
140
+ c1yPt: c1.y,
141
+ c2xPt: c2.x,
142
+ c2yPt: c2.y,
143
+ xPt: p.x,
144
+ yPt: p.y
145
+ };
146
+ });
147
+ return {
148
+ startXPt: start.x,
149
+ startYPt: start.y,
150
+ segments,
151
+ closed: subpath.closed
152
+ };
153
+ }
154
+ function convertPath(item, pageMatrix) {
155
+ return {
156
+ kind: "path",
157
+ subpaths: item.subpaths.map((subpath) => transformSubpath(subpath, pageMatrix)),
158
+ ...item.fill !== void 0 ? { fill: item.fill } : {},
159
+ ...item.fill !== void 0 && item.fillRule === "evenodd" ? { fillRule: "evenodd" } : {},
160
+ ...item.stroke !== void 0 ? { stroke: item.stroke } : {},
161
+ ...item.style !== void 0 ? { style: item.style } : {},
162
+ ...item.layerName !== void 0 ? { layer: item.layerName } : {}
163
+ };
164
+ }
165
+ function imagePlacementFrom(matrix) {
166
+ const rotationDeg = require_matrix.matrixRotationDegrees(matrix);
167
+ return {
168
+ xPt: matrix[4],
169
+ yPt: matrix[5],
170
+ widthPt: require_matrix.matrixScaleX(matrix),
171
+ heightPt: require_matrix.matrixScaleY(matrix),
172
+ rotationDeg: rotationDeg !== 0 ? rotationDeg : void 0
173
+ };
174
+ }
175
+ const HEX_RADIX = 16;
176
+ function registerExtractedImage(format, bytes, widthPx, heightPx, images, original) {
177
+ const imageId = `img${require_bytes_crc32.crc32(bytes).toString(HEX_RADIX)}`;
178
+ if (!(imageId in images)) images[imageId] = {
179
+ format,
180
+ base64: (0, byte_codec.bytesToBase64)(bytes),
181
+ widthPx,
182
+ heightPx,
183
+ ...original !== void 0 ? { original: {
184
+ filter: original.filter,
185
+ base64: (0, byte_codec.bytesToBase64)(original.bytes),
186
+ ...original.globalsBytes !== void 0 ? { jbig2GlobalsBase64: (0, byte_codec.bytesToBase64)(original.globalsBytes) } : {}
187
+ } } : {}
188
+ };
189
+ return imageId;
190
+ }
191
+ function resolveCachedImageId(dict, raw, images, cache, resolver, sink) {
192
+ if (cache.has(dict)) return cache.get(dict) ?? void 0;
193
+ const decoded = require_images_read.readImageXObject(dict, raw, resolver, sink);
194
+ if (decoded === void 0) {
195
+ cache.set(dict, null);
196
+ return;
197
+ }
198
+ const imageId = registerExtractedImage(decoded.format, decoded.bytes, decoded.widthPx, decoded.heightPx, images, decoded.original);
199
+ cache.set(dict, imageId);
200
+ return imageId;
201
+ }
202
+ function convertImage(item, pageMatrix, images, cache, resolver, sink) {
203
+ const xobjects = resolver.resolveDict(require_objects.dictGet(item.resources, "XObject"));
204
+ const xobj = xobjects !== void 0 ? resolver.resolve(require_objects.dictGet(xobjects, item.resourceName)) : void 0;
205
+ if (xobj?.kind !== "stream") return;
206
+ const imageId = resolveCachedImageId(xobj.dict, xobj.raw, images, cache, resolver, sink);
207
+ if (imageId === void 0) return;
208
+ return {
209
+ kind: "image",
210
+ imageId,
211
+ ...imagePlacementFrom(require_matrix.multiplyMatrices(item.matrix, pageMatrix)),
212
+ ...item.layerName !== void 0 ? { layer: item.layerName } : {}
213
+ };
214
+ }
215
+ function convertInlineImage(item, pageMatrix, images, resolver, sink) {
216
+ const decoded = require_images_read.readImageXObject(item.dict, item.data, resolver, sink);
217
+ if (decoded === void 0) return;
218
+ return {
219
+ kind: "image",
220
+ imageId: registerExtractedImage(decoded.format, decoded.bytes, decoded.widthPx, decoded.heightPx, images, decoded.original),
221
+ ...imagePlacementFrom(require_matrix.multiplyMatrices(item.matrix, pageMatrix)),
222
+ ...item.layerName !== void 0 ? { layer: item.layerName } : {}
223
+ };
224
+ }
225
+ function readLinkAnnotations(page, pageMatrix, resolver, destinationRegistry) {
226
+ const annotsArr = require_objects.asArray(require_objects.dictGet(page, "Annots"));
227
+ if (annotsArr === void 0) return [];
228
+ const links = [];
229
+ for (const annotRef of annotsArr) {
230
+ const annot = resolver.resolveDict(annotRef);
231
+ if (annot === void 0 || require_objects.asName(require_objects.dictGet(annot, "Subtype")) !== "Link") continue;
232
+ const rectArr = require_objects.asArray(require_objects.dictGet(annot, "Rect"));
233
+ if (rectArr === void 0) continue;
234
+ const uri = readLinkUri(annot, resolver);
235
+ const destination = uri === void 0 ? readInternalDestination(annot, resolver, destinationRegistry) : void 0;
236
+ if (uri === void 0 && destination === void 0) continue;
237
+ const x1 = require_objects.asNumber(rectArr[0]) ?? 0;
238
+ const y1 = require_objects.asNumber(rectArr[1]) ?? 0;
239
+ const x2 = require_objects.asNumber(rectArr[2]) ?? 0;
240
+ const y2 = require_objects.asNumber(rectArr[3]) ?? 0;
241
+ const p1 = require_matrix.applyMatrix(pageMatrix, {
242
+ x: Math.min(x1, x2),
243
+ y: Math.min(y1, y2)
244
+ });
245
+ const p2 = require_matrix.applyMatrix(pageMatrix, {
246
+ x: Math.max(x1, x2),
247
+ y: Math.max(y1, y2)
248
+ });
249
+ const contentsObj = require_objects.dictGet(annot, "Contents");
250
+ const title = contentsObj?.kind === "string" ? require_pdf_text.decodePdfString(contentsObj.bytes) : void 0;
251
+ const box = {
252
+ xPt: Math.min(p1.x, p2.x),
253
+ yPt: Math.min(p1.y, p2.y),
254
+ widthPt: Math.abs(p2.x - p1.x),
255
+ heightPt: Math.abs(p2.y - p1.y),
256
+ ...title !== void 0 ? { title } : {}
257
+ };
258
+ if (uri !== void 0) links.push({
259
+ kind: "link",
260
+ uri,
261
+ ...box
262
+ });
263
+ else if (destination !== void 0) links.push({
264
+ kind: "internalLink",
265
+ destination,
266
+ ...box
267
+ });
268
+ }
269
+ return links;
270
+ }
271
+ function readLinkUri(annot, resolver) {
272
+ const action = resolver.resolveDict(require_objects.dictGet(annot, "A"));
273
+ if (action === void 0 || require_objects.asName(require_objects.dictGet(action, "S")) !== "URI") return;
274
+ const uriObj = require_objects.dictGet(action, "URI");
275
+ return uriObj?.kind === "string" ? require_pdf_text.decodePdfString(uriObj.bytes) : void 0;
276
+ }
277
+ function readInternalDestination(annot, resolver, destinationRegistry) {
278
+ const dest = require_objects.dictGet(annot, "Dest");
279
+ if (dest !== void 0) return destinationRegistry.intern(dest);
280
+ const action = resolver.resolveDict(require_objects.dictGet(annot, "A"));
281
+ if (action !== void 0 && require_objects.asName(require_objects.dictGet(action, "S")) === "GoTo") return destinationRegistry.intern(require_objects.dictGet(action, "D"));
282
+ }
283
+ function readPageNotes(page, resolver) {
284
+ const annotsArr = require_objects.asArray(require_objects.dictGet(page, "Annots"));
285
+ if (annotsArr === void 0) return;
286
+ for (const annotRef of annotsArr) {
287
+ const annot = resolver.resolveDict(annotRef);
288
+ if (annot === void 0 || require_objects.asName(require_objects.dictGet(annot, "Subtype")) !== "Text") continue;
289
+ const titleObj = require_objects.dictGet(annot, "T");
290
+ if ((titleObj?.kind === "string" ? require_pdf_text.decodePdfString(titleObj.bytes) : void 0) !== "documents.js:notes") continue;
291
+ const contentsObj = require_objects.dictGet(annot, "Contents");
292
+ if (contentsObj?.kind === "string") return require_pdf_text.decodePdfString(contentsObj.bytes);
293
+ }
294
+ }
295
+ //#endregion
296
+ exports.convertEllipse = convertEllipse;
297
+ exports.convertExtractedItem = convertExtractedItem;
298
+ exports.convertImage = convertImage;
299
+ exports.convertLine = convertLine;
300
+ exports.convertPath = convertPath;
301
+ exports.convertRect = convertRect;
302
+ exports.convertText = convertText;
303
+ exports.imagePlacementFrom = imagePlacementFrom;
304
+ exports.paintFields = paintFields;
305
+ exports.readLinkAnnotations = readLinkAnnotations;
306
+ exports.readPageNotes = readPageNotes;
307
+ exports.registerExtractedImage = registerExtractedImage;
308
+ exports.resolveCachedImageId = resolveCachedImageId;
309
+ exports.transformBox = transformBox;
310
+ exports.transformSubpath = transformSubpath;
@@ -0,0 +1,58 @@
1
+ import { i as PdfDiagnosticSink } from "./diagnostics-C9FxfZ6H.cjs";
2
+ import { n as PdfDict } from "./objects-e2RS3-yT.cjs";
3
+ import { r as Matrix } from "./matrix-B7_SBKQ5.cjs";
4
+ import { ExtractedEllipse, ExtractedImage, ExtractedItem, ExtractedLine, ExtractedPaint, ExtractedPath, ExtractedRect, ExtractedSubpath, ExtractedTextRun, PdfObjectResolver } from "./interpret-types.cjs";
5
+ import { LayoutEllipse, LayoutImageAsset, LayoutInternalLink, LayoutItem, LayoutLine, LayoutLink, LayoutPath, LayoutRect, LayoutSubpath, LayoutText } from "./layout.cjs";
6
+ import { FontResolverService } from "./font-read.cjs";
7
+ import { DestinationRegistry } from "./navigation.cjs";
8
+ import { ExtractedPdfImage } from "./images-read.cjs";
9
+ import { Color } from "document-schema.js";
10
+ //#region src/read-convert.d.ts
11
+ declare function convertExtractedItem(item: ExtractedItem, pageMatrix: Matrix, fontResolver: FontResolverService, images: Record<string, LayoutImageAsset>, imageIdCache: Map<PdfDict, string | null>, resolver: Readonly<PdfObjectResolver>, sink: PdfDiagnosticSink): LayoutItem | undefined;
12
+ declare function convertText(item: ExtractedTextRun, pageMatrix: Matrix, fontResolver: FontResolverService): LayoutText | undefined;
13
+ declare function paintFields(paint: ExtractedPaint): {
14
+ fill?: Color;
15
+ stroke?: {
16
+ readonly color: Color;
17
+ readonly widthPt: number;
18
+ };
19
+ };
20
+ declare function transformBox(item: Readonly<{
21
+ xPt: number;
22
+ yPt: number;
23
+ widthPt: number;
24
+ heightPt: number;
25
+ }>, pageMatrix: Matrix): {
26
+ xPt: number;
27
+ yPt: number;
28
+ widthPt: number;
29
+ heightPt: number;
30
+ };
31
+ declare function convertRect(item: ExtractedRect, pageMatrix: Matrix): LayoutRect;
32
+ declare function convertEllipse(item: ExtractedEllipse, pageMatrix: Matrix): LayoutEllipse;
33
+ declare function convertLine(item: ExtractedLine, pageMatrix: Matrix): LayoutLine;
34
+ declare function transformSubpath(subpath: ExtractedSubpath, pageMatrix: Matrix): LayoutSubpath;
35
+ declare function convertPath(item: ExtractedPath, pageMatrix: Matrix): LayoutPath;
36
+ declare function imagePlacementFrom(matrix: Matrix): {
37
+ xPt: number;
38
+ yPt: number;
39
+ widthPt: number;
40
+ heightPt: number;
41
+ rotationDeg: number | undefined;
42
+ };
43
+ declare function registerExtractedImage(format: "png" | "jpeg", bytes: Uint8Array<ArrayBuffer>, widthPx: number, heightPx: number, images: Record<string, LayoutImageAsset>, original: ExtractedPdfImage["original"]): string;
44
+ declare function resolveCachedImageId(dict: PdfDict, raw: Uint8Array<ArrayBuffer>, images: Record<string, LayoutImageAsset>, cache: Map<PdfDict, string | null>, resolver: Readonly<PdfObjectResolver>, sink: PdfDiagnosticSink): string | undefined;
45
+ declare function convertImage(item: ExtractedImage, pageMatrix: Matrix, images: Record<string, LayoutImageAsset>, cache: Map<PdfDict, string | null>, resolver: Readonly<PdfObjectResolver>, sink: PdfDiagnosticSink): {
46
+ layer?: string | undefined;
47
+ xPt: number;
48
+ yPt: number;
49
+ widthPt: number;
50
+ heightPt: number;
51
+ rotationDeg: number | undefined;
52
+ kind: "image";
53
+ imageId: string;
54
+ } | undefined;
55
+ declare function readLinkAnnotations(page: PdfDict, pageMatrix: Matrix, resolver: Readonly<PdfObjectResolver>, destinationRegistry: DestinationRegistry): (LayoutLink | LayoutInternalLink)[];
56
+ declare function readPageNotes(page: PdfDict, resolver: Readonly<PdfObjectResolver>): string | undefined;
57
+ //#endregion
58
+ export { convertEllipse, convertExtractedItem, convertImage, convertLine, convertPath, convertRect, convertText, imagePlacementFrom, paintFields, readLinkAnnotations, readPageNotes, registerExtractedImage, resolveCachedImageId, transformBox, transformSubpath };
@@ -0,0 +1,58 @@
1
+ import { i as PdfDiagnosticSink } from "./diagnostics-C9FxfZ6H.js";
2
+ import { n as PdfDict } from "./objects-e2RS3-yT.js";
3
+ import { r as Matrix } from "./matrix-B7_SBKQ5.js";
4
+ import { ExtractedEllipse, ExtractedImage, ExtractedItem, ExtractedLine, ExtractedPaint, ExtractedPath, ExtractedRect, ExtractedSubpath, ExtractedTextRun, PdfObjectResolver } from "./interpret-types.js";
5
+ import { LayoutEllipse, LayoutImageAsset, LayoutInternalLink, LayoutItem, LayoutLine, LayoutLink, LayoutPath, LayoutRect, LayoutSubpath, LayoutText } from "./layout.js";
6
+ import { FontResolverService } from "./font-read.js";
7
+ import { DestinationRegistry } from "./navigation.js";
8
+ import { ExtractedPdfImage } from "./images-read.js";
9
+ import { Color } from "document-schema.js";
10
+ //#region src/read-convert.d.ts
11
+ declare function convertExtractedItem(item: ExtractedItem, pageMatrix: Matrix, fontResolver: FontResolverService, images: Record<string, LayoutImageAsset>, imageIdCache: Map<PdfDict, string | null>, resolver: Readonly<PdfObjectResolver>, sink: PdfDiagnosticSink): LayoutItem | undefined;
12
+ declare function convertText(item: ExtractedTextRun, pageMatrix: Matrix, fontResolver: FontResolverService): LayoutText | undefined;
13
+ declare function paintFields(paint: ExtractedPaint): {
14
+ fill?: Color;
15
+ stroke?: {
16
+ readonly color: Color;
17
+ readonly widthPt: number;
18
+ };
19
+ };
20
+ declare function transformBox(item: Readonly<{
21
+ xPt: number;
22
+ yPt: number;
23
+ widthPt: number;
24
+ heightPt: number;
25
+ }>, pageMatrix: Matrix): {
26
+ xPt: number;
27
+ yPt: number;
28
+ widthPt: number;
29
+ heightPt: number;
30
+ };
31
+ declare function convertRect(item: ExtractedRect, pageMatrix: Matrix): LayoutRect;
32
+ declare function convertEllipse(item: ExtractedEllipse, pageMatrix: Matrix): LayoutEllipse;
33
+ declare function convertLine(item: ExtractedLine, pageMatrix: Matrix): LayoutLine;
34
+ declare function transformSubpath(subpath: ExtractedSubpath, pageMatrix: Matrix): LayoutSubpath;
35
+ declare function convertPath(item: ExtractedPath, pageMatrix: Matrix): LayoutPath;
36
+ declare function imagePlacementFrom(matrix: Matrix): {
37
+ xPt: number;
38
+ yPt: number;
39
+ widthPt: number;
40
+ heightPt: number;
41
+ rotationDeg: number | undefined;
42
+ };
43
+ declare function registerExtractedImage(format: "png" | "jpeg", bytes: Uint8Array<ArrayBuffer>, widthPx: number, heightPx: number, images: Record<string, LayoutImageAsset>, original: ExtractedPdfImage["original"]): string;
44
+ declare function resolveCachedImageId(dict: PdfDict, raw: Uint8Array<ArrayBuffer>, images: Record<string, LayoutImageAsset>, cache: Map<PdfDict, string | null>, resolver: Readonly<PdfObjectResolver>, sink: PdfDiagnosticSink): string | undefined;
45
+ declare function convertImage(item: ExtractedImage, pageMatrix: Matrix, images: Record<string, LayoutImageAsset>, cache: Map<PdfDict, string | null>, resolver: Readonly<PdfObjectResolver>, sink: PdfDiagnosticSink): {
46
+ layer?: string | undefined;
47
+ xPt: number;
48
+ yPt: number;
49
+ widthPt: number;
50
+ heightPt: number;
51
+ rotationDeg: number | undefined;
52
+ kind: "image";
53
+ imageId: string;
54
+ } | undefined;
55
+ declare function readLinkAnnotations(page: PdfDict, pageMatrix: Matrix, resolver: Readonly<PdfObjectResolver>, destinationRegistry: DestinationRegistry): (LayoutLink | LayoutInternalLink)[];
56
+ declare function readPageNotes(page: PdfDict, resolver: Readonly<PdfObjectResolver>): string | undefined;
57
+ //#endregion
58
+ export { convertEllipse, convertExtractedItem, convertImage, convertLine, convertPath, convertRect, convertText, imagePlacementFrom, paintFields, readLinkAnnotations, readPageNotes, registerExtractedImage, resolveCachedImageId, transformBox, transformSubpath };