pdf-codec 5.7.0 → 5.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/font-read.cjs +17 -6
- package/dist/font-read.js +17 -6
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{interpret-BeMKZGBm.js → interpret-DI8JCCEE.js} +35 -58
- package/dist/{interpret-2_N_lh0h.cjs → interpret-EqQSNqHD.cjs} +42 -65
- package/dist/interpret-colors.cjs +1 -1
- package/dist/interpret-colors.js +1 -1
- package/dist/interpret-state.cjs +67 -0
- package/dist/interpret-state.d.cts +53 -0
- package/dist/interpret-state.d.ts +53 -0
- package/dist/interpret-state.js +60 -0
- package/dist/interpret.cjs +1 -1
- package/dist/interpret.js +1 -1
- package/dist/{raster-B8i3Tgjj.cjs → raster-2avl8Qpk.cjs} +2 -2
- package/dist/{raster-CIc6ot36.js → raster-dqtea8ku.js} +2 -2
- package/dist/raster-text.cjs +1 -1
- package/dist/raster-text.js +1 -1
- package/dist/raster.cjs +1 -1
- package/dist/raster.js +1 -1
- package/dist/read.cjs +1 -1
- package/dist/read.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -283,7 +283,7 @@ The package is layered from generic primitives outward to the codec itself:
|
|
|
283
283
|
- **Embedded text faces**: `embedded-font.ts` (parses one TrueType-outline face's metrics and `GPOS` pair kerning, and `encodeForShowEmbedded` — the single code path both measurement and text-showing go through so encoding and measuring cannot disagree). Every geometry field is converted into PDF's 1000-units-per-em glyph space. `embedded-font-write.ts` builds the `/Type0`/`/CIDFontType2`/`/FontDescriptor`/`/FontFile2`/ToUnicode group, with `/CIDToGIDMap /Identity` written explicitly and `/Length1` set to the **uncompressed** subset length. Its subset tag is a CRC32 over the face's PostScript name and glyph-ID list, so identical input yields byte-identical output.
|
|
284
284
|
- **ToUnicode CMaps**: `tounicode.ts`, shared by both embedded-font writers — a character code → Unicode code point mapping written as a bfchar CMap (9.10.3), with supplementary-plane code points encoded as UTF-16BE surrogate pairs and entries emitted in blocks of at most 100.
|
|
285
285
|
- **CFF reading**: `cff.ts` (shared `INDEX`/`DICT` container structures), `cff-bounds.ts` (a Type 2 charstring interpreter computing each glyph's tight ink bounding box by tracking the current point through every path operator and solving each cubic's real extrema from the roots of its derivative — a path walker, not a rasteriser; verified against the vendored STIX Two Math font's whole 5,543-glyph repertoire, matching fontTools' `BoundsPen` to within 0.01 design units). `cff-probe.ts` reads a bare CFF program's header/Name INDEX/Top DICT to detect the `ROS` operator defining a CID-keyed font — the guard a future source-embedded-font phase needs before it can trust CID == GID against an arbitrary caller-supplied font.
|
|
286
|
-
- **Read**: `lexer.ts`/`parse.ts` (byte tokenizer and tokens → `PdfObject`), `filters.ts`/`predictors.ts` (Flate/LZW/ASCII85/ASCIIHex/RunLength/CCITTFax, TIFF/PNG predictors), `xref.ts`/`document.ts` (classic and cross-reference-stream resolution, object streams, `/Prev` chains, linear-scan recovery, the page tree with attribute inheritance), `encrypt.ts` (standard security handler: `/Encrypt` parsing, empty-user-password key derivation and `/U` verification, per-object keys, transparent string/stream decryption), `content-read.ts`/`interpret.ts` (content-stream tokenizer and graphics/text state machine, form-XObject recursion, general vector-path tracking), `cmap.ts`/`font-style.ts`/`font-read.ts` (`/ToUnicode` CMaps, font-dictionary resolution), `builtin-encoding.ts` (a font's own built-in encoding, read out of the embedded program itself — see [Text extraction and font encodings](#text-extraction-and-font-encodings)), `images-read.ts` (Image XObjects → PNG/JPEG bytes), `names.ts` (the document-level name-tree walker: one flattening pass for every `/Names` tenant), `navigation.ts` (named destinations from `/Dests` and `/Names` `/Dests`, reader-minted entries for direct destination arrays, and the `/Outlines` bookmark tree), `attachments.ts` (embedded files from the name tree, `/FileAttachment` filespecs, and `/AF`), `optional-content.ts` (`/OCProperties` groups and default-configuration visibility, plus the `/OC`-to-name resolution `interpret.ts` stamps onto span items), `annotations.ts` (sticky notes, FreeText, the `/QuadPoints` markup family, and residue for the opaque kinds), `form.ts` (the AcroForm field tree), `structure.ts` (the tagged-PDF `/StructTreeRoot` element tree with `/RoleMap` resolution and `/ClassMap` attribute merging, plus the `/ParentTree` walk that resolves each `(page, MCID)` pair to the owning element `read.ts` stamps onto an item), `xmp.ts` (a bounded Dublin Core extractor for the `/Metadata` packet), `pdf-text.ts` (PDF string/date scalar decoding), `read.ts` (`readPdf`, assembling all of the above into a `LayoutDocument`).
|
|
286
|
+
- **Read**: `lexer.ts`/`parse.ts` (byte tokenizer and tokens → `PdfObject`), `filters.ts`/`predictors.ts` (Flate/LZW/ASCII85/ASCIIHex/RunLength/CCITTFax, TIFF/PNG predictors), `xref.ts`/`document.ts` (classic and cross-reference-stream resolution, object streams, `/Prev` chains, linear-scan recovery, the page tree with attribute inheritance), `encrypt.ts` (standard security handler: `/Encrypt` parsing, empty-user-password key derivation and `/U` verification, per-object keys, transparent string/stream decryption), `content-read.ts`/`interpret.ts`/`interpret-state.ts` (content-stream tokenizer and graphics/text state machine, with the state records and the per-glyph displacement arithmetic in the last, form-XObject recursion, general vector-path tracking), `cmap.ts`/`font-style.ts`/`font-read.ts` (`/ToUnicode` CMaps, font-dictionary resolution), `builtin-encoding.ts` (a font's own built-in encoding, read out of the embedded program itself — see [Text extraction and font encodings](#text-extraction-and-font-encodings)), `images-read.ts` (Image XObjects → PNG/JPEG bytes), `names.ts` (the document-level name-tree walker: one flattening pass for every `/Names` tenant), `navigation.ts` (named destinations from `/Dests` and `/Names` `/Dests`, reader-minted entries for direct destination arrays, and the `/Outlines` bookmark tree), `attachments.ts` (embedded files from the name tree, `/FileAttachment` filespecs, and `/AF`), `optional-content.ts` (`/OCProperties` groups and default-configuration visibility, plus the `/OC`-to-name resolution `interpret.ts` stamps onto span items), `annotations.ts` (sticky notes, FreeText, the `/QuadPoints` markup family, and residue for the opaque kinds), `form.ts` (the AcroForm field tree), `structure.ts` (the tagged-PDF `/StructTreeRoot` element tree with `/RoleMap` resolution and `/ClassMap` attribute merging, plus the `/ParentTree` walk that resolves each `(page, MCID)` pair to the owning element `read.ts` stamps onto an item), `xmp.ts` (a bounded Dublin Core extractor for the `/Metadata` packet), `pdf-text.ts` (PDF string/date scalar decoding), `read.ts` (`readPdf`, assembling all of the above into a `LayoutDocument`).
|
|
287
287
|
- **Raster**: `raster.ts` — the `PageRasteriser` port and `renderPdfPage` (#1198): re-walks one page through `interpretContentStream` (the same interpreter `readPdf` runs), recomputes the page's crop/rotation geometry (test-pinned to agree with `readPdf` bit for bit, since the `clipPt` contract rides on it), and drives a caller-supplied rasteriser with device-space draw ops — rect fills, filled/stroked vector paths, affine-placed images, and text as filled glyph-outline paths resolved from the page's own embedded sfnt programs (`glyf-contours.ts`'s decoded contours through the run's text matrices, per-glyph advances corrected against the run's exact end matrix). Optional-content layers the default configuration leaves OFF are not drawn; faces with no sfnt outlines are refused by name. No canvas dependency, no backend, no OCR/vision/network — the port is pure data plus callbacks, so `pdf-raster-cpu` (or a browser canvas wrapper) implements it elsewhere.
|
|
288
288
|
- `codec.ts` — `pdfCodec`, a `z.codec()` pair over `readPdf`/`writePdf`, plus a standalone local copy of the `%PDF-` header check.
|
|
289
289
|
- **`src/test-support/`** — hand-built PDF fixtures (`pdf.ts`) built by literal byte/string concatenation and deliberately importing NOTHING from this package's own writer (a fixture built by `writePdf` would let a writer bug hide from the corresponding reader test). `encrypted-pdfs.ts` applies the same principle: real PDFs encrypted by [qpdf](https://qpdf.sourceforge.io/), embedded as base64, so a bug in key derivation cannot cancel out between write and read halves. `fonts.ts` holds the real vendored Carlito and Caladea faces as raw sfnt bytes, and asserts values read out of the `.ttf` files by a standalone script with a bare `DataView`, not by this package's own parsers — external cross-checks rather than a parser's output compared against itself.
|
|
@@ -334,7 +334,7 @@ Reading a program's built-in encoding is what stops a symbol-encoded subset —
|
|
|
334
334
|
|
|
335
335
|
## Grouping text runs into lines and words
|
|
336
336
|
|
|
337
|
-
`readPdf` reports one positioned run per text-showing operator, and a PDF says nothing about lines or words: a line of prose can arrive as one run, as one run per word, or as one run per glyph, entirely at the producer's discretion. `groupPdfTextRuns` turns those runs back into lines of words, and `pdf-codec/text-group` serves it without the write half or the vendored fonts, alongside `pdf-codec/read`.
|
|
337
|
+
`readPdf` reports one positioned run per text-showing operator, split wherever the operator itself opens a gap at least a word space wide between two of its glyphs (a `TJ` adjustment, a character spacing `Tc`, or the two summed, since a producer can set one against the other) or steps the next glyph back past the start of the one before it (an equation drawn back and forth across its line), so a run's glyphs always advance along the line, and a PDF says nothing about lines or words: a line of prose can arrive as one run, as one run per word, or as one run per glyph, entirely at the producer's discretion. `groupPdfTextRuns` turns those runs back into lines of words, and `pdf-codec/text-group` serves it without the write half or the vendored fonts, alongside `pdf-codec/read`.
|
|
338
338
|
|
|
339
339
|
```ts
|
|
340
340
|
import { readPdf } from "pdf-codec/read";
|
package/dist/font-read.cjs
CHANGED
|
@@ -64,6 +64,17 @@ function readToUnicodeCMap(fontDict, context) {
|
|
|
64
64
|
const decoded = require_filters.decodeStream(stream.raw, stream.dict, context.sink);
|
|
65
65
|
return require_cmap.parseToUnicodeCMap(decoded.bytes, context.sink);
|
|
66
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Reads an array-valued font dictionary entry through the document's resolver, with each of its elements resolved too.
|
|
69
|
+
*
|
|
70
|
+
* ISO 32000-1 7.3.10 lets any array, and any element of one, be an indirect object, and producers do write `/Widths`, `/DescendantFonts` and `/W` that way. Read without resolving, such an entry is a reference rather than an array and reads as absent, so a composite font loses its descendant and every glyph takes the default width.
|
|
71
|
+
* @param value - the entry as the dictionary holds it, a direct array or a reference to one
|
|
72
|
+
* @param context - the font read whose resolver follows references
|
|
73
|
+
* @returns the array with its elements resolved, or undefined when the entry is absent or not an array
|
|
74
|
+
*/
|
|
75
|
+
function resolvedArray(value, context) {
|
|
76
|
+
return require_objects.asArray(context.resolver.resolve(value))?.map((item) => context.resolver.resolve(item) ?? item);
|
|
77
|
+
}
|
|
67
78
|
function buildSimpleFont(fontDict, context) {
|
|
68
79
|
const baseFont = require_objects.asName(require_objects.dictGet(fontDict, "BaseFont")) ?? "Helvetica";
|
|
69
80
|
const descriptor = context.resolver.resolveDict(require_objects.dictGet(fontDict, "FontDescriptor"));
|
|
@@ -71,7 +82,7 @@ function buildSimpleFont(fontDict, context) {
|
|
|
71
82
|
const { baseFamily, bold, italic } = require_font_style.styleFromBaseFontName(baseFont, styleFlags);
|
|
72
83
|
const symbolic = styleFlags.symbolic ?? false;
|
|
73
84
|
const builtinGlyphName = builtinSymbolGlyphNameLookup(baseFamily);
|
|
74
|
-
const widthsArr =
|
|
85
|
+
const widthsArr = resolvedArray(require_objects.dictGet(fontDict, "Widths"), context);
|
|
75
86
|
const firstChar = require_objects.asNumber(require_objects.dictGet(fontDict, "FirstChar")) ?? 0;
|
|
76
87
|
const missingWidth = (descriptor !== void 0 ? require_objects.asNumber(require_objects.dictGet(descriptor, "MissingWidth")) : void 0) ?? 0;
|
|
77
88
|
let widthOf;
|
|
@@ -108,7 +119,7 @@ function buildSimpleFont(fontDict, context) {
|
|
|
108
119
|
severity: "info",
|
|
109
120
|
message: `base encoding "${baseEncodingName}" has no dedicated table here and is approximated as WinAnsiEncoding`
|
|
110
121
|
});
|
|
111
|
-
const differencesMap = readDifferencesMap(encodingDict !== void 0 ?
|
|
122
|
+
const differencesMap = readDifferencesMap(encodingDict !== void 0 ? resolvedArray(require_objects.dictGet(encodingDict, "Differences"), context) : void 0);
|
|
112
123
|
const programEncoding = lazyFontProgram(descriptor, context);
|
|
113
124
|
const symbolEncoded = symbolic || builtinGlyphName !== void 0;
|
|
114
125
|
const byGlyphName = (source) => (code) => {
|
|
@@ -256,17 +267,17 @@ function readsVertically(fontDict, context) {
|
|
|
256
267
|
}
|
|
257
268
|
function buildCompositeFont(fontDict, context) {
|
|
258
269
|
const baseFont = require_objects.asName(require_objects.dictGet(fontDict, "BaseFont")) ?? "Helvetica";
|
|
259
|
-
const descendants =
|
|
270
|
+
const descendants = resolvedArray(require_objects.dictGet(fontDict, "DescendantFonts"), context);
|
|
260
271
|
const descendantDict = descendants !== void 0 ? context.resolver.resolveDict(descendants[0]) : void 0;
|
|
261
272
|
const descriptor = descendantDict !== void 0 ? context.resolver.resolveDict(require_objects.dictGet(descendantDict, "FontDescriptor")) : void 0;
|
|
262
273
|
const { baseFamily, bold, italic } = require_font_style.styleFromBaseFontName(baseFont, styleFlagsFromDescriptor(descriptor));
|
|
263
274
|
const dw = descendantDict !== void 0 ? require_objects.asNumber(require_objects.dictGet(descendantDict, "DW")) ?? DEFAULT_CID_WIDTH : DEFAULT_CID_WIDTH;
|
|
264
|
-
const widthMap = readCidWidths(descendantDict !== void 0 ?
|
|
275
|
+
const widthMap = readCidWidths(descendantDict !== void 0 ? resolvedArray(require_objects.dictGet(descendantDict, "W"), context) : void 0);
|
|
265
276
|
const widthOf = (cid) => widthMap.get(cid) ?? dw;
|
|
266
|
-
const dw2 = descendantDict !== void 0 ?
|
|
277
|
+
const dw2 = descendantDict !== void 0 ? resolvedArray(require_objects.dictGet(descendantDict, "DW2"), context) : void 0;
|
|
267
278
|
const defaultPositionY = (dw2?.length === DW2_ENTRY_COUNT ? require_objects.asNumber(dw2[0]) : void 0) ?? DEFAULT_VERTICAL_POSITION_Y;
|
|
268
279
|
const defaultDisplacementY = (dw2?.length === DW2_ENTRY_COUNT ? require_objects.asNumber(dw2[1]) : void 0) ?? DEFAULT_VERTICAL_DISPLACEMENT_Y;
|
|
269
|
-
const verticalMap = readCidVerticalMetrics(descendantDict !== void 0 ?
|
|
280
|
+
const verticalMap = readCidVerticalMetrics(descendantDict !== void 0 ? resolvedArray(require_objects.dictGet(descendantDict, "W2"), context) : void 0);
|
|
270
281
|
const verticalMetricsOf = (cid) => {
|
|
271
282
|
const entry = verticalMap.get(cid);
|
|
272
283
|
return {
|
package/dist/font-read.js
CHANGED
|
@@ -63,6 +63,17 @@ function readToUnicodeCMap(fontDict, context) {
|
|
|
63
63
|
const decoded = decodeStream(stream.raw, stream.dict, context.sink);
|
|
64
64
|
return parseToUnicodeCMap(decoded.bytes, context.sink);
|
|
65
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Reads an array-valued font dictionary entry through the document's resolver, with each of its elements resolved too.
|
|
68
|
+
*
|
|
69
|
+
* ISO 32000-1 7.3.10 lets any array, and any element of one, be an indirect object, and producers do write `/Widths`, `/DescendantFonts` and `/W` that way. Read without resolving, such an entry is a reference rather than an array and reads as absent, so a composite font loses its descendant and every glyph takes the default width.
|
|
70
|
+
* @param value - the entry as the dictionary holds it, a direct array or a reference to one
|
|
71
|
+
* @param context - the font read whose resolver follows references
|
|
72
|
+
* @returns the array with its elements resolved, or undefined when the entry is absent or not an array
|
|
73
|
+
*/
|
|
74
|
+
function resolvedArray(value, context) {
|
|
75
|
+
return asArray(context.resolver.resolve(value))?.map((item) => context.resolver.resolve(item) ?? item);
|
|
76
|
+
}
|
|
66
77
|
function buildSimpleFont(fontDict, context) {
|
|
67
78
|
const baseFont = asName(dictGet(fontDict, "BaseFont")) ?? "Helvetica";
|
|
68
79
|
const descriptor = context.resolver.resolveDict(dictGet(fontDict, "FontDescriptor"));
|
|
@@ -70,7 +81,7 @@ function buildSimpleFont(fontDict, context) {
|
|
|
70
81
|
const { baseFamily, bold, italic } = styleFromBaseFontName(baseFont, styleFlags);
|
|
71
82
|
const symbolic = styleFlags.symbolic ?? false;
|
|
72
83
|
const builtinGlyphName = builtinSymbolGlyphNameLookup(baseFamily);
|
|
73
|
-
const widthsArr =
|
|
84
|
+
const widthsArr = resolvedArray(dictGet(fontDict, "Widths"), context);
|
|
74
85
|
const firstChar = asNumber(dictGet(fontDict, "FirstChar")) ?? 0;
|
|
75
86
|
const missingWidth = (descriptor !== void 0 ? asNumber(dictGet(descriptor, "MissingWidth")) : void 0) ?? 0;
|
|
76
87
|
let widthOf;
|
|
@@ -107,7 +118,7 @@ function buildSimpleFont(fontDict, context) {
|
|
|
107
118
|
severity: "info",
|
|
108
119
|
message: `base encoding "${baseEncodingName}" has no dedicated table here and is approximated as WinAnsiEncoding`
|
|
109
120
|
});
|
|
110
|
-
const differencesMap = readDifferencesMap(encodingDict !== void 0 ?
|
|
121
|
+
const differencesMap = readDifferencesMap(encodingDict !== void 0 ? resolvedArray(dictGet(encodingDict, "Differences"), context) : void 0);
|
|
111
122
|
const programEncoding = lazyFontProgram(descriptor, context);
|
|
112
123
|
const symbolEncoded = symbolic || builtinGlyphName !== void 0;
|
|
113
124
|
const byGlyphName = (source) => (code) => {
|
|
@@ -255,17 +266,17 @@ function readsVertically(fontDict, context) {
|
|
|
255
266
|
}
|
|
256
267
|
function buildCompositeFont(fontDict, context) {
|
|
257
268
|
const baseFont = asName(dictGet(fontDict, "BaseFont")) ?? "Helvetica";
|
|
258
|
-
const descendants =
|
|
269
|
+
const descendants = resolvedArray(dictGet(fontDict, "DescendantFonts"), context);
|
|
259
270
|
const descendantDict = descendants !== void 0 ? context.resolver.resolveDict(descendants[0]) : void 0;
|
|
260
271
|
const descriptor = descendantDict !== void 0 ? context.resolver.resolveDict(dictGet(descendantDict, "FontDescriptor")) : void 0;
|
|
261
272
|
const { baseFamily, bold, italic } = styleFromBaseFontName(baseFont, styleFlagsFromDescriptor(descriptor));
|
|
262
273
|
const dw = descendantDict !== void 0 ? asNumber(dictGet(descendantDict, "DW")) ?? DEFAULT_CID_WIDTH : DEFAULT_CID_WIDTH;
|
|
263
|
-
const widthMap = readCidWidths(descendantDict !== void 0 ?
|
|
274
|
+
const widthMap = readCidWidths(descendantDict !== void 0 ? resolvedArray(dictGet(descendantDict, "W"), context) : void 0);
|
|
264
275
|
const widthOf = (cid) => widthMap.get(cid) ?? dw;
|
|
265
|
-
const dw2 = descendantDict !== void 0 ?
|
|
276
|
+
const dw2 = descendantDict !== void 0 ? resolvedArray(dictGet(descendantDict, "DW2"), context) : void 0;
|
|
266
277
|
const defaultPositionY = (dw2?.length === DW2_ENTRY_COUNT ? asNumber(dw2[0]) : void 0) ?? DEFAULT_VERTICAL_POSITION_Y;
|
|
267
278
|
const defaultDisplacementY = (dw2?.length === DW2_ENTRY_COUNT ? asNumber(dw2[1]) : void 0) ?? DEFAULT_VERTICAL_DISPLACEMENT_Y;
|
|
268
|
-
const verticalMap = readCidVerticalMetrics(descendantDict !== void 0 ?
|
|
279
|
+
const verticalMap = readCidVerticalMetrics(descendantDict !== void 0 ? resolvedArray(dictGet(descendantDict, "W2"), context) : void 0);
|
|
269
280
|
const verticalMetricsOf = (cid) => {
|
|
270
281
|
const entry = verticalMap.get(cid);
|
|
271
282
|
return {
|
package/dist/index.cjs
CHANGED
|
@@ -21,7 +21,7 @@ const require_write_skipped_surfaces = require("./write-skipped-surfaces.cjs");
|
|
|
21
21
|
const require_write = require("./write.cjs");
|
|
22
22
|
const require_codec = require("./codec.cjs");
|
|
23
23
|
const require_font_face = require("./font-face.cjs");
|
|
24
|
-
const require_raster = require("./raster-
|
|
24
|
+
const require_raster = require("./raster-2avl8Qpk.cjs");
|
|
25
25
|
exports.DEFAULT_BASELINE_TOLERANCE_EM = require_text_group.DEFAULT_BASELINE_TOLERANCE_EM;
|
|
26
26
|
exports.DEFAULT_COLUMN_GAP_EM = require_text_group.DEFAULT_COLUMN_GAP_EM;
|
|
27
27
|
exports.DEFAULT_VERTICAL_METRIC_POLICY = require_measure.DEFAULT_VERTICAL_METRIC_POLICY;
|
package/dist/index.js
CHANGED
|
@@ -20,6 +20,6 @@ import { PdfSkippedSurfacesError } from "./write-skipped-surfaces.js";
|
|
|
20
20
|
import { PdfPartialDocumentError, writePdf } from "./write.js";
|
|
21
21
|
import { PdfBytesSchema, pdfCodec } from "./codec.js";
|
|
22
22
|
import { FontFaceParseError, readFontFace } from "./font-face.js";
|
|
23
|
-
import { r as renderPdfPage } from "./raster-
|
|
23
|
+
import { r as renderPdfPage } from "./raster-dqtea8ku.js";
|
|
24
24
|
export * from "byte-codec";
|
|
25
25
|
export { DEFAULT_BASELINE_TOLERANCE_EM, DEFAULT_COLUMN_GAP_EM, DEFAULT_VERTICAL_METRIC_POLICY, DEFAULT_WORD_GAP_EM, FontFaceParseError, Jbig2ParseError, Jbig2UnsupportedError, Jpeg2000ParseError, Jpeg2000UnsupportedError, LAYOUT_FORMAT_VERSION, LayoutAnnotationQuadSchema, LayoutAnnotationSchema, LayoutAttachmentSchema, LayoutDestinationSchema, LayoutDestinationTargetSchema, LayoutDocumentSchema, LayoutDocumentSurfaceSchema, LayoutEllipseSchema, LayoutFormFieldSchema, LayoutFormWidgetSchema, LayoutImageAssetSchema, LayoutImageSchema, LayoutInternalLinkSchema, LayoutItemSchema, LayoutLayerSchema, LayoutLineSchema, LayoutLinkSchema, LayoutOutlineItemSchema, LayoutPageSchema, LayoutPathSchema, LayoutPathSegmentSchema, LayoutRectSchema, LayoutStructureElementSchema, LayoutSubpathSchema, LayoutTextSchema, NOOP_DIAGNOSTIC_SINK, PdfBytesSchema, PdfEncryptedError, PdfEncryptionError, PdfPageSelectionError, PdfParseError, PdfPartialDocumentError, PdfPasswordRequiredError, PdfSkippedSurfacesError, STANDARD_METRICS, assembleStretchyGlyph, attachScriptRuns, createFontMeasurer, createFontRegistry, createStandardFontMeasurer, decodeCcittFax, decodeJbig2Embedded, decodeJpeg2000, filterScanlines, groupPdfTextRuns, loadMathFont, looksLikeBareCodestream, parseJp2Container, pdfCodec, readFontFace, readJpeg2000Metadata, readPdf, renderPdfPage, resolveFaceWithRegistry, resolveStandardFont, runGapPt, runsShareBaseline, scaleMathStretchConstruction, scriptPositionOf, sourcePageIndex, unfilterScanlines, writePdf };
|
|
@@ -2,7 +2,8 @@ import { asArray, asName, asNumber, dictGet } from "./objects.js";
|
|
|
2
2
|
import { IDENTITY_MATRIX, applyMatrix, multiplyMatrices, translationMatrix } from "./matrix.js";
|
|
3
3
|
import { decodeStream } from "./filters.js";
|
|
4
4
|
import { readContentStream } from "./content-read.js";
|
|
5
|
-
import "./text-group.js";
|
|
5
|
+
import { DEFAULT_WORD_GAP_EM } from "./text-group.js";
|
|
6
|
+
import { GLYPH_SPACE_PER_TEXT_SPACE_UNIT, computeTrm, defaultTextObjectState, initialTextParameters, stepPastGlyph } from "./interpret-state.js";
|
|
6
7
|
import { MarkedContentStack, classifyShape, strokeStyleFromDashArray } from "./interpret-shapes.js";
|
|
7
8
|
import { markedContentProperties, markedContentScopeProps } from "./interpret-marked.js";
|
|
8
9
|
import { COLOR_BLACK } from "document-schema.js";
|
|
@@ -44,38 +45,7 @@ function genericColor(operands) {
|
|
|
44
45
|
//#endregion
|
|
45
46
|
//#region src/interpret.ts
|
|
46
47
|
const MAX_FORM_XOBJECT_DEPTH = 12;
|
|
47
|
-
const FALLBACK_GLYPH_WIDTH_PER_1000 = 500;
|
|
48
|
-
const GLYPH_SPACE_PER_TEXT_SPACE_UNIT = 1e3;
|
|
49
|
-
const ASCII_SPACE = 32;
|
|
50
48
|
const DEFAULT_LINE_WIDTH_PT = 1;
|
|
51
|
-
function initialTextParameters() {
|
|
52
|
-
return {
|
|
53
|
-
fontResourceName: void 0,
|
|
54
|
-
fontSizePt: 0,
|
|
55
|
-
charSpace: 0,
|
|
56
|
-
wordSpace: 0,
|
|
57
|
-
horizScale: 1,
|
|
58
|
-
leading: 0,
|
|
59
|
-
rise: 0
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
function defaultTextObjectState() {
|
|
63
|
-
return {
|
|
64
|
-
tm: IDENTITY_MATRIX,
|
|
65
|
-
tlm: IDENTITY_MATRIX
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
function computeTrm(gs, text) {
|
|
69
|
-
const fontMatrix = [
|
|
70
|
-
gs.fontSizePt * gs.horizScale,
|
|
71
|
-
0,
|
|
72
|
-
0,
|
|
73
|
-
gs.fontSizePt,
|
|
74
|
-
0,
|
|
75
|
-
gs.rise
|
|
76
|
-
];
|
|
77
|
-
return multiplyMatrices(multiplyMatrices(fontMatrix, text.tm), gs.ctm);
|
|
78
|
-
}
|
|
79
49
|
function numAt(operands, index) {
|
|
80
50
|
return asNumber(operands[index]) ?? 0;
|
|
81
51
|
}
|
|
@@ -236,25 +206,16 @@ function runContentStream(bytes, resources, initialState, context, depth, marked
|
|
|
236
206
|
}
|
|
237
207
|
resetPath();
|
|
238
208
|
};
|
|
239
|
-
const
|
|
240
|
-
const
|
|
241
|
-
if (
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
});
|
|
250
|
-
const widthPer1000 = glyph?.widthPer1000 ?? FALLBACK_GLYPH_WIDTH_PER_1000;
|
|
251
|
-
const byteLength = glyph?.byteLengthConsumed ?? 1;
|
|
252
|
-
const isSingleByteSpace = byteLength === 1 && codes[offset] === ASCII_SPACE;
|
|
253
|
-
const spacing = gs.charSpace + (isSingleByteSpace ? gs.wordSpace : 0);
|
|
254
|
-
const vertical = glyph?.vertical;
|
|
255
|
-
text.tm = vertical === void 0 ? multiplyMatrices(translationMatrix((widthPer1000 / GLYPH_SPACE_PER_TEXT_SPACE_UNIT * gs.fontSizePt + spacing) * gs.horizScale, 0), text.tm) : multiplyMatrices(translationMatrix(0, vertical.displacementPer1000 / GLYPH_SPACE_PER_TEXT_SPACE_UNIT * gs.fontSizePt + spacing), text.tm);
|
|
256
|
-
offset += byteLength;
|
|
257
|
-
}
|
|
209
|
+
const advanceThroughGlyph = (fontResourceName, codes, offset) => {
|
|
210
|
+
const glyph = context.fontMetrics.glyphAdvance(fontResourceName, resources, codes, offset);
|
|
211
|
+
if (glyph === void 0) context.sink({
|
|
212
|
+
code: "pdf/font-not-resolved",
|
|
213
|
+
severity: "warning",
|
|
214
|
+
message: `could not resolve font resource /${fontResourceName} to compute a glyph advance; assuming a fallback width`
|
|
215
|
+
});
|
|
216
|
+
const step = stepPastGlyph(gs, text.tm, glyph, codes, offset);
|
|
217
|
+
text.tm = step.tm;
|
|
218
|
+
return step;
|
|
258
219
|
};
|
|
259
220
|
const positionVectorOf = (codes) => {
|
|
260
221
|
const fontResourceName = gs.fontResourceName;
|
|
@@ -270,10 +231,15 @@ function runContentStream(bytes, resources, initialState, context, depth, marked
|
|
|
270
231
|
const fontResourceName = gs.fontResourceName;
|
|
271
232
|
if (fontResourceName === void 0) return;
|
|
272
233
|
const vertical = context.fontMetrics.isVertical(fontResourceName, resources);
|
|
234
|
+
const wordGap = DEFAULT_WORD_GAP_EM * gs.fontSizePt;
|
|
273
235
|
let startMatrix = computeTrm(gs, text);
|
|
274
236
|
let chunks = [];
|
|
275
237
|
let totalLength = 0;
|
|
276
238
|
let firstGlyphPosition;
|
|
239
|
+
let lastWidthEndTm;
|
|
240
|
+
let lastGlyphWidth = 0;
|
|
241
|
+
let gapSinceLastGlyph = 0;
|
|
242
|
+
const gapEndsRun = () => !vertical && totalLength > 0 && (gapSinceLastGlyph >= wordGap || gapSinceLastGlyph < -lastGlyphWidth);
|
|
277
243
|
const flushRun = () => {
|
|
278
244
|
if (totalLength === 0) return;
|
|
279
245
|
const combined = new Uint8Array(totalLength);
|
|
@@ -282,7 +248,10 @@ function runContentStream(bytes, resources, initialState, context, depth, marked
|
|
|
282
248
|
combined.set(chunk, at);
|
|
283
249
|
at += chunk.length;
|
|
284
250
|
}
|
|
285
|
-
const endMatrix = computeTrm(gs,
|
|
251
|
+
const endMatrix = computeTrm(gs, gapEndsRun() && lastWidthEndTm !== void 0 ? {
|
|
252
|
+
...text,
|
|
253
|
+
tm: lastWidthEndTm
|
|
254
|
+
} : text);
|
|
286
255
|
const shift = firstGlyphPosition === void 0 ? void 0 : translationMatrix(-firstGlyphPosition.x, -firstGlyphPosition.y);
|
|
287
256
|
pushItem({
|
|
288
257
|
kind: "text",
|
|
@@ -300,15 +269,23 @@ function runContentStream(bytes, resources, initialState, context, depth, marked
|
|
|
300
269
|
firstGlyphPosition = void 0;
|
|
301
270
|
};
|
|
302
271
|
for (const el of elements) if (el.kind === "string") {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
272
|
+
let offset = 0;
|
|
273
|
+
while (offset < el.bytes.length) {
|
|
274
|
+
if (gapEndsRun()) flushRun();
|
|
275
|
+
if (totalLength === 0) startMatrix = computeTrm(gs, text);
|
|
276
|
+
firstGlyphPosition ??= vertical ? positionVectorOf(el.bytes.subarray(offset)) : void 0;
|
|
277
|
+
const glyph = advanceThroughGlyph(fontResourceName, el.bytes, offset);
|
|
278
|
+
chunks.push(el.bytes.subarray(offset, offset + glyph.byteLength));
|
|
279
|
+
totalLength += glyph.byteLength;
|
|
280
|
+
offset += glyph.byteLength;
|
|
281
|
+
lastWidthEndTm = glyph.widthEndTm;
|
|
282
|
+
lastGlyphWidth = glyph.widthAdvance;
|
|
283
|
+
gapSinceLastGlyph = glyph.charSpaceAfter;
|
|
284
|
+
}
|
|
307
285
|
} else if (el.kind === "number") {
|
|
308
286
|
const adjustment = -(el.value / GLYPH_SPACE_PER_TEXT_SPACE_UNIT) * gs.fontSizePt;
|
|
309
|
-
|
|
287
|
+
gapSinceLastGlyph += adjustment;
|
|
310
288
|
text.tm = multiplyMatrices(vertical ? translationMatrix(0, adjustment) : translationMatrix(adjustment * gs.horizScale, 0), text.tm);
|
|
311
|
-
if (totalLength === 0) startMatrix = computeTrm(gs, text);
|
|
312
289
|
}
|
|
313
290
|
flushRun();
|
|
314
291
|
};
|
|
@@ -2,7 +2,8 @@ const require_objects = require("./objects.cjs");
|
|
|
2
2
|
const require_matrix = require("./matrix.cjs");
|
|
3
3
|
const require_filters = require("./filters.cjs");
|
|
4
4
|
const require_content_read = require("./content-read.cjs");
|
|
5
|
-
require("./text-group.cjs");
|
|
5
|
+
const require_text_group = require("./text-group.cjs");
|
|
6
|
+
const require_interpret_state = require("./interpret-state.cjs");
|
|
6
7
|
const require_interpret_shapes = require("./interpret-shapes.cjs");
|
|
7
8
|
const require_interpret_marked = require("./interpret-marked.cjs");
|
|
8
9
|
let document_schema_js = require("document-schema.js");
|
|
@@ -44,38 +45,7 @@ function genericColor(operands) {
|
|
|
44
45
|
//#endregion
|
|
45
46
|
//#region src/interpret.ts
|
|
46
47
|
const MAX_FORM_XOBJECT_DEPTH = 12;
|
|
47
|
-
const FALLBACK_GLYPH_WIDTH_PER_1000 = 500;
|
|
48
|
-
const GLYPH_SPACE_PER_TEXT_SPACE_UNIT = 1e3;
|
|
49
|
-
const ASCII_SPACE = 32;
|
|
50
48
|
const DEFAULT_LINE_WIDTH_PT = 1;
|
|
51
|
-
function initialTextParameters() {
|
|
52
|
-
return {
|
|
53
|
-
fontResourceName: void 0,
|
|
54
|
-
fontSizePt: 0,
|
|
55
|
-
charSpace: 0,
|
|
56
|
-
wordSpace: 0,
|
|
57
|
-
horizScale: 1,
|
|
58
|
-
leading: 0,
|
|
59
|
-
rise: 0
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
function defaultTextObjectState() {
|
|
63
|
-
return {
|
|
64
|
-
tm: require_matrix.IDENTITY_MATRIX,
|
|
65
|
-
tlm: require_matrix.IDENTITY_MATRIX
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
function computeTrm(gs, text) {
|
|
69
|
-
const fontMatrix = [
|
|
70
|
-
gs.fontSizePt * gs.horizScale,
|
|
71
|
-
0,
|
|
72
|
-
0,
|
|
73
|
-
gs.fontSizePt,
|
|
74
|
-
0,
|
|
75
|
-
gs.rise
|
|
76
|
-
];
|
|
77
|
-
return require_matrix.multiplyMatrices(require_matrix.multiplyMatrices(fontMatrix, text.tm), gs.ctm);
|
|
78
|
-
}
|
|
79
49
|
function numAt(operands, index) {
|
|
80
50
|
return require_objects.asNumber(operands[index]) ?? 0;
|
|
81
51
|
}
|
|
@@ -104,7 +74,7 @@ function interpretContentStream(bytes, resources, context) {
|
|
|
104
74
|
strokeColor: document_schema_js.COLOR_BLACK,
|
|
105
75
|
lineWidth: DEFAULT_LINE_WIDTH_PT,
|
|
106
76
|
dashArray: [],
|
|
107
|
-
...initialTextParameters()
|
|
77
|
+
...require_interpret_state.initialTextParameters()
|
|
108
78
|
}, context, 0, new require_interpret_shapes.MarkedContentStack());
|
|
109
79
|
}
|
|
110
80
|
function lastPointOf(subpath) {
|
|
@@ -122,7 +92,7 @@ function runContentStream(bytes, resources, initialState, context, depth, marked
|
|
|
122
92
|
const operations = require_content_read.readContentStream(bytes, context.sink);
|
|
123
93
|
const gsStack = [];
|
|
124
94
|
let gs = initialState;
|
|
125
|
-
let text = defaultTextObjectState();
|
|
95
|
+
let text = require_interpret_state.defaultTextObjectState();
|
|
126
96
|
let pathSubpaths = [];
|
|
127
97
|
let currentSubpath;
|
|
128
98
|
const inScope = (key) => markedContent.inScope(key);
|
|
@@ -236,25 +206,16 @@ function runContentStream(bytes, resources, initialState, context, depth, marked
|
|
|
236
206
|
}
|
|
237
207
|
resetPath();
|
|
238
208
|
};
|
|
239
|
-
const
|
|
240
|
-
const
|
|
241
|
-
if (
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
});
|
|
250
|
-
const widthPer1000 = glyph?.widthPer1000 ?? FALLBACK_GLYPH_WIDTH_PER_1000;
|
|
251
|
-
const byteLength = glyph?.byteLengthConsumed ?? 1;
|
|
252
|
-
const isSingleByteSpace = byteLength === 1 && codes[offset] === ASCII_SPACE;
|
|
253
|
-
const spacing = gs.charSpace + (isSingleByteSpace ? gs.wordSpace : 0);
|
|
254
|
-
const vertical = glyph?.vertical;
|
|
255
|
-
text.tm = vertical === void 0 ? require_matrix.multiplyMatrices(require_matrix.translationMatrix((widthPer1000 / GLYPH_SPACE_PER_TEXT_SPACE_UNIT * gs.fontSizePt + spacing) * gs.horizScale, 0), text.tm) : require_matrix.multiplyMatrices(require_matrix.translationMatrix(0, vertical.displacementPer1000 / GLYPH_SPACE_PER_TEXT_SPACE_UNIT * gs.fontSizePt + spacing), text.tm);
|
|
256
|
-
offset += byteLength;
|
|
257
|
-
}
|
|
209
|
+
const advanceThroughGlyph = (fontResourceName, codes, offset) => {
|
|
210
|
+
const glyph = context.fontMetrics.glyphAdvance(fontResourceName, resources, codes, offset);
|
|
211
|
+
if (glyph === void 0) context.sink({
|
|
212
|
+
code: "pdf/font-not-resolved",
|
|
213
|
+
severity: "warning",
|
|
214
|
+
message: `could not resolve font resource /${fontResourceName} to compute a glyph advance; assuming a fallback width`
|
|
215
|
+
});
|
|
216
|
+
const step = require_interpret_state.stepPastGlyph(gs, text.tm, glyph, codes, offset);
|
|
217
|
+
text.tm = step.tm;
|
|
218
|
+
return step;
|
|
258
219
|
};
|
|
259
220
|
const positionVectorOf = (codes) => {
|
|
260
221
|
const fontResourceName = gs.fontResourceName;
|
|
@@ -262,18 +223,23 @@ function runContentStream(bytes, resources, initialState, context, depth, marked
|
|
|
262
223
|
const vertical = context.fontMetrics.glyphAdvance(fontResourceName, resources, codes, 0)?.vertical;
|
|
263
224
|
if (vertical === void 0) return;
|
|
264
225
|
return {
|
|
265
|
-
x: vertical.positionXPer1000 / GLYPH_SPACE_PER_TEXT_SPACE_UNIT,
|
|
266
|
-
y: vertical.positionYPer1000 / GLYPH_SPACE_PER_TEXT_SPACE_UNIT
|
|
226
|
+
x: vertical.positionXPer1000 / require_interpret_state.GLYPH_SPACE_PER_TEXT_SPACE_UNIT,
|
|
227
|
+
y: vertical.positionYPer1000 / require_interpret_state.GLYPH_SPACE_PER_TEXT_SPACE_UNIT
|
|
267
228
|
};
|
|
268
229
|
};
|
|
269
230
|
const showTextArray = (elements) => {
|
|
270
231
|
const fontResourceName = gs.fontResourceName;
|
|
271
232
|
if (fontResourceName === void 0) return;
|
|
272
233
|
const vertical = context.fontMetrics.isVertical(fontResourceName, resources);
|
|
273
|
-
|
|
234
|
+
const wordGap = require_text_group.DEFAULT_WORD_GAP_EM * gs.fontSizePt;
|
|
235
|
+
let startMatrix = require_interpret_state.computeTrm(gs, text);
|
|
274
236
|
let chunks = [];
|
|
275
237
|
let totalLength = 0;
|
|
276
238
|
let firstGlyphPosition;
|
|
239
|
+
let lastWidthEndTm;
|
|
240
|
+
let lastGlyphWidth = 0;
|
|
241
|
+
let gapSinceLastGlyph = 0;
|
|
242
|
+
const gapEndsRun = () => !vertical && totalLength > 0 && (gapSinceLastGlyph >= wordGap || gapSinceLastGlyph < -lastGlyphWidth);
|
|
277
243
|
const flushRun = () => {
|
|
278
244
|
if (totalLength === 0) return;
|
|
279
245
|
const combined = new Uint8Array(totalLength);
|
|
@@ -282,7 +248,10 @@ function runContentStream(bytes, resources, initialState, context, depth, marked
|
|
|
282
248
|
combined.set(chunk, at);
|
|
283
249
|
at += chunk.length;
|
|
284
250
|
}
|
|
285
|
-
const endMatrix = computeTrm(gs,
|
|
251
|
+
const endMatrix = require_interpret_state.computeTrm(gs, gapEndsRun() && lastWidthEndTm !== void 0 ? {
|
|
252
|
+
...text,
|
|
253
|
+
tm: lastWidthEndTm
|
|
254
|
+
} : text);
|
|
286
255
|
const shift = firstGlyphPosition === void 0 ? void 0 : require_matrix.translationMatrix(-firstGlyphPosition.x, -firstGlyphPosition.y);
|
|
287
256
|
pushItem({
|
|
288
257
|
kind: "text",
|
|
@@ -300,15 +269,23 @@ function runContentStream(bytes, resources, initialState, context, depth, marked
|
|
|
300
269
|
firstGlyphPosition = void 0;
|
|
301
270
|
};
|
|
302
271
|
for (const el of elements) if (el.kind === "string") {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
272
|
+
let offset = 0;
|
|
273
|
+
while (offset < el.bytes.length) {
|
|
274
|
+
if (gapEndsRun()) flushRun();
|
|
275
|
+
if (totalLength === 0) startMatrix = require_interpret_state.computeTrm(gs, text);
|
|
276
|
+
firstGlyphPosition ??= vertical ? positionVectorOf(el.bytes.subarray(offset)) : void 0;
|
|
277
|
+
const glyph = advanceThroughGlyph(fontResourceName, el.bytes, offset);
|
|
278
|
+
chunks.push(el.bytes.subarray(offset, offset + glyph.byteLength));
|
|
279
|
+
totalLength += glyph.byteLength;
|
|
280
|
+
offset += glyph.byteLength;
|
|
281
|
+
lastWidthEndTm = glyph.widthEndTm;
|
|
282
|
+
lastGlyphWidth = glyph.widthAdvance;
|
|
283
|
+
gapSinceLastGlyph = glyph.charSpaceAfter;
|
|
284
|
+
}
|
|
307
285
|
} else if (el.kind === "number") {
|
|
308
|
-
const adjustment = -(el.value / GLYPH_SPACE_PER_TEXT_SPACE_UNIT) * gs.fontSizePt;
|
|
309
|
-
|
|
286
|
+
const adjustment = -(el.value / require_interpret_state.GLYPH_SPACE_PER_TEXT_SPACE_UNIT) * gs.fontSizePt;
|
|
287
|
+
gapSinceLastGlyph += adjustment;
|
|
310
288
|
text.tm = require_matrix.multiplyMatrices(vertical ? require_matrix.translationMatrix(0, adjustment) : require_matrix.translationMatrix(adjustment * gs.horizScale, 0), text.tm);
|
|
311
|
-
if (totalLength === 0) startMatrix = computeTrm(gs, text);
|
|
312
289
|
}
|
|
313
290
|
flushRun();
|
|
314
291
|
};
|
|
@@ -573,7 +550,7 @@ function runContentStream(bytes, resources, initialState, context, depth, marked
|
|
|
573
550
|
emitPaint(operator);
|
|
574
551
|
break;
|
|
575
552
|
case "BT":
|
|
576
|
-
text = defaultTextObjectState();
|
|
553
|
+
text = require_interpret_state.defaultTextObjectState();
|
|
577
554
|
break;
|
|
578
555
|
case "Tf":
|
|
579
556
|
gs = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_interpret = require("./interpret-
|
|
2
|
+
const require_interpret = require("./interpret-EqQSNqHD.cjs");
|
|
3
3
|
exports.cmykColor = require_interpret.cmykColor;
|
|
4
4
|
exports.genericColor = require_interpret.genericColor;
|
|
5
5
|
exports.grayColor = require_interpret.grayColor;
|
package/dist/interpret-colors.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as grayColor, i as genericColor, o as rgbColor, r as cmykColor } from "./interpret-
|
|
1
|
+
import { a as grayColor, i as genericColor, o as rgbColor, r as cmykColor } from "./interpret-DI8JCCEE.js";
|
|
2
2
|
export { cmykColor, genericColor, grayColor, rgbColor };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_matrix = require("./matrix.cjs");
|
|
3
|
+
//#region src/interpret-state.ts
|
|
4
|
+
const FALLBACK_GLYPH_WIDTH_PER_1000 = 500;
|
|
5
|
+
const GLYPH_SPACE_PER_TEXT_SPACE_UNIT = 1e3;
|
|
6
|
+
const ASCII_SPACE = 32;
|
|
7
|
+
function initialTextParameters() {
|
|
8
|
+
return {
|
|
9
|
+
fontResourceName: void 0,
|
|
10
|
+
fontSizePt: 0,
|
|
11
|
+
charSpace: 0,
|
|
12
|
+
wordSpace: 0,
|
|
13
|
+
horizScale: 1,
|
|
14
|
+
leading: 0,
|
|
15
|
+
rise: 0
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function defaultTextObjectState() {
|
|
19
|
+
return {
|
|
20
|
+
tm: require_matrix.IDENTITY_MATRIX,
|
|
21
|
+
tlm: require_matrix.IDENTITY_MATRIX
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function computeTrm(gs, text) {
|
|
25
|
+
const fontMatrix = [
|
|
26
|
+
gs.fontSizePt * gs.horizScale,
|
|
27
|
+
0,
|
|
28
|
+
0,
|
|
29
|
+
gs.fontSizePt,
|
|
30
|
+
0,
|
|
31
|
+
gs.rise
|
|
32
|
+
];
|
|
33
|
+
return require_matrix.multiplyMatrices(require_matrix.multiplyMatrices(fontMatrix, text.tm), gs.ctm);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Moves a text matrix past one glyph.
|
|
37
|
+
* @param gs - the graphics state whose font size, spacing and horizontal scaling apply
|
|
38
|
+
* @param tm - the text matrix where the glyph starts
|
|
39
|
+
* @param glyph - the font's advance for the glyph's code, or undefined when the font could not be resolved, in which case a fallback width is assumed and the code is taken as one byte
|
|
40
|
+
* @param codes - the shown string
|
|
41
|
+
* @param offset - where the glyph's code starts in `codes`
|
|
42
|
+
* @returns the step, with the pen's new position and the end of the glyph's own width reported apart so a caller can tell the glyph's extent from the gap after it
|
|
43
|
+
*/
|
|
44
|
+
function stepPastGlyph(gs, tm, glyph, codes, offset) {
|
|
45
|
+
const widthPer1000 = glyph?.widthPer1000 ?? 500;
|
|
46
|
+
const byteLength = glyph?.byteLengthConsumed ?? 1;
|
|
47
|
+
const isSingleByteSpace = byteLength === 1 && codes[offset] === 32;
|
|
48
|
+
const spacing = gs.charSpace + (isSingleByteSpace ? gs.wordSpace : 0);
|
|
49
|
+
const vertical = glyph?.vertical;
|
|
50
|
+
const widthAdvance = vertical === void 0 ? widthPer1000 / GLYPH_SPACE_PER_TEXT_SPACE_UNIT * gs.fontSizePt : vertical.displacementPer1000 / GLYPH_SPACE_PER_TEXT_SPACE_UNIT * gs.fontSizePt;
|
|
51
|
+
const along = (distance) => vertical === void 0 ? require_matrix.translationMatrix(distance * gs.horizScale, 0) : require_matrix.translationMatrix(0, distance);
|
|
52
|
+
return {
|
|
53
|
+
byteLength,
|
|
54
|
+
tm: require_matrix.multiplyMatrices(along(widthAdvance + spacing), tm),
|
|
55
|
+
widthEndTm: require_matrix.multiplyMatrices(along(widthAdvance), tm),
|
|
56
|
+
widthAdvance,
|
|
57
|
+
charSpaceAfter: gs.charSpace
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
exports.ASCII_SPACE = ASCII_SPACE;
|
|
62
|
+
exports.FALLBACK_GLYPH_WIDTH_PER_1000 = FALLBACK_GLYPH_WIDTH_PER_1000;
|
|
63
|
+
exports.GLYPH_SPACE_PER_TEXT_SPACE_UNIT = GLYPH_SPACE_PER_TEXT_SPACE_UNIT;
|
|
64
|
+
exports.computeTrm = computeTrm;
|
|
65
|
+
exports.defaultTextObjectState = defaultTextObjectState;
|
|
66
|
+
exports.initialTextParameters = initialTextParameters;
|
|
67
|
+
exports.stepPastGlyph = stepPastGlyph;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { r as Matrix } from "./matrix-B7_SBKQ5.cjs";
|
|
2
|
+
import { GlyphAdvance } from "./interpret-types.cjs";
|
|
3
|
+
import { Color } from "document-schema.js";
|
|
4
|
+
//#region src/interpret-state.d.ts
|
|
5
|
+
declare const FALLBACK_GLYPH_WIDTH_PER_1000 = 500;
|
|
6
|
+
declare const GLYPH_SPACE_PER_TEXT_SPACE_UNIT = 1000;
|
|
7
|
+
declare const ASCII_SPACE = 32;
|
|
8
|
+
interface GraphicsState {
|
|
9
|
+
readonly ctm: Matrix;
|
|
10
|
+
readonly fillColor: Color;
|
|
11
|
+
readonly strokeColor: Color;
|
|
12
|
+
readonly lineWidth: number;
|
|
13
|
+
readonly dashArray: readonly number[];
|
|
14
|
+
readonly fontResourceName: string | undefined;
|
|
15
|
+
readonly fontSizePt: number;
|
|
16
|
+
readonly charSpace: number;
|
|
17
|
+
readonly wordSpace: number;
|
|
18
|
+
readonly horizScale: number;
|
|
19
|
+
readonly leading: number;
|
|
20
|
+
readonly rise: number;
|
|
21
|
+
}
|
|
22
|
+
interface TextObjectState {
|
|
23
|
+
tm: Matrix;
|
|
24
|
+
tlm: Matrix;
|
|
25
|
+
}
|
|
26
|
+
declare function initialTextParameters(): Omit<GraphicsState, "ctm" | "fillColor" | "strokeColor" | "lineWidth" | "dashArray">;
|
|
27
|
+
declare function defaultTextObjectState(): TextObjectState;
|
|
28
|
+
declare function computeTrm(gs: GraphicsState, text: TextObjectState): Matrix;
|
|
29
|
+
/** Where one glyph leaves the text matrix, and what lies between the glyph and the next one. */
|
|
30
|
+
interface GlyphStep {
|
|
31
|
+
/** How many bytes of the shown string the glyph's code took. */
|
|
32
|
+
readonly byteLength: number;
|
|
33
|
+
/** The text matrix after the glyph's width and its spacing, where the next glyph starts. */
|
|
34
|
+
readonly tm: Matrix;
|
|
35
|
+
/** The text matrix at the end of the glyph's own advance width, before any spacing. */
|
|
36
|
+
readonly widthEndTm: Matrix;
|
|
37
|
+
/** The glyph's own advance width in unscaled text space units, along the direction the font is set in. */
|
|
38
|
+
readonly widthAdvance: number;
|
|
39
|
+
/** The character spacing added after the glyph's width, in unscaled text space units. The word spacing a single-byte space takes is not counted: the space character already records that word boundary in the run's text. */
|
|
40
|
+
readonly charSpaceAfter: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Moves a text matrix past one glyph.
|
|
44
|
+
* @param gs - the graphics state whose font size, spacing and horizontal scaling apply
|
|
45
|
+
* @param tm - the text matrix where the glyph starts
|
|
46
|
+
* @param glyph - the font's advance for the glyph's code, or undefined when the font could not be resolved, in which case a fallback width is assumed and the code is taken as one byte
|
|
47
|
+
* @param codes - the shown string
|
|
48
|
+
* @param offset - where the glyph's code starts in `codes`
|
|
49
|
+
* @returns the step, with the pen's new position and the end of the glyph's own width reported apart so a caller can tell the glyph's extent from the gap after it
|
|
50
|
+
*/
|
|
51
|
+
declare function stepPastGlyph(gs: GraphicsState, tm: Matrix, glyph: GlyphAdvance | undefined, codes: Uint8Array<ArrayBuffer>, offset: number): GlyphStep;
|
|
52
|
+
//#endregion
|
|
53
|
+
export { ASCII_SPACE, FALLBACK_GLYPH_WIDTH_PER_1000, GLYPH_SPACE_PER_TEXT_SPACE_UNIT, GlyphStep, GraphicsState, TextObjectState, computeTrm, defaultTextObjectState, initialTextParameters, stepPastGlyph };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { r as Matrix } from "./matrix-B7_SBKQ5.js";
|
|
2
|
+
import { GlyphAdvance } from "./interpret-types.js";
|
|
3
|
+
import { Color } from "document-schema.js";
|
|
4
|
+
//#region src/interpret-state.d.ts
|
|
5
|
+
declare const FALLBACK_GLYPH_WIDTH_PER_1000 = 500;
|
|
6
|
+
declare const GLYPH_SPACE_PER_TEXT_SPACE_UNIT = 1000;
|
|
7
|
+
declare const ASCII_SPACE = 32;
|
|
8
|
+
interface GraphicsState {
|
|
9
|
+
readonly ctm: Matrix;
|
|
10
|
+
readonly fillColor: Color;
|
|
11
|
+
readonly strokeColor: Color;
|
|
12
|
+
readonly lineWidth: number;
|
|
13
|
+
readonly dashArray: readonly number[];
|
|
14
|
+
readonly fontResourceName: string | undefined;
|
|
15
|
+
readonly fontSizePt: number;
|
|
16
|
+
readonly charSpace: number;
|
|
17
|
+
readonly wordSpace: number;
|
|
18
|
+
readonly horizScale: number;
|
|
19
|
+
readonly leading: number;
|
|
20
|
+
readonly rise: number;
|
|
21
|
+
}
|
|
22
|
+
interface TextObjectState {
|
|
23
|
+
tm: Matrix;
|
|
24
|
+
tlm: Matrix;
|
|
25
|
+
}
|
|
26
|
+
declare function initialTextParameters(): Omit<GraphicsState, "ctm" | "fillColor" | "strokeColor" | "lineWidth" | "dashArray">;
|
|
27
|
+
declare function defaultTextObjectState(): TextObjectState;
|
|
28
|
+
declare function computeTrm(gs: GraphicsState, text: TextObjectState): Matrix;
|
|
29
|
+
/** Where one glyph leaves the text matrix, and what lies between the glyph and the next one. */
|
|
30
|
+
interface GlyphStep {
|
|
31
|
+
/** How many bytes of the shown string the glyph's code took. */
|
|
32
|
+
readonly byteLength: number;
|
|
33
|
+
/** The text matrix after the glyph's width and its spacing, where the next glyph starts. */
|
|
34
|
+
readonly tm: Matrix;
|
|
35
|
+
/** The text matrix at the end of the glyph's own advance width, before any spacing. */
|
|
36
|
+
readonly widthEndTm: Matrix;
|
|
37
|
+
/** The glyph's own advance width in unscaled text space units, along the direction the font is set in. */
|
|
38
|
+
readonly widthAdvance: number;
|
|
39
|
+
/** The character spacing added after the glyph's width, in unscaled text space units. The word spacing a single-byte space takes is not counted: the space character already records that word boundary in the run's text. */
|
|
40
|
+
readonly charSpaceAfter: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Moves a text matrix past one glyph.
|
|
44
|
+
* @param gs - the graphics state whose font size, spacing and horizontal scaling apply
|
|
45
|
+
* @param tm - the text matrix where the glyph starts
|
|
46
|
+
* @param glyph - the font's advance for the glyph's code, or undefined when the font could not be resolved, in which case a fallback width is assumed and the code is taken as one byte
|
|
47
|
+
* @param codes - the shown string
|
|
48
|
+
* @param offset - where the glyph's code starts in `codes`
|
|
49
|
+
* @returns the step, with the pen's new position and the end of the glyph's own width reported apart so a caller can tell the glyph's extent from the gap after it
|
|
50
|
+
*/
|
|
51
|
+
declare function stepPastGlyph(gs: GraphicsState, tm: Matrix, glyph: GlyphAdvance | undefined, codes: Uint8Array<ArrayBuffer>, offset: number): GlyphStep;
|
|
52
|
+
//#endregion
|
|
53
|
+
export { ASCII_SPACE, FALLBACK_GLYPH_WIDTH_PER_1000, GLYPH_SPACE_PER_TEXT_SPACE_UNIT, GlyphStep, GraphicsState, TextObjectState, computeTrm, defaultTextObjectState, initialTextParameters, stepPastGlyph };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { IDENTITY_MATRIX, multiplyMatrices, translationMatrix } from "./matrix.js";
|
|
2
|
+
//#region src/interpret-state.ts
|
|
3
|
+
const FALLBACK_GLYPH_WIDTH_PER_1000 = 500;
|
|
4
|
+
const GLYPH_SPACE_PER_TEXT_SPACE_UNIT = 1e3;
|
|
5
|
+
const ASCII_SPACE = 32;
|
|
6
|
+
function initialTextParameters() {
|
|
7
|
+
return {
|
|
8
|
+
fontResourceName: void 0,
|
|
9
|
+
fontSizePt: 0,
|
|
10
|
+
charSpace: 0,
|
|
11
|
+
wordSpace: 0,
|
|
12
|
+
horizScale: 1,
|
|
13
|
+
leading: 0,
|
|
14
|
+
rise: 0
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function defaultTextObjectState() {
|
|
18
|
+
return {
|
|
19
|
+
tm: IDENTITY_MATRIX,
|
|
20
|
+
tlm: IDENTITY_MATRIX
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function computeTrm(gs, text) {
|
|
24
|
+
const fontMatrix = [
|
|
25
|
+
gs.fontSizePt * gs.horizScale,
|
|
26
|
+
0,
|
|
27
|
+
0,
|
|
28
|
+
gs.fontSizePt,
|
|
29
|
+
0,
|
|
30
|
+
gs.rise
|
|
31
|
+
];
|
|
32
|
+
return multiplyMatrices(multiplyMatrices(fontMatrix, text.tm), gs.ctm);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Moves a text matrix past one glyph.
|
|
36
|
+
* @param gs - the graphics state whose font size, spacing and horizontal scaling apply
|
|
37
|
+
* @param tm - the text matrix where the glyph starts
|
|
38
|
+
* @param glyph - the font's advance for the glyph's code, or undefined when the font could not be resolved, in which case a fallback width is assumed and the code is taken as one byte
|
|
39
|
+
* @param codes - the shown string
|
|
40
|
+
* @param offset - where the glyph's code starts in `codes`
|
|
41
|
+
* @returns the step, with the pen's new position and the end of the glyph's own width reported apart so a caller can tell the glyph's extent from the gap after it
|
|
42
|
+
*/
|
|
43
|
+
function stepPastGlyph(gs, tm, glyph, codes, offset) {
|
|
44
|
+
const widthPer1000 = glyph?.widthPer1000 ?? 500;
|
|
45
|
+
const byteLength = glyph?.byteLengthConsumed ?? 1;
|
|
46
|
+
const isSingleByteSpace = byteLength === 1 && codes[offset] === 32;
|
|
47
|
+
const spacing = gs.charSpace + (isSingleByteSpace ? gs.wordSpace : 0);
|
|
48
|
+
const vertical = glyph?.vertical;
|
|
49
|
+
const widthAdvance = vertical === void 0 ? widthPer1000 / GLYPH_SPACE_PER_TEXT_SPACE_UNIT * gs.fontSizePt : vertical.displacementPer1000 / GLYPH_SPACE_PER_TEXT_SPACE_UNIT * gs.fontSizePt;
|
|
50
|
+
const along = (distance) => vertical === void 0 ? translationMatrix(distance * gs.horizScale, 0) : translationMatrix(0, distance);
|
|
51
|
+
return {
|
|
52
|
+
byteLength,
|
|
53
|
+
tm: multiplyMatrices(along(widthAdvance + spacing), tm),
|
|
54
|
+
widthEndTm: multiplyMatrices(along(widthAdvance), tm),
|
|
55
|
+
widthAdvance,
|
|
56
|
+
charSpaceAfter: gs.charSpace
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
export { ASCII_SPACE, FALLBACK_GLYPH_WIDTH_PER_1000, GLYPH_SPACE_PER_TEXT_SPACE_UNIT, computeTrm, defaultTextObjectState, initialTextParameters, stepPastGlyph };
|
package/dist/interpret.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_interpret = require("./interpret-
|
|
2
|
+
const require_interpret = require("./interpret-EqQSNqHD.cjs");
|
|
3
3
|
exports.interpretContentStream = require_interpret.interpretContentStream;
|
|
4
4
|
exports.numAt = require_interpret.numAt;
|
package/dist/interpret.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as numAt, t as interpretContentStream } from "./interpret-
|
|
1
|
+
import { n as numAt, t as interpretContentStream } from "./interpret-DI8JCCEE.js";
|
|
2
2
|
export { interpretContentStream, numAt };
|
|
@@ -11,7 +11,7 @@ const require_diagnostics = require("./diagnostics.cjs");
|
|
|
11
11
|
const require_document = require("./document.cjs");
|
|
12
12
|
const require_util_abort = require("./util/abort.cjs");
|
|
13
13
|
const require_font_read = require("./font-read.cjs");
|
|
14
|
-
const require_interpret = require("./interpret-
|
|
14
|
+
const require_interpret = require("./interpret-EqQSNqHD.cjs");
|
|
15
15
|
const require_read = require("./read.cjs");
|
|
16
16
|
const require_glyf = require("./glyf.cjs");
|
|
17
17
|
const require_glyf_contours = require("./glyf-contours.cjs");
|
|
@@ -77,7 +77,7 @@ function buildTextOutlineFace(fontDict, resolver, fontResolver, fontResourceName
|
|
|
77
77
|
if (subtype === "Type0") {
|
|
78
78
|
const encoding = resolver.resolve(require_objects.dictGet(fontDict, "Encoding"));
|
|
79
79
|
if (encoding?.kind !== "name" || encoding.name !== "Identity-H" && encoding.name !== "Identity-V") return unavailable("a Type0 font whose /Encoding is neither Identity-H nor Identity-V (a predefined or embedded CMap this raster walk does not decode)");
|
|
80
|
-
const descendants = require_objects.asArray(require_objects.dictGet(fontDict, "DescendantFonts"));
|
|
80
|
+
const descendants = require_objects.asArray(resolver.resolve(require_objects.dictGet(fontDict, "DescendantFonts")));
|
|
81
81
|
const descendant = descendants !== void 0 ? resolver.resolveDict(descendants[0]) : void 0;
|
|
82
82
|
if (descendant === void 0) return unavailable("a Type0 font with no readable /DescendantFonts entry");
|
|
83
83
|
const descendantSubtype = require_objects.asName(require_objects.dictGet(descendant, "Subtype"));
|
|
@@ -11,7 +11,7 @@ import { NOOP_DIAGNOSTIC_SINK, PdfParseError } from "./diagnostics.js";
|
|
|
11
11
|
import { openPdfDocument } from "./document.js";
|
|
12
12
|
import { throwIfAborted } from "./util/abort.js";
|
|
13
13
|
import { createFontResolver } from "./font-read.js";
|
|
14
|
-
import { t as interpretContentStream } from "./interpret-
|
|
14
|
+
import { t as interpretContentStream } from "./interpret-DI8JCCEE.js";
|
|
15
15
|
import { normalizeRotation, pageRotationTransform } from "./read.js";
|
|
16
16
|
import { parseGlyf } from "./glyf.js";
|
|
17
17
|
import { decodeGlyphOutline } from "./glyf-contours.js";
|
|
@@ -77,7 +77,7 @@ function buildTextOutlineFace(fontDict, resolver, fontResolver, fontResourceName
|
|
|
77
77
|
if (subtype === "Type0") {
|
|
78
78
|
const encoding = resolver.resolve(dictGet(fontDict, "Encoding"));
|
|
79
79
|
if (encoding?.kind !== "name" || encoding.name !== "Identity-H" && encoding.name !== "Identity-V") return unavailable("a Type0 font whose /Encoding is neither Identity-H nor Identity-V (a predefined or embedded CMap this raster walk does not decode)");
|
|
80
|
-
const descendants = asArray(dictGet(fontDict, "DescendantFonts"));
|
|
80
|
+
const descendants = asArray(resolver.resolve(dictGet(fontDict, "DescendantFonts")));
|
|
81
81
|
const descendant = descendants !== void 0 ? resolver.resolveDict(descendants[0]) : void 0;
|
|
82
82
|
if (descendant === void 0) return unavailable("a Type0 font with no readable /DescendantFonts entry");
|
|
83
83
|
const descendantSubtype = asName(dictGet(descendant, "Subtype"));
|
package/dist/raster-text.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_raster = require("./raster-
|
|
2
|
+
const require_raster = require("./raster-2avl8Qpk.cjs");
|
|
3
3
|
exports.drawGlyphOutline = require_raster.drawGlyphOutline;
|
|
4
4
|
exports.drawTextRun = require_raster.drawTextRun;
|
|
5
5
|
exports.glyphOutlineSubpaths = require_raster.glyphOutlineSubpaths;
|
package/dist/raster-text.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as drawTextRun, i as drawGlyphOutline, o as glyphOutlineSubpaths } from "./raster-
|
|
1
|
+
import { a as drawTextRun, i as drawGlyphOutline, o as glyphOutlineSubpaths } from "./raster-dqtea8ku.js";
|
|
2
2
|
export { drawGlyphOutline, drawTextRun, glyphOutlineSubpaths };
|
package/dist/raster.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_raster = require("./raster-
|
|
2
|
+
const require_raster = require("./raster-2avl8Qpk.cjs");
|
|
3
3
|
exports.EXTENT_ZERO_EPSILON = require_raster.EXTENT_ZERO_EPSILON;
|
|
4
4
|
exports.flattenCubic = require_raster.flattenCubic;
|
|
5
5
|
exports.renderPdfPage = require_raster.renderPdfPage;
|
package/dist/raster.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as flattenCubic, r as renderPdfPage, t as EXTENT_ZERO_EPSILON } from "./raster-
|
|
1
|
+
import { n as flattenCubic, r as renderPdfPage, t as EXTENT_ZERO_EPSILON } from "./raster-dqtea8ku.js";
|
|
2
2
|
export { EXTENT_ZERO_EPSILON, flattenCubic, renderPdfPage };
|
package/dist/read.cjs
CHANGED
|
@@ -17,7 +17,7 @@ const require_diagnostics = require("./diagnostics.cjs");
|
|
|
17
17
|
const require_document = require("./document.cjs");
|
|
18
18
|
const require_util_abort = require("./util/abort.cjs");
|
|
19
19
|
const require_font_read = require("./font-read.cjs");
|
|
20
|
-
const require_interpret = require("./interpret-
|
|
20
|
+
const require_interpret = require("./interpret-EqQSNqHD.cjs");
|
|
21
21
|
const require_navigation = require("./navigation.cjs");
|
|
22
22
|
//#region src/read.ts
|
|
23
23
|
function skippedSurfacesOf(surfaces) {
|
package/dist/read.js
CHANGED
|
@@ -16,7 +16,7 @@ import { NOOP_DIAGNOSTIC_SINK, PdfPageSelectionError, PdfParseError } from "./di
|
|
|
16
16
|
import { openPdfDocument } from "./document.js";
|
|
17
17
|
import { throwIfAborted } from "./util/abort.js";
|
|
18
18
|
import { createFontResolver } from "./font-read.js";
|
|
19
|
-
import { t as interpretContentStream } from "./interpret-
|
|
19
|
+
import { t as interpretContentStream } from "./interpret-DI8JCCEE.js";
|
|
20
20
|
import { createDestinationRegistry, readOutline } from "./navigation.js";
|
|
21
21
|
//#region src/read.ts
|
|
22
22
|
function skippedSurfacesOf(surfaces) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pdf-codec",
|
|
3
|
-
"version": "5.7.
|
|
3
|
+
"version": "5.7.2",
|
|
4
4
|
"description": "Hand-written, dependency-minimal PDF codec: parses arbitrary real-world PDFs and generates new ones, built on its own codec-owned LayoutDocument item model and Zod 4 codecs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|