pdf-parser.js 5.2.25 → 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/afm-widths.cjs +1 -1
- package/dist/afm-widths.js +1 -1
- 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/builtin-encoding.cjs +1 -1
- package/dist/builtin-encoding.d.cts +2 -2
- package/dist/builtin-encoding.d.ts +2 -2
- package/dist/builtin-encoding.js +1 -1
- package/dist/cff-bounds.cjs +31 -21
- package/dist/cff-bounds.d.cts +1 -1
- package/dist/cff-bounds.d.ts +1 -1
- package/dist/cff-bounds.js +31 -21
- package/dist/cff.d.cts +1 -1
- package/dist/cff.d.ts +1 -1
- package/dist/cmap-table.d.cts +1 -1
- package/dist/cmap-table.d.ts +1 -1
- package/dist/cmap.d.cts +1 -1
- package/dist/cmap.d.ts +1 -1
- package/dist/content-read.d.cts +1 -1
- package/dist/content-read.d.ts +1 -1
- package/dist/content-write.cjs +19 -13
- package/dist/content-write.d.cts +3 -3
- package/dist/content-write.d.ts +3 -3
- package/dist/content-write.js +19 -13
- package/dist/document.cjs +17 -11
- package/dist/document.d.cts +5 -5
- package/dist/document.d.ts +5 -5
- package/dist/document.js +17 -11
- package/dist/{embedded-font-BRhZfEN2.d.ts → embedded-font-ByD7ZiQS.d.ts} +4 -4
- package/dist/{embedded-font-DJUn9kMH.d.cts → embedded-font-DgVBedw6.d.cts} +4 -4
- package/dist/embedded-font-write.d.cts +2 -2
- package/dist/embedded-font-write.d.ts +2 -2
- package/dist/embedded-font.cjs +1 -1
- package/dist/embedded-font.d.cts +1 -1
- package/dist/embedded-font.d.ts +1 -1
- package/dist/embedded-font.js +1 -1
- package/dist/encoding.cjs +1 -1
- package/dist/encoding.js +1 -1
- package/dist/encrypt-write.d.cts +3 -3
- package/dist/encrypt-write.d.ts +3 -3
- package/dist/encrypt.d.cts +3 -3
- package/dist/encrypt.d.ts +3 -3
- 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.cjs +1 -1
- package/dist/font-read.d.cts +3 -3
- package/dist/font-read.d.ts +3 -3
- package/dist/font-read.js +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/gdef-table.d.cts +3 -3
- package/dist/gdef-table.d.ts +3 -3
- package/dist/{glyf-vMGtP1pb.d.ts → glyf-Bv1katwK.d.ts} +4 -4
- package/dist/{glyf-nXC-IDRW.d.cts → glyf-DFyknMrW.d.cts} +4 -4
- package/dist/{glyf-contours-OSdG6Edr.d.ts → glyf-contours-B1PsI9oA.d.ts} +2 -2
- package/dist/{glyf-contours-zRQbj-Yp.d.cts → glyf-contours-NHBpgks-.d.cts} +2 -2
- package/dist/glyf-contours.d.cts +1 -1
- package/dist/glyf-contours.d.ts +1 -1
- package/dist/glyf.d.cts +1 -1
- package/dist/glyf.d.ts +1 -1
- package/dist/gsub-table.cjs +13 -9
- package/dist/gsub-table.js +13 -9
- package/dist/hmtx-table.d.cts +1 -1
- package/dist/hmtx-table.d.ts +1 -1
- package/dist/image/jbig2-generic.cjs +2 -2
- package/dist/image/jbig2-generic.js +2 -2
- package/dist/image/jpeg2000-codestream.cjs +17 -8
- package/dist/image/jpeg2000-codestream.js +17 -8
- package/dist/image/jpeg2000-tagtree.cjs +1 -1
- package/dist/image/jpeg2000-tagtree.js +1 -1
- package/dist/images-read.d.cts +2 -2
- package/dist/images-read.d.ts +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/interpret.cjs +31 -18
- package/dist/interpret.d.cts +5 -5
- package/dist/interpret.d.ts +5 -5
- package/dist/interpret.js +31 -18
- package/dist/math-content-write.cjs +3 -3
- package/dist/math-content-write.js +3 -3
- package/dist/math-font-write.d.cts +1 -1
- package/dist/math-font-write.d.ts +1 -1
- package/dist/math-font.d.cts +4 -4
- package/dist/math-font.d.ts +4 -4
- package/dist/measure.cjs +1 -1
- package/dist/measure.js +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 +5 -5
- package/dist/navigation.d.ts +5 -5
- package/dist/navigation.js +6 -7
- package/dist/{objects-B7HdMeWS.d.ts → objects-e2RS3-yT.d.cts} +3 -3
- package/dist/{objects-B7HdMeWS.d.cts → 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.d.cts +2 -2
- package/dist/ot-layout-common.d.ts +2 -2
- package/dist/ot-layout-common.js +18 -13
- package/dist/parse.cjs +5 -0
- package/dist/parse.d.cts +3 -2
- package/dist/parse.d.ts +3 -2
- package/dist/parse.js +5 -1
- package/dist/predictors.d.cts +1 -1
- package/dist/predictors.d.ts +1 -1
- package/dist/raster.cjs +10 -40
- package/dist/raster.d.cts +11 -11
- package/dist/raster.d.ts +11 -11
- package/dist/raster.js +10 -40
- 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.cjs +4 -4
- package/dist/structure.d.cts +2 -2
- package/dist/structure.d.ts +2 -2
- package/dist/structure.js +4 -4
- 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/winansi.cjs +1 -1
- package/dist/winansi.js +1 -1
- package/dist/write.cjs +4 -4
- package/dist/write.d.cts +1 -1
- package/dist/write.d.ts +1 -1
- package/dist/write.js +4 -4
- package/dist/xref.d.cts +1 -1
- package/dist/xref.d.ts +1 -1
- package/package.json +2 -2
- package/dist/{afm-widths-BTu0IDp2.cjs → afm-widths-BYiX2L9D.cjs} +1 -1
- package/dist/{afm-widths-De_QMWgC.js → afm-widths-blUDDjlI.js} +1 -1
|
@@ -18,10 +18,10 @@ interface CompositeComponent {
|
|
|
18
18
|
}
|
|
19
19
|
interface GlyfTable {
|
|
20
20
|
readonly numGlyphs: number;
|
|
21
|
-
glyphBytes(glyphId: number)
|
|
22
|
-
glyphHeader(glyphId: number)
|
|
23
|
-
compositeComponents(glyphId: number)
|
|
24
|
-
glyphInkBounds(glyphId: number)
|
|
21
|
+
glyphBytes: (glyphId: number) => Uint8Array<ArrayBuffer> | undefined;
|
|
22
|
+
glyphHeader: (glyphId: number) => GlyphHeader | undefined;
|
|
23
|
+
compositeComponents: (glyphId: number) => readonly CompositeComponent[] | undefined;
|
|
24
|
+
glyphInkBounds: (glyphId: number) => GlyphInkBounds | undefined;
|
|
25
25
|
}
|
|
26
26
|
interface GlyfOptions {
|
|
27
27
|
readonly numGlyphs: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as GlyfTable } from "./glyf-
|
|
1
|
+
import { r as GlyfTable } from "./glyf-Bv1katwK.js";
|
|
2
2
|
//#region src/glyf-contours.d.ts
|
|
3
3
|
interface GlyphContourPoint {
|
|
4
4
|
readonly x: number;
|
|
@@ -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 };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as GlyfTable } from "./glyf-
|
|
1
|
+
import { r as GlyfTable } from "./glyf-DFyknMrW.cjs";
|
|
2
2
|
//#region src/glyf-contours.d.ts
|
|
3
3
|
interface GlyphContourPoint {
|
|
4
4
|
readonly x: number;
|
|
@@ -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/glyf.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as parseGlyf, i as GlyphHeader, n as GlyfOptions, o as parseLoca, r as GlyfTable, t as CompositeComponent } from "./glyf-
|
|
1
|
+
import { a as parseGlyf, i as GlyphHeader, n as GlyfOptions, o as parseLoca, r as GlyfTable, t as CompositeComponent } from "./glyf-DFyknMrW.cjs";
|
|
2
2
|
export { CompositeComponent, GlyfOptions, GlyfTable, GlyphHeader, parseGlyf, parseLoca };
|
package/dist/glyf.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as parseGlyf, i as GlyphHeader, n as GlyfOptions, o as parseLoca, r as GlyfTable, t as CompositeComponent } from "./glyf-
|
|
1
|
+
import { a as parseGlyf, i as GlyphHeader, n as GlyfOptions, o as parseLoca, r as GlyfTable, t as CompositeComponent } from "./glyf-Bv1katwK.js";
|
|
2
2
|
export { CompositeComponent, GlyfOptions, GlyfTable, GlyphHeader, parseGlyf, parseLoca };
|
package/dist/gsub-table.cjs
CHANGED
|
@@ -3,6 +3,7 @@ const require_sfnt = require("./sfnt.cjs");
|
|
|
3
3
|
const require_ot_layout_common = require("./ot-layout-common.cjs");
|
|
4
4
|
const require_gdef_table = require("./gdef-table.cjs");
|
|
5
5
|
//#region src/gsub-table.ts
|
|
6
|
+
const constantZeroClassDef = () => 0;
|
|
6
7
|
const DEFAULT_GSUB_FEATURE_TAGS = [
|
|
7
8
|
"liga",
|
|
8
9
|
"rlig",
|
|
@@ -192,7 +193,10 @@ function applyContextualRule(slots, inputSlots, records, lookupOf, skip, depth)
|
|
|
192
193
|
const lookup = lookupOf(record.lookupIndex);
|
|
193
194
|
if (lookup === void 0 || record.sequenceIndex >= inputSlots.length || depth >= MAX_LOOKUP_NESTING_DEPTH) return;
|
|
194
195
|
const target = visibleInputSlot(window, record.sequenceIndex, skip);
|
|
195
|
-
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
|
+
}
|
|
196
200
|
}
|
|
197
201
|
return {
|
|
198
202
|
consumed: last - first + 1,
|
|
@@ -210,12 +214,8 @@ function visibleInputSlot(window, position, skip) {
|
|
|
210
214
|
function applyLookupAtSlot(slots, index, lookup, depth) {
|
|
211
215
|
for (const subtable of lookup.subtables) {
|
|
212
216
|
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
|
-
}
|
|
217
|
+
if (application !== void 0) return application;
|
|
217
218
|
}
|
|
218
|
-
return 0;
|
|
219
219
|
}
|
|
220
220
|
const SUBST_LOOKUP_RECORD_SIZE = 4;
|
|
221
221
|
function readSubstLookupRecords(bytes, offset, count) {
|
|
@@ -422,7 +422,6 @@ function parseContextualSubtable(bytes, chained, subtableOffset, skip, lookupOf)
|
|
|
422
422
|
}, skip, lookupOf);
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
|
-
const constantZeroClassDef = () => 0;
|
|
426
425
|
function findScriptOffset(bytes, scriptListOffset) {
|
|
427
426
|
if (!require_sfnt.hasBytes(bytes, scriptListOffset, 2)) return;
|
|
428
427
|
const scriptCount = require_sfnt.u16(bytes, scriptListOffset);
|
|
@@ -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
|
@@ -2,6 +2,7 @@ import { hasBytes, i16, sfntTableBytes, u16, u32 } from "./sfnt.js";
|
|
|
2
2
|
import { parseClassDef, parseCoverage } from "./ot-layout-common.js";
|
|
3
3
|
import { parseGdefTable } from "./gdef-table.js";
|
|
4
4
|
//#region src/gsub-table.ts
|
|
5
|
+
const constantZeroClassDef = () => 0;
|
|
5
6
|
const DEFAULT_GSUB_FEATURE_TAGS = [
|
|
6
7
|
"liga",
|
|
7
8
|
"rlig",
|
|
@@ -191,7 +192,10 @@ function applyContextualRule(slots, inputSlots, records, lookupOf, skip, depth)
|
|
|
191
192
|
const lookup = lookupOf(record.lookupIndex);
|
|
192
193
|
if (lookup === void 0 || record.sequenceIndex >= inputSlots.length || depth >= MAX_LOOKUP_NESTING_DEPTH) return;
|
|
193
194
|
const target = visibleInputSlot(window, record.sequenceIndex, skip);
|
|
194
|
-
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
|
+
}
|
|
195
199
|
}
|
|
196
200
|
return {
|
|
197
201
|
consumed: last - first + 1,
|
|
@@ -209,12 +213,8 @@ function visibleInputSlot(window, position, skip) {
|
|
|
209
213
|
function applyLookupAtSlot(slots, index, lookup, depth) {
|
|
210
214
|
for (const subtable of lookup.subtables) {
|
|
211
215
|
const application = subtable(slots, index, depth);
|
|
212
|
-
if (application !== void 0)
|
|
213
|
-
slots.splice(index, application.consumed, ...application.replacement);
|
|
214
|
-
return application.replacement.length;
|
|
215
|
-
}
|
|
216
|
+
if (application !== void 0) return application;
|
|
216
217
|
}
|
|
217
|
-
return 0;
|
|
218
218
|
}
|
|
219
219
|
const SUBST_LOOKUP_RECORD_SIZE = 4;
|
|
220
220
|
function readSubstLookupRecords(bytes, offset, count) {
|
|
@@ -421,7 +421,6 @@ function parseContextualSubtable(bytes, chained, subtableOffset, skip, lookupOf)
|
|
|
421
421
|
}, skip, lookupOf);
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
|
-
const constantZeroClassDef = () => 0;
|
|
425
424
|
function findScriptOffset(bytes, scriptListOffset) {
|
|
426
425
|
if (!hasBytes(bytes, scriptListOffset, 2)) return;
|
|
427
426
|
const scriptCount = u16(bytes, scriptListOffset);
|
|
@@ -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 {
|
package/dist/hmtx-table.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as SfntFont } from "./sfnt-V08bb5ut.cjs";
|
|
2
2
|
//#region src/hmtx-table.d.ts
|
|
3
3
|
interface HmtxTable {
|
|
4
|
-
advanceWidth(glyphId: number)
|
|
4
|
+
advanceWidth: (glyphId: number) => number;
|
|
5
5
|
}
|
|
6
6
|
declare function parseHmtx(font: SfntFont): HmtxTable;
|
|
7
7
|
//#endregion
|
package/dist/hmtx-table.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as SfntFont } from "./sfnt-V08bb5ut.js";
|
|
2
2
|
//#region src/hmtx-table.d.ts
|
|
3
3
|
interface HmtxTable {
|
|
4
|
-
advanceWidth(glyphId: number)
|
|
4
|
+
advanceWidth: (glyphId: number) => number;
|
|
5
5
|
}
|
|
6
6
|
declare function parseHmtx(font: SfntFont): HmtxTable;
|
|
7
7
|
//#endregion
|
|
@@ -91,14 +91,14 @@ function resolveTemplate(template) {
|
|
|
91
91
|
if (positions === void 0) throw new require_image_jbig2_errors.Jbig2UnsupportedError(`generic region declares GBTEMPLATE ${String(template)}, which is outside the 0-3 range T.88 6.2.5.3 defines`);
|
|
92
92
|
return positions;
|
|
93
93
|
}
|
|
94
|
-
function flattenTemplate(positions,
|
|
94
|
+
function flattenTemplate(positions, atPixels) {
|
|
95
95
|
const dx = new Int32Array(positions.length);
|
|
96
96
|
const dy = new Int32Array(positions.length);
|
|
97
97
|
positions.forEach((position, i) => {
|
|
98
98
|
const offset = position.kind === "fixed" ? {
|
|
99
99
|
x: position.dx,
|
|
100
100
|
y: position.dy
|
|
101
|
-
} :
|
|
101
|
+
} : atPixels[position.index] ?? {
|
|
102
102
|
x: 0,
|
|
103
103
|
y: 0
|
|
104
104
|
};
|
|
@@ -90,14 +90,14 @@ function resolveTemplate(template) {
|
|
|
90
90
|
if (positions === void 0) throw new Jbig2UnsupportedError(`generic region declares GBTEMPLATE ${String(template)}, which is outside the 0-3 range T.88 6.2.5.3 defines`);
|
|
91
91
|
return positions;
|
|
92
92
|
}
|
|
93
|
-
function flattenTemplate(positions,
|
|
93
|
+
function flattenTemplate(positions, atPixels) {
|
|
94
94
|
const dx = new Int32Array(positions.length);
|
|
95
95
|
const dy = new Int32Array(positions.length);
|
|
96
96
|
positions.forEach((position, i) => {
|
|
97
97
|
const offset = position.kind === "fixed" ? {
|
|
98
98
|
x: position.dx,
|
|
99
99
|
y: position.dy
|
|
100
|
-
} :
|
|
100
|
+
} : atPixels[position.index] ?? {
|
|
101
101
|
x: 0,
|
|
102
102
|
y: 0
|
|
103
103
|
};
|
|
@@ -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;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_image_jpeg2000_errors = require("./jpeg2000-errors.cjs");
|
|
3
3
|
//#region src/image/jpeg2000-tagtree.ts
|
|
4
|
+
const SENTINEL_VALUE = 2147483647;
|
|
4
5
|
var PacketBitReader = class {
|
|
5
6
|
data;
|
|
6
7
|
end;
|
|
@@ -99,7 +100,6 @@ var TagTree = class {
|
|
|
99
100
|
return this.value[y * (this.levelWidths[0] ?? 1) + x] ?? SENTINEL_VALUE;
|
|
100
101
|
}
|
|
101
102
|
};
|
|
102
|
-
const SENTINEL_VALUE = 2147483647;
|
|
103
103
|
//#endregion
|
|
104
104
|
exports.PacketBitReader = PacketBitReader;
|
|
105
105
|
exports.TagTree = TagTree;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Jpeg2000ParseError } from "./jpeg2000-errors.js";
|
|
2
2
|
//#region src/image/jpeg2000-tagtree.ts
|
|
3
|
+
const SENTINEL_VALUE = 2147483647;
|
|
3
4
|
var PacketBitReader = class {
|
|
4
5
|
data;
|
|
5
6
|
end;
|
|
@@ -98,6 +99,5 @@ var TagTree = class {
|
|
|
98
99
|
return this.value[y * (this.levelWidths[0] ?? 1) + x] ?? SENTINEL_VALUE;
|
|
99
100
|
}
|
|
100
101
|
};
|
|
101
|
-
const SENTINEL_VALUE = 2147483647;
|
|
102
102
|
//#endregion
|
|
103
103
|
export { PacketBitReader, TagTree };
|
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.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_afm_widths = require("./afm-widths-
|
|
2
|
+
const require_afm_widths = require("./afm-widths-BYiX2L9D.cjs");
|
|
3
3
|
const require_image_ccitt = require("./image/ccitt.cjs");
|
|
4
4
|
const require_image_jbig2_errors = require("./image/jbig2-errors.cjs");
|
|
5
5
|
const require_image_jbig2 = require("./image/jbig2.cjs");
|
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";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as STANDARD_METRICS } from "./afm-widths-
|
|
1
|
+
import { t as STANDARD_METRICS } from "./afm-widths-blUDDjlI.js";
|
|
2
2
|
import { decodeCcittFax } from "./image/ccitt.js";
|
|
3
3
|
import { Jbig2ParseError, Jbig2UnsupportedError } from "./image/jbig2-errors.js";
|
|
4
4
|
import { decodeJbig2Embedded } from "./image/jbig2.js";
|
package/dist/interpret.cjs
CHANGED
|
@@ -274,17 +274,33 @@ function classifyShape(subpaths, paint, style) {
|
|
|
274
274
|
if (subpaths.length !== 1 || subpath === void 0) return;
|
|
275
275
|
return detectRect(subpath, paint) ?? detectEllipse(subpath, paint) ?? detectLine(subpath, paint, style);
|
|
276
276
|
}
|
|
277
|
+
var MarkedContentStack = class {
|
|
278
|
+
#frames;
|
|
279
|
+
constructor(seed = []) {
|
|
280
|
+
this.#frames = [...seed];
|
|
281
|
+
}
|
|
282
|
+
open(frame) {
|
|
283
|
+
this.#frames.push(frame);
|
|
284
|
+
}
|
|
285
|
+
close() {
|
|
286
|
+
this.#frames.pop();
|
|
287
|
+
}
|
|
288
|
+
inScope(key) {
|
|
289
|
+
for (let i = this.#frames.length - 1; i >= 0; i--) {
|
|
290
|
+
const frame = this.#frames[i];
|
|
291
|
+
if (frame !== void 0 && key in frame) return frame[key];
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
};
|
|
277
295
|
function interpretContentStream(bytes, resources, context) {
|
|
278
|
-
|
|
279
|
-
runContentStream(bytes, resources, {
|
|
296
|
+
return runContentStream(bytes, resources, {
|
|
280
297
|
ctm: require_matrix.IDENTITY_MATRIX,
|
|
281
298
|
fillColor: document_schema_js.COLOR_BLACK,
|
|
282
299
|
strokeColor: document_schema_js.COLOR_BLACK,
|
|
283
300
|
lineWidth: DEFAULT_LINE_WIDTH_PT,
|
|
284
301
|
dashArray: [],
|
|
285
302
|
...initialTextParameters()
|
|
286
|
-
}, context,
|
|
287
|
-
return items;
|
|
303
|
+
}, context, 0, new MarkedContentStack());
|
|
288
304
|
}
|
|
289
305
|
function lastPointOf(subpath) {
|
|
290
306
|
const last = subpath.segments[subpath.segments.length - 1];
|
|
@@ -296,19 +312,15 @@ function lastPointOf(subpath) {
|
|
|
296
312
|
y: last.yPt
|
|
297
313
|
};
|
|
298
314
|
}
|
|
299
|
-
function runContentStream(bytes, resources, initialState, context,
|
|
315
|
+
function runContentStream(bytes, resources, initialState, context, depth, markedContent) {
|
|
316
|
+
const items = [];
|
|
300
317
|
const operations = require_content_read.readContentStream(bytes, context.sink);
|
|
301
318
|
const gsStack = [];
|
|
302
319
|
let gs = initialState;
|
|
303
320
|
let text = defaultTextObjectState();
|
|
304
321
|
let pathSubpaths = [];
|
|
305
322
|
let currentSubpath;
|
|
306
|
-
const inScope = (key) =>
|
|
307
|
-
for (let i = markedContent.length - 1; i >= 0; i--) {
|
|
308
|
-
const frame = markedContent[i];
|
|
309
|
-
if (frame !== void 0 && key in frame) return frame[key];
|
|
310
|
-
}
|
|
311
|
-
};
|
|
323
|
+
const inScope = (key) => markedContent.inScope(key);
|
|
312
324
|
const pushItem = (item) => {
|
|
313
325
|
if (item.kind === "text") {
|
|
314
326
|
const layer = item.layerName ?? inScope("layerName");
|
|
@@ -487,10 +499,10 @@ function runContentStream(bytes, resources, initialState, context, items, depth,
|
|
|
487
499
|
...vertical ? { vertical: true } : {}
|
|
488
500
|
});
|
|
489
501
|
};
|
|
490
|
-
const showText = (
|
|
502
|
+
const showText = (textBytes) => {
|
|
491
503
|
showTextArray([{
|
|
492
504
|
kind: "string",
|
|
493
|
-
bytes,
|
|
505
|
+
bytes: textBytes,
|
|
494
506
|
hex: false
|
|
495
507
|
}]);
|
|
496
508
|
};
|
|
@@ -541,10 +553,10 @@ function runContentStream(bytes, resources, initialState, context, items, depth,
|
|
|
541
553
|
};
|
|
542
554
|
const formLayer = ownLayer ?? inScope("layerName");
|
|
543
555
|
const formMcid = require_objects.dictGet(xobj.dict, "StructParents") !== void 0 ? void 0 : inScope("mcid");
|
|
544
|
-
runContentStream(decoded.bytes, formResources, formState, context,
|
|
556
|
+
for (const formItem of runContentStream(decoded.bytes, formResources, formState, context, depth + 1, new MarkedContentStack([{
|
|
545
557
|
...formLayer !== void 0 ? { layerName: formLayer } : {},
|
|
546
558
|
...formMcid !== void 0 ? { mcid: formMcid } : {}
|
|
547
|
-
}]);
|
|
559
|
+
}]))) items.push(formItem);
|
|
548
560
|
}
|
|
549
561
|
};
|
|
550
562
|
for (const token of operations) {
|
|
@@ -843,18 +855,19 @@ function runContentStream(bytes, resources, initialState, context, items, depth,
|
|
|
843
855
|
...layerName !== void 0 ? { layerName } : {},
|
|
844
856
|
...markedContentScopeProps(props)
|
|
845
857
|
};
|
|
846
|
-
markedContent.
|
|
858
|
+
markedContent.open(depth === 0 ? scopeProps : {
|
|
847
859
|
...scopeProps,
|
|
848
860
|
mcid: void 0
|
|
849
861
|
});
|
|
850
862
|
break;
|
|
851
863
|
}
|
|
852
864
|
case "BMC":
|
|
853
|
-
markedContent.
|
|
865
|
+
markedContent.open({});
|
|
854
866
|
break;
|
|
855
|
-
case "EMC": markedContent.
|
|
867
|
+
case "EMC": markedContent.close();
|
|
856
868
|
}
|
|
857
869
|
}
|
|
870
|
+
return items;
|
|
858
871
|
}
|
|
859
872
|
//#endregion
|
|
860
873
|
exports.interpretContentStream = interpretContentStream;
|
package/dist/interpret.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PdfDiagnosticSink } from "./diagnostics.cjs";
|
|
2
2
|
import { r as Matrix } from "./matrix-B7_SBKQ5.cjs";
|
|
3
|
-
import { n as PdfDict, r as PdfObject } from "./objects-
|
|
3
|
+
import { n as PdfDict, r as PdfObject } from "./objects-e2RS3-yT.cjs";
|
|
4
4
|
import { Color, ContentStrokeStyle } from "document-schema.js";
|
|
5
5
|
//#region src/interpret.d.ts
|
|
6
6
|
interface ExtractedTextRun {
|
|
@@ -106,12 +106,12 @@ interface GlyphAdvance {
|
|
|
106
106
|
readonly vertical?: VerticalGlyphAdvance;
|
|
107
107
|
}
|
|
108
108
|
interface FontMetricsPort {
|
|
109
|
-
glyphAdvance(fontResourceName: string, resources: PdfDict, codes: Uint8Array<ArrayBuffer>, byteOffset: number)
|
|
110
|
-
isVertical(fontResourceName: string, resources: PdfDict)
|
|
109
|
+
glyphAdvance: (fontResourceName: string, resources: PdfDict, codes: Uint8Array<ArrayBuffer>, byteOffset: number) => GlyphAdvance | undefined;
|
|
110
|
+
isVertical: (fontResourceName: string, resources: PdfDict) => boolean;
|
|
111
111
|
}
|
|
112
112
|
interface PdfObjectResolver {
|
|
113
|
-
resolve(obj: PdfObject | undefined)
|
|
114
|
-
resolveDict(obj: PdfObject | undefined)
|
|
113
|
+
resolve: (obj: PdfObject | undefined) => PdfObject | undefined;
|
|
114
|
+
resolveDict: (obj: PdfObject | undefined) => PdfDict | undefined;
|
|
115
115
|
}
|
|
116
116
|
interface InterpretContext {
|
|
117
117
|
readonly fontMetrics: FontMetricsPort;
|
package/dist/interpret.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PdfDiagnosticSink } from "./diagnostics.js";
|
|
2
2
|
import { r as Matrix } from "./matrix-B7_SBKQ5.js";
|
|
3
|
-
import { n as PdfDict, r as PdfObject } from "./objects-
|
|
3
|
+
import { n as PdfDict, r as PdfObject } from "./objects-e2RS3-yT.js";
|
|
4
4
|
import { Color, ContentStrokeStyle } from "document-schema.js";
|
|
5
5
|
//#region src/interpret.d.ts
|
|
6
6
|
interface ExtractedTextRun {
|
|
@@ -106,12 +106,12 @@ interface GlyphAdvance {
|
|
|
106
106
|
readonly vertical?: VerticalGlyphAdvance;
|
|
107
107
|
}
|
|
108
108
|
interface FontMetricsPort {
|
|
109
|
-
glyphAdvance(fontResourceName: string, resources: PdfDict, codes: Uint8Array<ArrayBuffer>, byteOffset: number)
|
|
110
|
-
isVertical(fontResourceName: string, resources: PdfDict)
|
|
109
|
+
glyphAdvance: (fontResourceName: string, resources: PdfDict, codes: Uint8Array<ArrayBuffer>, byteOffset: number) => GlyphAdvance | undefined;
|
|
110
|
+
isVertical: (fontResourceName: string, resources: PdfDict) => boolean;
|
|
111
111
|
}
|
|
112
112
|
interface PdfObjectResolver {
|
|
113
|
-
resolve(obj: PdfObject | undefined)
|
|
114
|
-
resolveDict(obj: PdfObject | undefined)
|
|
113
|
+
resolve: (obj: PdfObject | undefined) => PdfObject | undefined;
|
|
114
|
+
resolveDict: (obj: PdfObject | undefined) => PdfDict | undefined;
|
|
115
115
|
}
|
|
116
116
|
interface InterpretContext {
|
|
117
117
|
readonly fontMetrics: FontMetricsPort;
|