pdf-parser.js 5.2.26 → 5.2.27
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/dist/annotations.d.cts +2 -2
- package/dist/annotations.d.ts +2 -2
- package/dist/attachments.d.cts +2 -2
- package/dist/attachments.d.ts +2 -2
- package/dist/cff-bounds.cjs +31 -21
- package/dist/cff-bounds.js +31 -21
- package/dist/content-read.d.cts +1 -1
- package/dist/content-read.d.ts +1 -1
- package/dist/content-write.cjs +18 -12
- package/dist/content-write.d.cts +2 -2
- package/dist/content-write.d.ts +2 -2
- package/dist/content-write.js +18 -12
- package/dist/document.cjs +17 -11
- package/dist/document.d.cts +1 -1
- package/dist/document.d.ts +1 -1
- package/dist/document.js +17 -11
- package/dist/{embedded-font-Bnhh4juV.d.ts → embedded-font-ByD7ZiQS.d.ts} +1 -1
- package/dist/{embedded-font-CEf-zBCA.d.cts → embedded-font-DgVBedw6.d.cts} +1 -1
- package/dist/embedded-font-write.d.cts +2 -2
- package/dist/embedded-font-write.d.ts +2 -2
- package/dist/embedded-font.d.cts +1 -1
- package/dist/embedded-font.d.ts +1 -1
- package/dist/encrypt-write.d.cts +1 -1
- package/dist/encrypt-write.d.ts +1 -1
- package/dist/encrypt.d.cts +1 -1
- package/dist/encrypt.d.ts +1 -1
- package/dist/filters.cjs +6 -6
- package/dist/filters.d.cts +1 -1
- package/dist/filters.d.ts +1 -1
- package/dist/filters.js +6 -6
- package/dist/font-read.d.cts +1 -1
- package/dist/font-read.d.ts +1 -1
- package/dist/font-registry.d.cts +3 -3
- package/dist/font-registry.d.ts +3 -3
- package/dist/form.cjs +13 -8
- package/dist/form.d.cts +2 -2
- package/dist/form.d.ts +2 -2
- package/dist/form.js +13 -8
- package/dist/{glyf-contours-C0epBNqP.d.ts → glyf-contours-B1PsI9oA.d.ts} +1 -1
- package/dist/{glyf-contours-BRpvd0rt.d.cts → glyf-contours-NHBpgks-.d.cts} +1 -1
- package/dist/glyf-contours.d.cts +1 -1
- package/dist/glyf-contours.d.ts +1 -1
- package/dist/gsub-table.cjs +12 -8
- package/dist/gsub-table.js +12 -8
- package/dist/image/jpeg2000-codestream.cjs +17 -8
- package/dist/image/jpeg2000-codestream.js +17 -8
- package/dist/images-read.d.cts +2 -2
- package/dist/images-read.d.ts +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/interpret.cjs +29 -16
- package/dist/interpret.d.cts +1 -1
- package/dist/interpret.d.ts +1 -1
- package/dist/interpret.js +29 -16
- package/dist/math-font-write.d.cts +1 -1
- package/dist/math-font-write.d.ts +1 -1
- package/dist/names.cjs +7 -7
- package/dist/names.d.cts +2 -2
- package/dist/names.d.ts +2 -2
- package/dist/names.js +7 -7
- package/dist/navigation.cjs +6 -7
- package/dist/navigation.d.cts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/navigation.js +6 -7
- package/dist/{objects-B7HdMeWS.d.cts → objects-e2RS3-yT.d.cts} +3 -3
- package/dist/{objects-B7HdMeWS.d.ts → objects-e2RS3-yT.d.ts} +3 -3
- package/dist/objects.d.cts +1 -1
- package/dist/objects.d.ts +1 -1
- package/dist/optional-content.d.cts +2 -2
- package/dist/optional-content.d.ts +2 -2
- package/dist/ot-layout-common.cjs +18 -13
- package/dist/ot-layout-common.js +18 -13
- package/dist/parse.d.cts +1 -1
- package/dist/parse.d.ts +1 -1
- package/dist/predictors.d.cts +1 -1
- package/dist/predictors.d.ts +1 -1
- package/dist/raster.d.cts +8 -8
- package/dist/raster.d.ts +8 -8
- package/dist/read.cjs +12 -8
- package/dist/read.js +12 -8
- package/dist/serialize.d.cts +1 -1
- package/dist/serialize.d.ts +1 -1
- package/dist/sfnt-subset.d.cts +1 -1
- package/dist/sfnt-subset.d.ts +1 -1
- package/dist/structure.d.cts +2 -2
- package/dist/structure.d.ts +2 -2
- package/dist/text-layout.d.cts +1 -1
- package/dist/text-layout.d.ts +1 -1
- package/dist/tounicode.d.cts +1 -1
- package/dist/tounicode.d.ts +1 -1
- package/dist/write.d.cts +1 -1
- package/dist/write.d.ts +1 -1
- package/dist/xref.d.cts +1 -1
- package/dist/xref.d.ts +1 -1
- package/package.json +1 -1
package/dist/filters.cjs
CHANGED
|
@@ -211,21 +211,21 @@ function lzwDecode(data, earlyChange, sink) {
|
|
|
211
211
|
}
|
|
212
212
|
return Uint8Array.from(out);
|
|
213
213
|
}
|
|
214
|
+
const ASCII85_GROUP_BYTES = 4;
|
|
214
215
|
const ASCII85_ZERO_GROUP_MARKER = 122;
|
|
215
216
|
const ASCII85_END_MARKER = 126;
|
|
216
217
|
const ASCII85_MIN_DIGIT = 33;
|
|
217
218
|
const ASCII85_MAX_DIGIT = 117;
|
|
218
219
|
const ASCII85_MAX_DIGIT_VALUE = 84;
|
|
219
|
-
function
|
|
220
|
+
function ascii85GroupBytes(digits, byteCount) {
|
|
220
221
|
let value = 0;
|
|
221
222
|
for (const digit of digits) value = value * 85 + digit;
|
|
222
|
-
|
|
223
|
+
return [
|
|
223
224
|
value >>> 24 & 255,
|
|
224
225
|
value >>> 16 & 255,
|
|
225
226
|
value >>> 8 & 255,
|
|
226
227
|
value & 255
|
|
227
|
-
];
|
|
228
|
-
for (let i = 0; i < byteCount; i++) out.push(bytes[i]);
|
|
228
|
+
].slice(0, byteCount);
|
|
229
229
|
}
|
|
230
230
|
function ascii85Decode(data) {
|
|
231
231
|
const out = [];
|
|
@@ -243,14 +243,14 @@ function ascii85Decode(data) {
|
|
|
243
243
|
if (byte < ASCII85_MIN_DIGIT || byte > ASCII85_MAX_DIGIT) continue;
|
|
244
244
|
tuple.push(byte - ASCII85_MIN_DIGIT);
|
|
245
245
|
if (tuple.length === 5) {
|
|
246
|
-
|
|
246
|
+
out.push(...ascii85GroupBytes(tuple, ASCII85_GROUP_BYTES));
|
|
247
247
|
tuple = [];
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
250
|
if (tuple.length > 1) {
|
|
251
251
|
const padded = tuple.slice();
|
|
252
252
|
while (padded.length < 5) padded.push(ASCII85_MAX_DIGIT_VALUE);
|
|
253
|
-
|
|
253
|
+
out.push(...ascii85GroupBytes(padded, tuple.length - 1));
|
|
254
254
|
}
|
|
255
255
|
return Uint8Array.from(out);
|
|
256
256
|
}
|
package/dist/filters.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PdfDiagnosticSink } from "./diagnostics.cjs";
|
|
2
|
-
import { n as PdfDict, r as PdfObject } from "./objects-
|
|
2
|
+
import { n as PdfDict, r as PdfObject } from "./objects-e2RS3-yT.cjs";
|
|
3
3
|
//#region src/filters.d.ts
|
|
4
4
|
interface DecodedStream {
|
|
5
5
|
readonly bytes: Uint8Array<ArrayBuffer>;
|
package/dist/filters.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PdfDiagnosticSink } from "./diagnostics.js";
|
|
2
|
-
import { n as PdfDict, r as PdfObject } from "./objects-
|
|
2
|
+
import { n as PdfDict, r as PdfObject } from "./objects-e2RS3-yT.js";
|
|
3
3
|
//#region src/filters.d.ts
|
|
4
4
|
interface DecodedStream {
|
|
5
5
|
readonly bytes: Uint8Array<ArrayBuffer>;
|
package/dist/filters.js
CHANGED
|
@@ -210,21 +210,21 @@ function lzwDecode(data, earlyChange, sink) {
|
|
|
210
210
|
}
|
|
211
211
|
return Uint8Array.from(out);
|
|
212
212
|
}
|
|
213
|
+
const ASCII85_GROUP_BYTES = 4;
|
|
213
214
|
const ASCII85_ZERO_GROUP_MARKER = 122;
|
|
214
215
|
const ASCII85_END_MARKER = 126;
|
|
215
216
|
const ASCII85_MIN_DIGIT = 33;
|
|
216
217
|
const ASCII85_MAX_DIGIT = 117;
|
|
217
218
|
const ASCII85_MAX_DIGIT_VALUE = 84;
|
|
218
|
-
function
|
|
219
|
+
function ascii85GroupBytes(digits, byteCount) {
|
|
219
220
|
let value = 0;
|
|
220
221
|
for (const digit of digits) value = value * 85 + digit;
|
|
221
|
-
|
|
222
|
+
return [
|
|
222
223
|
value >>> 24 & 255,
|
|
223
224
|
value >>> 16 & 255,
|
|
224
225
|
value >>> 8 & 255,
|
|
225
226
|
value & 255
|
|
226
|
-
];
|
|
227
|
-
for (let i = 0; i < byteCount; i++) out.push(bytes[i]);
|
|
227
|
+
].slice(0, byteCount);
|
|
228
228
|
}
|
|
229
229
|
function ascii85Decode(data) {
|
|
230
230
|
const out = [];
|
|
@@ -242,14 +242,14 @@ function ascii85Decode(data) {
|
|
|
242
242
|
if (byte < ASCII85_MIN_DIGIT || byte > ASCII85_MAX_DIGIT) continue;
|
|
243
243
|
tuple.push(byte - ASCII85_MIN_DIGIT);
|
|
244
244
|
if (tuple.length === 5) {
|
|
245
|
-
|
|
245
|
+
out.push(...ascii85GroupBytes(tuple, ASCII85_GROUP_BYTES));
|
|
246
246
|
tuple = [];
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
if (tuple.length > 1) {
|
|
250
250
|
const padded = tuple.slice();
|
|
251
251
|
while (padded.length < 5) padded.push(ASCII85_MAX_DIGIT_VALUE);
|
|
252
|
-
|
|
252
|
+
out.push(...ascii85GroupBytes(padded, tuple.length - 1));
|
|
253
253
|
}
|
|
254
254
|
return Uint8Array.from(out);
|
|
255
255
|
}
|
package/dist/font-read.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PdfDiagnosticSink } from "./diagnostics.cjs";
|
|
2
|
-
import { n as PdfDict } from "./objects-
|
|
2
|
+
import { n as PdfDict } from "./objects-e2RS3-yT.cjs";
|
|
3
3
|
import { FontMetricsPort, PdfObjectResolver } from "./interpret.cjs";
|
|
4
4
|
//#region src/font-read.d.ts
|
|
5
5
|
interface VerticalGlyphMetrics {
|
package/dist/font-read.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PdfDiagnosticSink } from "./diagnostics.js";
|
|
2
|
-
import { n as PdfDict } from "./objects-
|
|
2
|
+
import { n as PdfDict } from "./objects-e2RS3-yT.js";
|
|
3
3
|
import { FontMetricsPort, PdfObjectResolver } from "./interpret.js";
|
|
4
4
|
//#region src/font-read.d.ts
|
|
5
5
|
interface VerticalGlyphMetrics {
|
package/dist/font-registry.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as StandardFontName } from "./afm-widths-CneRyu5l.cjs";
|
|
2
|
-
import { t as EmbeddedFace } from "./embedded-font-
|
|
2
|
+
import { t as EmbeddedFace } from "./embedded-font-DgVBedw6.cjs";
|
|
3
3
|
import { FontRegistryOptions, LayoutFont } from "document-schema.js";
|
|
4
4
|
//#region src/font-registry.d.ts
|
|
5
5
|
type ResolvedFace = {
|
|
@@ -11,9 +11,9 @@ type ResolvedFace = {
|
|
|
11
11
|
readonly matched: boolean;
|
|
12
12
|
};
|
|
13
13
|
interface FontRegistry {
|
|
14
|
-
resolve: (font: LayoutFont) => ResolvedFace;
|
|
14
|
+
resolve: (font: Readonly<LayoutFont>) => ResolvedFace;
|
|
15
15
|
}
|
|
16
16
|
declare function createFontRegistry(options?: FontRegistryOptions): FontRegistry;
|
|
17
|
-
declare function resolveFaceWithRegistry(registry: FontRegistry | undefined, font: LayoutFont): ResolvedFace;
|
|
17
|
+
declare function resolveFaceWithRegistry(registry: FontRegistry | undefined, font: Readonly<LayoutFont>): ResolvedFace;
|
|
18
18
|
//#endregion
|
|
19
19
|
export { FontRegistry, ResolvedFace, createFontRegistry, resolveFaceWithRegistry };
|
package/dist/font-registry.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as StandardFontName } from "./afm-widths-CneRyu5l.js";
|
|
2
|
-
import { t as EmbeddedFace } from "./embedded-font-
|
|
2
|
+
import { t as EmbeddedFace } from "./embedded-font-ByD7ZiQS.js";
|
|
3
3
|
import { FontRegistryOptions, LayoutFont } from "document-schema.js";
|
|
4
4
|
//#region src/font-registry.d.ts
|
|
5
5
|
type ResolvedFace = {
|
|
@@ -11,9 +11,9 @@ type ResolvedFace = {
|
|
|
11
11
|
readonly matched: boolean;
|
|
12
12
|
};
|
|
13
13
|
interface FontRegistry {
|
|
14
|
-
resolve: (font: LayoutFont) => ResolvedFace;
|
|
14
|
+
resolve: (font: Readonly<LayoutFont>) => ResolvedFace;
|
|
15
15
|
}
|
|
16
16
|
declare function createFontRegistry(options?: FontRegistryOptions): FontRegistry;
|
|
17
|
-
declare function resolveFaceWithRegistry(registry: FontRegistry | undefined, font: LayoutFont): ResolvedFace;
|
|
17
|
+
declare function resolveFaceWithRegistry(registry: FontRegistry | undefined, font: Readonly<LayoutFont>): ResolvedFace;
|
|
18
18
|
//#endregion
|
|
19
19
|
export { FontRegistry, ResolvedFace, createFontRegistry, resolveFaceWithRegistry };
|
package/dist/form.cjs
CHANGED
|
@@ -13,11 +13,14 @@ function readAcroForm(catalog, resolver, pageIndex, sink) {
|
|
|
13
13
|
const visited = /* @__PURE__ */ new Set();
|
|
14
14
|
for (const fieldRef of require_objects.asArray(resolver.resolve(require_objects.dictGet(acroForm, "Fields"))) ?? []) {
|
|
15
15
|
const fieldDict = resolver.resolveDict(fieldRef);
|
|
16
|
-
if (fieldDict !== void 0)
|
|
16
|
+
if (fieldDict !== void 0) {
|
|
17
|
+
const field = readField(fieldDict, "", resolver, pageIndex, sink, visited);
|
|
18
|
+
if (field !== void 0) fields.push(field);
|
|
19
|
+
}
|
|
17
20
|
}
|
|
18
21
|
return fields;
|
|
19
22
|
}
|
|
20
|
-
function readField(node, parentName, resolver, pageIndex, sink,
|
|
23
|
+
function readField(node, parentName, resolver, pageIndex, sink, visited) {
|
|
21
24
|
if (visited.has(node)) {
|
|
22
25
|
sink({
|
|
23
26
|
code: "pdf/form-field-cycle",
|
|
@@ -35,15 +38,17 @@ function readField(node, parentName, resolver, pageIndex, sink, out, visited) {
|
|
|
35
38
|
const children = [];
|
|
36
39
|
for (const kidRef of require_objects.asArray(resolver.resolve(require_objects.dictGet(node, "Kids"))) ?? []) {
|
|
37
40
|
const kid = resolver.resolveDict(kidRef);
|
|
38
|
-
if (kid !== void 0)
|
|
41
|
+
if (kid !== void 0) {
|
|
42
|
+
const child = readField(kid, name, resolver, pageIndex, sink, visited);
|
|
43
|
+
if (child !== void 0) children.push(child);
|
|
44
|
+
}
|
|
39
45
|
}
|
|
40
|
-
|
|
46
|
+
return {
|
|
41
47
|
name,
|
|
42
48
|
fieldType: "group",
|
|
43
49
|
widgets: [],
|
|
44
50
|
children
|
|
45
|
-
}
|
|
46
|
-
return;
|
|
51
|
+
};
|
|
47
52
|
}
|
|
48
53
|
const flags = require_objects.asNumber(resolver.resolve(require_objects.dictGet(node, "Ff"))) ?? 0;
|
|
49
54
|
const value = fieldValue(node, resolver);
|
|
@@ -60,7 +65,7 @@ function readField(node, parentName, resolver, pageIndex, sink, out, visited) {
|
|
|
60
65
|
const widget = widgetPlacement(node, pageIndex);
|
|
61
66
|
if (widget !== void 0) widgets.push(widget);
|
|
62
67
|
}
|
|
63
|
-
|
|
68
|
+
return {
|
|
64
69
|
name,
|
|
65
70
|
fieldType: mapFieldType(fieldType, flags),
|
|
66
71
|
...valueFields(fieldType, value),
|
|
@@ -69,7 +74,7 @@ function readField(node, parentName, resolver, pageIndex, sink, out, visited) {
|
|
|
69
74
|
...(flags & FLAG_READ_ONLY) !== 0 ? { readOnly: true } : {},
|
|
70
75
|
widgets,
|
|
71
76
|
children: []
|
|
72
|
-
}
|
|
77
|
+
};
|
|
73
78
|
}
|
|
74
79
|
function mapFieldType(fieldType, flags) {
|
|
75
80
|
if (fieldType === "Tx") return "text";
|
package/dist/form.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { PdfDiagnosticSink } from "./diagnostics.cjs";
|
|
2
|
-
import { n as PdfDict } from "./objects-
|
|
2
|
+
import { n as PdfDict } from "./objects-e2RS3-yT.cjs";
|
|
3
3
|
import { PdfObjectResolver } from "./interpret.cjs";
|
|
4
4
|
import { LayoutFormField } from "./layout.cjs";
|
|
5
5
|
import { PageIndexLookup } from "./navigation.cjs";
|
|
6
6
|
//#region src/form.d.ts
|
|
7
|
-
declare function readAcroForm(catalog: PdfDict, resolver: PdfObjectResolver
|
|
7
|
+
declare function readAcroForm(catalog: PdfDict, resolver: Readonly<PdfObjectResolver>, pageIndex: PageIndexLookup, sink: PdfDiagnosticSink): LayoutFormField[];
|
|
8
8
|
//#endregion
|
|
9
9
|
export { readAcroForm };
|
package/dist/form.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { PdfDiagnosticSink } from "./diagnostics.js";
|
|
2
|
-
import { n as PdfDict } from "./objects-
|
|
2
|
+
import { n as PdfDict } from "./objects-e2RS3-yT.js";
|
|
3
3
|
import { PdfObjectResolver } from "./interpret.js";
|
|
4
4
|
import { LayoutFormField } from "./layout.js";
|
|
5
5
|
import { PageIndexLookup } from "./navigation.js";
|
|
6
6
|
//#region src/form.d.ts
|
|
7
|
-
declare function readAcroForm(catalog: PdfDict, resolver: PdfObjectResolver
|
|
7
|
+
declare function readAcroForm(catalog: PdfDict, resolver: Readonly<PdfObjectResolver>, pageIndex: PageIndexLookup, sink: PdfDiagnosticSink): LayoutFormField[];
|
|
8
8
|
//#endregion
|
|
9
9
|
export { readAcroForm };
|
package/dist/form.js
CHANGED
|
@@ -12,11 +12,14 @@ function readAcroForm(catalog, resolver, pageIndex, sink) {
|
|
|
12
12
|
const visited = /* @__PURE__ */ new Set();
|
|
13
13
|
for (const fieldRef of asArray(resolver.resolve(dictGet(acroForm, "Fields"))) ?? []) {
|
|
14
14
|
const fieldDict = resolver.resolveDict(fieldRef);
|
|
15
|
-
if (fieldDict !== void 0)
|
|
15
|
+
if (fieldDict !== void 0) {
|
|
16
|
+
const field = readField(fieldDict, "", resolver, pageIndex, sink, visited);
|
|
17
|
+
if (field !== void 0) fields.push(field);
|
|
18
|
+
}
|
|
16
19
|
}
|
|
17
20
|
return fields;
|
|
18
21
|
}
|
|
19
|
-
function readField(node, parentName, resolver, pageIndex, sink,
|
|
22
|
+
function readField(node, parentName, resolver, pageIndex, sink, visited) {
|
|
20
23
|
if (visited.has(node)) {
|
|
21
24
|
sink({
|
|
22
25
|
code: "pdf/form-field-cycle",
|
|
@@ -34,15 +37,17 @@ function readField(node, parentName, resolver, pageIndex, sink, out, visited) {
|
|
|
34
37
|
const children = [];
|
|
35
38
|
for (const kidRef of asArray(resolver.resolve(dictGet(node, "Kids"))) ?? []) {
|
|
36
39
|
const kid = resolver.resolveDict(kidRef);
|
|
37
|
-
if (kid !== void 0)
|
|
40
|
+
if (kid !== void 0) {
|
|
41
|
+
const child = readField(kid, name, resolver, pageIndex, sink, visited);
|
|
42
|
+
if (child !== void 0) children.push(child);
|
|
43
|
+
}
|
|
38
44
|
}
|
|
39
|
-
|
|
45
|
+
return {
|
|
40
46
|
name,
|
|
41
47
|
fieldType: "group",
|
|
42
48
|
widgets: [],
|
|
43
49
|
children
|
|
44
|
-
}
|
|
45
|
-
return;
|
|
50
|
+
};
|
|
46
51
|
}
|
|
47
52
|
const flags = asNumber(resolver.resolve(dictGet(node, "Ff"))) ?? 0;
|
|
48
53
|
const value = fieldValue(node, resolver);
|
|
@@ -59,7 +64,7 @@ function readField(node, parentName, resolver, pageIndex, sink, out, visited) {
|
|
|
59
64
|
const widget = widgetPlacement(node, pageIndex);
|
|
60
65
|
if (widget !== void 0) widgets.push(widget);
|
|
61
66
|
}
|
|
62
|
-
|
|
67
|
+
return {
|
|
63
68
|
name,
|
|
64
69
|
fieldType: mapFieldType(fieldType, flags),
|
|
65
70
|
...valueFields(fieldType, value),
|
|
@@ -68,7 +73,7 @@ function readField(node, parentName, resolver, pageIndex, sink, out, visited) {
|
|
|
68
73
|
...(flags & FLAG_READ_ONLY) !== 0 ? { readOnly: true } : {},
|
|
69
74
|
widgets,
|
|
70
75
|
children: []
|
|
71
|
-
}
|
|
76
|
+
};
|
|
72
77
|
}
|
|
73
78
|
function mapFieldType(fieldType, flags) {
|
|
74
79
|
if (fieldType === "Tx") return "text";
|
|
@@ -8,6 +8,6 @@ interface GlyphContourPoint {
|
|
|
8
8
|
interface GlyphOutline {
|
|
9
9
|
readonly contours: readonly (readonly GlyphContourPoint[])[];
|
|
10
10
|
}
|
|
11
|
-
declare function decodeGlyphOutline(glyf: GlyfTable
|
|
11
|
+
declare function decodeGlyphOutline(glyf: Readonly<GlyfTable>, glyphId: number): GlyphOutline | undefined;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { GlyphOutline as n, decodeGlyphOutline as r, GlyphContourPoint as t };
|
|
@@ -8,6 +8,6 @@ interface GlyphContourPoint {
|
|
|
8
8
|
interface GlyphOutline {
|
|
9
9
|
readonly contours: readonly (readonly GlyphContourPoint[])[];
|
|
10
10
|
}
|
|
11
|
-
declare function decodeGlyphOutline(glyf: GlyfTable
|
|
11
|
+
declare function decodeGlyphOutline(glyf: Readonly<GlyfTable>, glyphId: number): GlyphOutline | undefined;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { GlyphOutline as n, decodeGlyphOutline as r, GlyphContourPoint as t };
|
package/dist/glyf-contours.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as GlyphOutline, r as decodeGlyphOutline, t as GlyphContourPoint } from "./glyf-contours-
|
|
1
|
+
import { n as GlyphOutline, r as decodeGlyphOutline, t as GlyphContourPoint } from "./glyf-contours-NHBpgks-.cjs";
|
|
2
2
|
export { GlyphContourPoint, GlyphOutline, decodeGlyphOutline };
|
package/dist/glyf-contours.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as GlyphOutline, r as decodeGlyphOutline, t as GlyphContourPoint } from "./glyf-contours-
|
|
1
|
+
import { n as GlyphOutline, r as decodeGlyphOutline, t as GlyphContourPoint } from "./glyf-contours-B1PsI9oA.js";
|
|
2
2
|
export { GlyphContourPoint, GlyphOutline, decodeGlyphOutline };
|
package/dist/gsub-table.cjs
CHANGED
|
@@ -193,7 +193,10 @@ function applyContextualRule(slots, inputSlots, records, lookupOf, skip, depth)
|
|
|
193
193
|
const lookup = lookupOf(record.lookupIndex);
|
|
194
194
|
if (lookup === void 0 || record.sequenceIndex >= inputSlots.length || depth >= MAX_LOOKUP_NESTING_DEPTH) return;
|
|
195
195
|
const target = visibleInputSlot(window, record.sequenceIndex, skip);
|
|
196
|
-
if (target !== void 0)
|
|
196
|
+
if (target !== void 0) {
|
|
197
|
+
const application = applyLookupAtSlot(window, target, lookup, depth + 1);
|
|
198
|
+
if (application !== void 0) window.splice(target, application.consumed, ...application.replacement);
|
|
199
|
+
}
|
|
197
200
|
}
|
|
198
201
|
return {
|
|
199
202
|
consumed: last - first + 1,
|
|
@@ -211,12 +214,8 @@ function visibleInputSlot(window, position, skip) {
|
|
|
211
214
|
function applyLookupAtSlot(slots, index, lookup, depth) {
|
|
212
215
|
for (const subtable of lookup.subtables) {
|
|
213
216
|
const application = subtable(slots, index, depth);
|
|
214
|
-
if (application !== void 0)
|
|
215
|
-
slots.splice(index, application.consumed, ...application.replacement);
|
|
216
|
-
return application.replacement.length;
|
|
217
|
-
}
|
|
217
|
+
if (application !== void 0) return application;
|
|
218
218
|
}
|
|
219
|
-
return 0;
|
|
220
219
|
}
|
|
221
220
|
const SUBST_LOOKUP_RECORD_SIZE = 4;
|
|
222
221
|
function readSubstLookupRecords(bytes, offset, count) {
|
|
@@ -526,8 +525,13 @@ function buildGsubShaper(font, options = {}) {
|
|
|
526
525
|
for (const lookup of appliedLookups) {
|
|
527
526
|
let slotIndex = 0;
|
|
528
527
|
while (slotIndex < slots.length) {
|
|
529
|
-
const
|
|
530
|
-
|
|
528
|
+
const application = applyLookupAtSlot(slots, slotIndex, lookup, 0);
|
|
529
|
+
if (application === void 0) {
|
|
530
|
+
slotIndex += 1;
|
|
531
|
+
continue;
|
|
532
|
+
}
|
|
533
|
+
slots.splice(slotIndex, application.consumed, ...application.replacement);
|
|
534
|
+
slotIndex += application.replacement.length !== 0 ? application.replacement.length : 1;
|
|
531
535
|
}
|
|
532
536
|
}
|
|
533
537
|
return {
|
package/dist/gsub-table.js
CHANGED
|
@@ -192,7 +192,10 @@ function applyContextualRule(slots, inputSlots, records, lookupOf, skip, depth)
|
|
|
192
192
|
const lookup = lookupOf(record.lookupIndex);
|
|
193
193
|
if (lookup === void 0 || record.sequenceIndex >= inputSlots.length || depth >= MAX_LOOKUP_NESTING_DEPTH) return;
|
|
194
194
|
const target = visibleInputSlot(window, record.sequenceIndex, skip);
|
|
195
|
-
if (target !== void 0)
|
|
195
|
+
if (target !== void 0) {
|
|
196
|
+
const application = applyLookupAtSlot(window, target, lookup, depth + 1);
|
|
197
|
+
if (application !== void 0) window.splice(target, application.consumed, ...application.replacement);
|
|
198
|
+
}
|
|
196
199
|
}
|
|
197
200
|
return {
|
|
198
201
|
consumed: last - first + 1,
|
|
@@ -210,12 +213,8 @@ function visibleInputSlot(window, position, skip) {
|
|
|
210
213
|
function applyLookupAtSlot(slots, index, lookup, depth) {
|
|
211
214
|
for (const subtable of lookup.subtables) {
|
|
212
215
|
const application = subtable(slots, index, depth);
|
|
213
|
-
if (application !== void 0)
|
|
214
|
-
slots.splice(index, application.consumed, ...application.replacement);
|
|
215
|
-
return application.replacement.length;
|
|
216
|
-
}
|
|
216
|
+
if (application !== void 0) return application;
|
|
217
217
|
}
|
|
218
|
-
return 0;
|
|
219
218
|
}
|
|
220
219
|
const SUBST_LOOKUP_RECORD_SIZE = 4;
|
|
221
220
|
function readSubstLookupRecords(bytes, offset, count) {
|
|
@@ -525,8 +524,13 @@ function buildGsubShaper(font, options = {}) {
|
|
|
525
524
|
for (const lookup of appliedLookups) {
|
|
526
525
|
let slotIndex = 0;
|
|
527
526
|
while (slotIndex < slots.length) {
|
|
528
|
-
const
|
|
529
|
-
|
|
527
|
+
const application = applyLookupAtSlot(slots, slotIndex, lookup, 0);
|
|
528
|
+
if (application === void 0) {
|
|
529
|
+
slotIndex += 1;
|
|
530
|
+
continue;
|
|
531
|
+
}
|
|
532
|
+
slots.splice(slotIndex, application.consumed, ...application.replacement);
|
|
533
|
+
slotIndex += application.replacement.length !== 0 ? application.replacement.length : 1;
|
|
530
534
|
}
|
|
531
535
|
}
|
|
532
536
|
return {
|
|
@@ -201,6 +201,15 @@ function freezeHeader(header) {
|
|
|
201
201
|
};
|
|
202
202
|
return base;
|
|
203
203
|
}
|
|
204
|
+
var CodestreamComments = class {
|
|
205
|
+
#texts = [];
|
|
206
|
+
add(text) {
|
|
207
|
+
this.#texts.push(text);
|
|
208
|
+
}
|
|
209
|
+
texts() {
|
|
210
|
+
return this.#texts;
|
|
211
|
+
}
|
|
212
|
+
};
|
|
204
213
|
function readHeaderSegment(marker, cursor, header, componentCount, comments) {
|
|
205
214
|
const length = cursor.uint16();
|
|
206
215
|
if (length < 2) throw new require_image_jpeg2000_errors.Jpeg2000ParseError(`marker segment 0x${marker.toString(16)} declares a length of ${String(length)}, which is shorter than the length field itself`);
|
|
@@ -220,7 +229,7 @@ function readHeaderSegment(marker, cursor, header, componentCount, comments) {
|
|
|
220
229
|
else if (marker === MARKER_COM) {
|
|
221
230
|
const registration = cursor.uint16();
|
|
222
231
|
const body = cursor.bytes(segmentEnd - cursor.position);
|
|
223
|
-
if (registration === 1) comments.
|
|
232
|
+
if (registration === 1) comments.add(Array.from(body, (byte) => String.fromCharCode(byte)).join(""));
|
|
224
233
|
}
|
|
225
234
|
cursor.position = segmentEnd;
|
|
226
235
|
}
|
|
@@ -236,7 +245,7 @@ function parseJpeg2000Codestream(data) {
|
|
|
236
245
|
const sizEnd = cursor.position + sizLength - 2;
|
|
237
246
|
const siz = readImageSize(cursor, sizEnd);
|
|
238
247
|
cursor.position = sizEnd;
|
|
239
|
-
const comments =
|
|
248
|
+
const comments = new CodestreamComments();
|
|
240
249
|
const main = emptyHeader();
|
|
241
250
|
const tileParts = [];
|
|
242
251
|
let sawEoc = false;
|
|
@@ -250,7 +259,7 @@ function parseJpeg2000Codestream(data) {
|
|
|
250
259
|
if (marker === MARKER_PPM) throw new require_image_jpeg2000_errors.Jpeg2000UnsupportedError("the codestream carries a PPM marker (packed packet headers in the main header), an organisation this decoder does not reassemble");
|
|
251
260
|
if (marker === MARKER_SOT) {
|
|
252
261
|
cursor.position -= 2;
|
|
253
|
-
readTilePart(cursor, siz.components.length,
|
|
262
|
+
tileParts.push(readTilePart(cursor, siz.components.length, comments));
|
|
254
263
|
continue;
|
|
255
264
|
}
|
|
256
265
|
if (marker === MARKER_SOD || marker === MARKER_SOC) throw new require_image_jpeg2000_errors.Jpeg2000ParseError(`unexpected marker 0x${marker.toString(16)} in the main header`);
|
|
@@ -264,13 +273,13 @@ function parseJpeg2000Codestream(data) {
|
|
|
264
273
|
siz,
|
|
265
274
|
main: freezeHeader(main),
|
|
266
275
|
tileParts,
|
|
267
|
-
comments,
|
|
276
|
+
comments: comments.texts(),
|
|
268
277
|
numTilesWide,
|
|
269
278
|
numTilesHigh,
|
|
270
279
|
truncated: !sawEoc
|
|
271
280
|
};
|
|
272
281
|
}
|
|
273
|
-
function readTilePart(cursor, componentCount,
|
|
282
|
+
function readTilePart(cursor, componentCount, comments) {
|
|
274
283
|
const sotStart = cursor.position;
|
|
275
284
|
cursor.uint16();
|
|
276
285
|
const lsot = cursor.uint16();
|
|
@@ -292,14 +301,14 @@ function readTilePart(cursor, componentCount, tileParts, comments) {
|
|
|
292
301
|
const dataEnd = Math.min(declaredEnd, cursor.data.length);
|
|
293
302
|
if (dataEnd < dataStart) throw new require_image_jpeg2000_errors.Jpeg2000ParseError("a tile-part declares a Psot shorter than its own header");
|
|
294
303
|
const trimmedEnd = trimTrailingEoc(cursor.data, dataEnd);
|
|
295
|
-
|
|
304
|
+
cursor.position = dataEnd;
|
|
305
|
+
return {
|
|
296
306
|
tileIndex,
|
|
297
307
|
partIndex,
|
|
298
308
|
header: freezeHeader(header),
|
|
299
309
|
dataStart,
|
|
300
310
|
dataEnd: trimmedEnd
|
|
301
|
-
}
|
|
302
|
-
cursor.position = dataEnd;
|
|
311
|
+
};
|
|
303
312
|
}
|
|
304
313
|
function trimTrailingEoc(data, end) {
|
|
305
314
|
if (data[end - 2] === 255 && data[end - 1] === 217) return end - 2;
|
|
@@ -200,6 +200,15 @@ function freezeHeader(header) {
|
|
|
200
200
|
};
|
|
201
201
|
return base;
|
|
202
202
|
}
|
|
203
|
+
var CodestreamComments = class {
|
|
204
|
+
#texts = [];
|
|
205
|
+
add(text) {
|
|
206
|
+
this.#texts.push(text);
|
|
207
|
+
}
|
|
208
|
+
texts() {
|
|
209
|
+
return this.#texts;
|
|
210
|
+
}
|
|
211
|
+
};
|
|
203
212
|
function readHeaderSegment(marker, cursor, header, componentCount, comments) {
|
|
204
213
|
const length = cursor.uint16();
|
|
205
214
|
if (length < 2) throw new Jpeg2000ParseError(`marker segment 0x${marker.toString(16)} declares a length of ${String(length)}, which is shorter than the length field itself`);
|
|
@@ -219,7 +228,7 @@ function readHeaderSegment(marker, cursor, header, componentCount, comments) {
|
|
|
219
228
|
else if (marker === MARKER_COM) {
|
|
220
229
|
const registration = cursor.uint16();
|
|
221
230
|
const body = cursor.bytes(segmentEnd - cursor.position);
|
|
222
|
-
if (registration === 1) comments.
|
|
231
|
+
if (registration === 1) comments.add(Array.from(body, (byte) => String.fromCharCode(byte)).join(""));
|
|
223
232
|
}
|
|
224
233
|
cursor.position = segmentEnd;
|
|
225
234
|
}
|
|
@@ -235,7 +244,7 @@ function parseJpeg2000Codestream(data) {
|
|
|
235
244
|
const sizEnd = cursor.position + sizLength - 2;
|
|
236
245
|
const siz = readImageSize(cursor, sizEnd);
|
|
237
246
|
cursor.position = sizEnd;
|
|
238
|
-
const comments =
|
|
247
|
+
const comments = new CodestreamComments();
|
|
239
248
|
const main = emptyHeader();
|
|
240
249
|
const tileParts = [];
|
|
241
250
|
let sawEoc = false;
|
|
@@ -249,7 +258,7 @@ function parseJpeg2000Codestream(data) {
|
|
|
249
258
|
if (marker === MARKER_PPM) throw new Jpeg2000UnsupportedError("the codestream carries a PPM marker (packed packet headers in the main header), an organisation this decoder does not reassemble");
|
|
250
259
|
if (marker === MARKER_SOT) {
|
|
251
260
|
cursor.position -= 2;
|
|
252
|
-
readTilePart(cursor, siz.components.length,
|
|
261
|
+
tileParts.push(readTilePart(cursor, siz.components.length, comments));
|
|
253
262
|
continue;
|
|
254
263
|
}
|
|
255
264
|
if (marker === MARKER_SOD || marker === MARKER_SOC) throw new Jpeg2000ParseError(`unexpected marker 0x${marker.toString(16)} in the main header`);
|
|
@@ -263,13 +272,13 @@ function parseJpeg2000Codestream(data) {
|
|
|
263
272
|
siz,
|
|
264
273
|
main: freezeHeader(main),
|
|
265
274
|
tileParts,
|
|
266
|
-
comments,
|
|
275
|
+
comments: comments.texts(),
|
|
267
276
|
numTilesWide,
|
|
268
277
|
numTilesHigh,
|
|
269
278
|
truncated: !sawEoc
|
|
270
279
|
};
|
|
271
280
|
}
|
|
272
|
-
function readTilePart(cursor, componentCount,
|
|
281
|
+
function readTilePart(cursor, componentCount, comments) {
|
|
273
282
|
const sotStart = cursor.position;
|
|
274
283
|
cursor.uint16();
|
|
275
284
|
const lsot = cursor.uint16();
|
|
@@ -291,14 +300,14 @@ function readTilePart(cursor, componentCount, tileParts, comments) {
|
|
|
291
300
|
const dataEnd = Math.min(declaredEnd, cursor.data.length);
|
|
292
301
|
if (dataEnd < dataStart) throw new Jpeg2000ParseError("a tile-part declares a Psot shorter than its own header");
|
|
293
302
|
const trimmedEnd = trimTrailingEoc(cursor.data, dataEnd);
|
|
294
|
-
|
|
303
|
+
cursor.position = dataEnd;
|
|
304
|
+
return {
|
|
295
305
|
tileIndex,
|
|
296
306
|
partIndex,
|
|
297
307
|
header: freezeHeader(header),
|
|
298
308
|
dataStart,
|
|
299
309
|
dataEnd: trimmedEnd
|
|
300
|
-
}
|
|
301
|
-
cursor.position = dataEnd;
|
|
310
|
+
};
|
|
302
311
|
}
|
|
303
312
|
function trimTrailingEoc(data, end) {
|
|
304
313
|
if (data[end - 2] === 255 && data[end - 1] === 217) return end - 2;
|
package/dist/images-read.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PdfDiagnosticSink } from "./diagnostics.cjs";
|
|
2
|
-
import { n as PdfDict } from "./objects-
|
|
2
|
+
import { n as PdfDict } from "./objects-e2RS3-yT.cjs";
|
|
3
3
|
import { PdfObjectResolver } from "./interpret.cjs";
|
|
4
4
|
//#region src/images-read.d.ts
|
|
5
5
|
interface ExtractedPdfImage {
|
|
@@ -13,6 +13,6 @@ interface ExtractedPdfImage {
|
|
|
13
13
|
readonly globalsBytes?: Uint8Array<ArrayBuffer>;
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
declare function readImageXObject(dict: PdfDict, raw: Uint8Array<ArrayBuffer>, resolver: PdfObjectResolver
|
|
16
|
+
declare function readImageXObject(dict: PdfDict, raw: Uint8Array<ArrayBuffer>, resolver: Readonly<PdfObjectResolver>, sink: PdfDiagnosticSink): ExtractedPdfImage | undefined;
|
|
17
17
|
//#endregion
|
|
18
18
|
export { ExtractedPdfImage, readImageXObject };
|
package/dist/images-read.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PdfDiagnosticSink } from "./diagnostics.js";
|
|
2
|
-
import { n as PdfDict } from "./objects-
|
|
2
|
+
import { n as PdfDict } from "./objects-e2RS3-yT.js";
|
|
3
3
|
import { PdfObjectResolver } from "./interpret.js";
|
|
4
4
|
//#region src/images-read.d.ts
|
|
5
5
|
interface ExtractedPdfImage {
|
|
@@ -13,6 +13,6 @@ interface ExtractedPdfImage {
|
|
|
13
13
|
readonly globalsBytes?: Uint8Array<ArrayBuffer>;
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
declare function readImageXObject(dict: PdfDict, raw: Uint8Array<ArrayBuffer>, resolver: PdfObjectResolver
|
|
16
|
+
declare function readImageXObject(dict: PdfDict, raw: Uint8Array<ArrayBuffer>, resolver: Readonly<PdfObjectResolver>, sink: PdfDiagnosticSink): ExtractedPdfImage | undefined;
|
|
17
17
|
//#endregion
|
|
18
18
|
export { ExtractedPdfImage, readImageXObject };
|
package/dist/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ import { NOOP_DIAGNOSTIC_SINK, PdfDiagnostic, PdfDiagnosticSeverity, PdfDiagnost
|
|
|
3
3
|
import { LAYOUT_FORMAT_VERSION, LayoutAnnotation, LayoutAnnotationQuad, LayoutAnnotationQuadSchema, LayoutAnnotationSchema, LayoutAttachment, LayoutAttachmentSchema, LayoutDestination, LayoutDestinationSchema, LayoutDestinationTarget, LayoutDestinationTargetSchema, LayoutDocument, LayoutDocumentSchema, LayoutEllipse, LayoutEllipseSchema, LayoutFormField, LayoutFormFieldSchema, LayoutFormWidget, LayoutFormWidgetSchema, LayoutImage, LayoutImageAsset, LayoutImageAssetSchema, LayoutImageSchema, LayoutInternalLink, LayoutInternalLinkSchema, LayoutItem, LayoutItemSchema, LayoutLayer, LayoutLayerSchema, LayoutLine, LayoutLineSchema, LayoutLink, LayoutLinkSchema, LayoutOutlineItem, LayoutOutlineItemSchema, LayoutPage, LayoutPageSchema, LayoutPath, LayoutPathSchema, LayoutPathSegment, LayoutPathSegmentSchema, LayoutRect, LayoutRectSchema, LayoutStructureElement, LayoutStructureElementSchema, LayoutSubpath, LayoutSubpathSchema, LayoutText, LayoutTextSchema } from "./layout.cjs";
|
|
4
4
|
import { t as GlyphInkBounds } from "./glyph-bounds-BV_Z40KS.cjs";
|
|
5
5
|
import { PdfBytesSchema, pdfCodec } from "./codec.cjs";
|
|
6
|
-
import { n as EmbeddedFaceMetrics, r as EmbeddedFaceSubstitution, t as EmbeddedFace } from "./embedded-font-
|
|
6
|
+
import { n as EmbeddedFaceMetrics, r as EmbeddedFaceSubstitution, t as EmbeddedFace } from "./embedded-font-DgVBedw6.cjs";
|
|
7
7
|
import { WinAnsiSubstitution } from "./winansi.cjs";
|
|
8
8
|
import { PdfEncryptionError, PdfEncryptionOptions, PdfEncryptionPermissions, PdfEncryptionScheme } from "./encrypt-write.cjs";
|
|
9
9
|
import { FontFace, FontFaceParseError, readFontFace } from "./font-face.cjs";
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { NOOP_DIAGNOSTIC_SINK, PdfDiagnostic, PdfDiagnosticSeverity, PdfDiagnost
|
|
|
3
3
|
import { LAYOUT_FORMAT_VERSION, LayoutAnnotation, LayoutAnnotationQuad, LayoutAnnotationQuadSchema, LayoutAnnotationSchema, LayoutAttachment, LayoutAttachmentSchema, LayoutDestination, LayoutDestinationSchema, LayoutDestinationTarget, LayoutDestinationTargetSchema, LayoutDocument, LayoutDocumentSchema, LayoutEllipse, LayoutEllipseSchema, LayoutFormField, LayoutFormFieldSchema, LayoutFormWidget, LayoutFormWidgetSchema, LayoutImage, LayoutImageAsset, LayoutImageAssetSchema, LayoutImageSchema, LayoutInternalLink, LayoutInternalLinkSchema, LayoutItem, LayoutItemSchema, LayoutLayer, LayoutLayerSchema, LayoutLine, LayoutLineSchema, LayoutLink, LayoutLinkSchema, LayoutOutlineItem, LayoutOutlineItemSchema, LayoutPage, LayoutPageSchema, LayoutPath, LayoutPathSchema, LayoutPathSegment, LayoutPathSegmentSchema, LayoutRect, LayoutRectSchema, LayoutStructureElement, LayoutStructureElementSchema, LayoutSubpath, LayoutSubpathSchema, LayoutText, LayoutTextSchema } from "./layout.js";
|
|
4
4
|
import { t as GlyphInkBounds } from "./glyph-bounds-BV_Z40KS.js";
|
|
5
5
|
import { PdfBytesSchema, pdfCodec } from "./codec.js";
|
|
6
|
-
import { n as EmbeddedFaceMetrics, r as EmbeddedFaceSubstitution, t as EmbeddedFace } from "./embedded-font-
|
|
6
|
+
import { n as EmbeddedFaceMetrics, r as EmbeddedFaceSubstitution, t as EmbeddedFace } from "./embedded-font-ByD7ZiQS.js";
|
|
7
7
|
import { WinAnsiSubstitution } from "./winansi.js";
|
|
8
8
|
import { PdfEncryptionError, PdfEncryptionOptions, PdfEncryptionPermissions, PdfEncryptionScheme } from "./encrypt-write.js";
|
|
9
9
|
import { FontFace, FontFaceParseError, readFontFace } from "./font-face.js";
|