pdf-codec 2.0.0 → 2.0.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 +5 -1
- package/dist/codec.d.cts +2 -2
- package/dist/codec.d.ts +2 -2
- package/dist/index.cjs +9 -19
- package/dist/index.d.cts +3 -9
- package/dist/index.d.ts +3 -9
- package/dist/index.js +2 -8
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -17,6 +17,7 @@ graph TD
|
|
|
17
17
|
odf("odf.js")
|
|
18
18
|
pdfcodec("pdf-codec")
|
|
19
19
|
mdcodec("markdown-codec")
|
|
20
|
+
bytecodec("byte-codec")
|
|
20
21
|
documents("documents.js")
|
|
21
22
|
mcp("document-mcp")
|
|
22
23
|
cli("document-cli")
|
|
@@ -30,6 +31,8 @@ graph TD
|
|
|
30
31
|
odf --> documents
|
|
31
32
|
pdfcodec --> documents
|
|
32
33
|
mdcodec --> documents
|
|
34
|
+
bytecodec --> pdfcodec
|
|
35
|
+
bytecodec --> documents
|
|
33
36
|
documents --> mcp
|
|
34
37
|
pdfcodec --> mcp
|
|
35
38
|
documents --> cli
|
|
@@ -41,6 +44,7 @@ graph TD
|
|
|
41
44
|
click odf "https://github.com/ExaDev/odf.js" "odf.js"
|
|
42
45
|
click pdfcodec "https://github.com/ExaDev/pdf-codec" "pdf-codec"
|
|
43
46
|
click mdcodec "https://github.com/ExaDev/markdown-codec" "markdown-codec"
|
|
47
|
+
click bytecodec "https://github.com/ExaDev/byte-codec" "byte-codec"
|
|
44
48
|
click documents "https://github.com/ExaDev/documents.js" "documents.js"
|
|
45
49
|
click mcp "https://github.com/ExaDev/document-mcp" "document-mcp"
|
|
46
50
|
click cli "https://github.com/ExaDev/document-cli" "document-cli"
|
|
@@ -168,7 +172,7 @@ const image = decodeJpeg2000(jp2OrCodestreamBytes); // -> { width, height, bitDe
|
|
|
168
172
|
|
|
169
173
|
Both accept a whole JP2 file or a bare codestream; `decodeJpeg2000` takes an optional `onWarning` for the recoverable cases (a truncated codestream decodes to whatever packets did arrive) and throws `Jpeg2000UnsupportedError` naming the feature for anything outside [JPEG 2000 scope](#jpeg-2000-scope). Inside a PDF none of this needs calling: `readPdf` decodes a `/JPXDecode` image XObject through the same path automatically.
|
|
170
174
|
|
|
171
|
-
The
|
|
175
|
+
The generic byte- and image-container primitives (`crc32`, `deflate`/`inflate`/`inflateTolerant`, `ByteReader`/`ByteWriter`/`concatBytes`, `readJpegInfo`, `decodePng`/`encodePng`, `unfilterScanlines`/`filterScanlines`) are re-exported from [byte-codec](https://github.com/ExaDev/byte-codec), the neutral shared package both pdf-codec and documents.js consume — pdf-codec keeps its own internal copies (its read/write/interpret paths use them) but its public barrel delegates to byte-codec. The PDF-specific image codecs (`decodeCcittFax`, `decodeJbig2Embedded`, `decodeJpeg2000`/`readJpeg2000Metadata`/`parseJp2Container`) stay here — they are genuine PDF-format concerns.
|
|
172
176
|
|
|
173
177
|
Every module under `src/` is also deep-importable directly by its own subpath, for a caller that wants one internal module (not part of the curated barrel above) without pulling in the rest:
|
|
174
178
|
|
package/dist/codec.d.cts
CHANGED
|
@@ -24,12 +24,12 @@ declare const pdfCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Arr
|
|
|
24
24
|
font: z.ZodObject<{
|
|
25
25
|
family: z.ZodString;
|
|
26
26
|
weight: z.ZodEnum<{
|
|
27
|
-
normal: "normal";
|
|
28
27
|
bold: "bold";
|
|
28
|
+
normal: "normal";
|
|
29
29
|
}>;
|
|
30
30
|
style: z.ZodEnum<{
|
|
31
|
-
normal: "normal";
|
|
32
31
|
italic: "italic";
|
|
32
|
+
normal: "normal";
|
|
33
33
|
}>;
|
|
34
34
|
}, z.core.$strip>;
|
|
35
35
|
sizePt: z.ZodNumber;
|
package/dist/codec.d.ts
CHANGED
|
@@ -24,12 +24,12 @@ declare const pdfCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Arr
|
|
|
24
24
|
font: z.ZodObject<{
|
|
25
25
|
family: z.ZodString;
|
|
26
26
|
weight: z.ZodEnum<{
|
|
27
|
-
normal: "normal";
|
|
28
27
|
bold: "bold";
|
|
28
|
+
normal: "normal";
|
|
29
29
|
}>;
|
|
30
30
|
style: z.ZodEnum<{
|
|
31
|
-
normal: "normal";
|
|
32
31
|
italic: "italic";
|
|
32
|
+
normal: "normal";
|
|
33
33
|
}>;
|
|
34
34
|
}, z.core.$strip>;
|
|
35
35
|
sizePt: z.ZodNumber;
|
package/dist/index.cjs
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_afm_widths = require("./afm-widths-BoeTOK2r.cjs");
|
|
3
|
-
const require_bytes_reader = require("./bytes/reader.cjs");
|
|
4
|
-
const require_bytes_crc32 = require("./bytes/crc32.cjs");
|
|
5
|
-
const require_bytes_writer = require("./bytes/writer.cjs");
|
|
6
3
|
const require_diagnostics = require("./diagnostics.cjs");
|
|
7
|
-
const require_bytes_flate = require("./bytes/flate.cjs");
|
|
8
4
|
const require_image_ccitt = require("./image/ccitt.cjs");
|
|
9
5
|
const require_image_jbig2_errors = require("./image/jbig2-errors.cjs");
|
|
10
6
|
const require_image_jbig2 = require("./image/jbig2.cjs");
|
|
11
7
|
const require_image_png_filter = require("./image/png-filter.cjs");
|
|
12
8
|
const require_fonts = require("./fonts.cjs");
|
|
13
|
-
const require_image_png_encode = require("./image/png-encode.cjs");
|
|
14
|
-
const require_image_jpeg_info = require("./image/jpeg-info.cjs");
|
|
15
9
|
const require_image_jpeg2000_errors = require("./image/jpeg2000-errors.cjs");
|
|
16
10
|
const require_image_jp2_boxes = require("./image/jp2-boxes.cjs");
|
|
17
11
|
const require_image_jpeg2000 = require("./image/jpeg2000.cjs");
|
|
18
|
-
const require_image_png_decode = require("./image/png-decode.cjs");
|
|
19
12
|
const require_font_registry = require("./font-registry.cjs");
|
|
20
13
|
const require_math_stretch = require("./math-stretch.cjs");
|
|
21
14
|
const require_math_font = require("./math-font.cjs");
|
|
@@ -24,15 +17,12 @@ const require_write = require("./write.cjs");
|
|
|
24
17
|
const require_read = require("./read.cjs");
|
|
25
18
|
const require_codec = require("./codec.cjs");
|
|
26
19
|
const require_font_face = require("./font-face.cjs");
|
|
27
|
-
exports.ByteReader = require_bytes_reader.ByteReader;
|
|
28
|
-
exports.ByteWriter = require_bytes_writer.ByteWriter;
|
|
29
20
|
exports.DEFAULT_VERTICAL_METRIC_POLICY = require_measure.DEFAULT_VERTICAL_METRIC_POLICY;
|
|
30
21
|
exports.FontFaceParseError = require_font_face.FontFaceParseError;
|
|
31
22
|
exports.Jbig2ParseError = require_image_jbig2_errors.Jbig2ParseError;
|
|
32
23
|
exports.Jbig2UnsupportedError = require_image_jbig2_errors.Jbig2UnsupportedError;
|
|
33
24
|
exports.Jpeg2000ParseError = require_image_jpeg2000_errors.Jpeg2000ParseError;
|
|
34
25
|
exports.Jpeg2000UnsupportedError = require_image_jpeg2000_errors.Jpeg2000UnsupportedError;
|
|
35
|
-
exports.MAX_INFLATE_OUTPUT_BYTES = require_bytes_flate.MAX_INFLATE_OUTPUT_BYTES;
|
|
36
26
|
exports.NOOP_DIAGNOSTIC_SINK = require_diagnostics.NOOP_DIAGNOSTIC_SINK;
|
|
37
27
|
exports.PdfBytesSchema = require_codec.PdfBytesSchema;
|
|
38
28
|
exports.PdfEncryptedError = require_diagnostics.PdfEncryptedError;
|
|
@@ -40,31 +30,31 @@ exports.PdfParseError = require_diagnostics.PdfParseError;
|
|
|
40
30
|
exports.PdfPasswordRequiredError = require_diagnostics.PdfPasswordRequiredError;
|
|
41
31
|
exports.STANDARD_METRICS = require_afm_widths.STANDARD_METRICS;
|
|
42
32
|
exports.assembleStretchyGlyph = require_math_stretch.assembleStretchyGlyph;
|
|
43
|
-
exports.concatBytes = require_bytes_writer.concatBytes;
|
|
44
|
-
exports.crc32 = require_bytes_crc32.crc32;
|
|
45
33
|
exports.createFontMeasurer = require_measure.createFontMeasurer;
|
|
46
34
|
exports.createFontRegistry = require_font_registry.createFontRegistry;
|
|
47
35
|
exports.createStandardFontMeasurer = require_measure.createStandardFontMeasurer;
|
|
48
36
|
exports.decodeCcittFax = require_image_ccitt.decodeCcittFax;
|
|
49
37
|
exports.decodeJbig2Embedded = require_image_jbig2.decodeJbig2Embedded;
|
|
50
38
|
exports.decodeJpeg2000 = require_image_jpeg2000.decodeJpeg2000;
|
|
51
|
-
exports.decodePng = require_image_png_decode.decodePng;
|
|
52
|
-
exports.deflate = require_bytes_flate.deflate;
|
|
53
|
-
exports.encodePng = require_image_png_encode.encodePng;
|
|
54
39
|
exports.filterScanlines = require_image_png_filter.filterScanlines;
|
|
55
|
-
exports.inflate = require_bytes_flate.inflate;
|
|
56
|
-
exports.inflateTolerant = require_bytes_flate.inflateTolerant;
|
|
57
|
-
exports.isAsciiWhitespace = require_bytes_reader.isAsciiWhitespace;
|
|
58
40
|
exports.loadMathFont = require_math_font.loadMathFont;
|
|
59
41
|
exports.looksLikeBareCodestream = require_image_jp2_boxes.looksLikeBareCodestream;
|
|
60
42
|
exports.parseJp2Container = require_image_jp2_boxes.parseJp2Container;
|
|
61
43
|
exports.pdfCodec = require_codec.pdfCodec;
|
|
62
44
|
exports.readFontFace = require_font_face.readFontFace;
|
|
63
45
|
exports.readJpeg2000Metadata = require_image_jpeg2000.readJpeg2000Metadata;
|
|
64
|
-
exports.readJpegInfo = require_image_jpeg_info.readJpegInfo;
|
|
65
46
|
exports.readPdf = require_read.readPdf;
|
|
66
47
|
exports.resolveFaceWithRegistry = require_font_registry.resolveFaceWithRegistry;
|
|
67
48
|
exports.resolveStandardFont = require_fonts.resolveStandardFont;
|
|
68
49
|
exports.scaleMathStretchConstruction = require_math_stretch.scaleMathStretchConstruction;
|
|
69
50
|
exports.unfilterScanlines = require_image_png_filter.unfilterScanlines;
|
|
70
51
|
exports.writePdf = require_write.writePdf;
|
|
52
|
+
var byte_codec = require("byte-codec");
|
|
53
|
+
Object.keys(byte_codec).forEach(function(k) {
|
|
54
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function() {
|
|
57
|
+
return byte_codec[k];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { n as STANDARD_METRICS, r as StandardFontName, t as FontMetrics } from "./afm-widths-DyDq56Ph.cjs";
|
|
2
|
-
import { crc32 } from "./bytes/crc32.cjs";
|
|
3
|
-
import { DeflateLevel, InflateResult, MAX_INFLATE_OUTPUT_BYTES, deflate, inflate, inflateTolerant } from "./bytes/flate.cjs";
|
|
4
|
-
import { ByteReader, isAsciiWhitespace } from "./bytes/reader.cjs";
|
|
5
|
-
import { ByteWriter, concatBytes } from "./bytes/writer.cjs";
|
|
6
2
|
import { t as GlyphInkBounds } from "./glyph-bounds-BV_Z40KS.cjs";
|
|
7
3
|
import { NOOP_DIAGNOSTIC_SINK, PdfDiagnostic, PdfDiagnosticSeverity, PdfDiagnosticSink, PdfEncryptedError, PdfParseError, PdfPasswordRequiredError } from "./diagnostics.cjs";
|
|
8
4
|
import { PdfBytesSchema, pdfCodec } from "./codec.cjs";
|
|
@@ -18,13 +14,10 @@ import { CcittFaxImage, CcittFaxOptions, decodeCcittFax } from "./image/ccitt.cj
|
|
|
18
14
|
import { n as Jbig2UnsupportedError, t as Jbig2ParseError } from "./jbig2-errors-Bj6MPxrx.cjs";
|
|
19
15
|
import { Jbig2DecodeOptions, Jbig2Image, decodeJbig2Embedded } from "./image/jbig2.cjs";
|
|
20
16
|
import { Jp2ChannelDefinition, Jp2ColourSpace, Jp2Container, Jp2ImageHeader, looksLikeBareCodestream, parseJp2Container } from "./image/jp2-boxes.cjs";
|
|
21
|
-
import { JpegInfo, readJpegInfo } from "./image/jpeg-info.cjs";
|
|
22
17
|
import { Jpeg2000ProgressionOrder, Jpeg2000QuantizationStyle, Jpeg2000Transform } from "./image/jpeg2000-codestream.cjs";
|
|
23
18
|
import { Jpeg2000ParseError, Jpeg2000UnsupportedError } from "./image/jpeg2000-errors.cjs";
|
|
24
19
|
import { Jpeg2000ComponentMetadata, Jpeg2000DecodeOptions, Jpeg2000Image, Jpeg2000Metadata, decodeJpeg2000, readJpeg2000Metadata } from "./image/jpeg2000.cjs";
|
|
25
|
-
import {
|
|
26
|
-
import { PngEncodeOptions, encodePng } from "./image/png-encode.cjs";
|
|
27
|
-
import { PngFilterType, filterScanlines, unfilterScanlines } from "./image/png-filter.cjs";
|
|
20
|
+
import { filterScanlines, unfilterScanlines } from "./image/png-filter.cjs";
|
|
28
21
|
import { ReadPdfOptions, readPdf } from "./read.cjs";
|
|
29
22
|
import { WritePdfOptions, writePdf } from "./write.cjs";
|
|
30
23
|
import { a as MathGlyphPart, c as MathVariants, n as MathGlyphAssembly, o as MathGlyphVariant, r as MathGlyphConstruction } from "./math-table-gFNB8DmQ.cjs";
|
|
@@ -32,4 +25,5 @@ import { a as scaleMathStretchConstruction, i as assembleStretchyGlyph, n as Mat
|
|
|
32
25
|
import { LoadedMathFont, MathFont, MathFontDescriptorMetrics, loadMathFont } from "./math-font.cjs";
|
|
33
26
|
import { StyledFragment, StyledRun, WrapOptions, WrappedLine } from "./text-layout.cjs";
|
|
34
27
|
import { MathAssembledGlyphs, MathBox, MathColor, MathFontMetrics, MathGlyphMetrics, MathGlyphPlacement, MathGlyphRun, MathLayoutItem, MathRule, MathStretchAxis, MathStretchGlyph, MathStretchResult, MathStroke } from "document-schema.js";
|
|
35
|
-
export
|
|
28
|
+
export * from "byte-codec";
|
|
29
|
+
export { type CcittFaxImage, type CcittFaxOptions, DEFAULT_VERTICAL_METRIC_POLICY, type EmbeddedFace, type EmbeddedFaceMetrics, type EmbeddedFaceSubstitution, type FontFace, FontFaceParseError, type FontMeasurerOptions, type FontMetrics, type FontRegistry, type FontRegistryOptions, type FontSubstitution, type GlyphInkBounds, type Jbig2DecodeOptions, type Jbig2Image, Jbig2ParseError, Jbig2UnsupportedError, type Jp2ChannelDefinition, type Jp2ColourSpace, type Jp2Container, type Jp2ImageHeader, type Jpeg2000ComponentMetadata, type Jpeg2000DecodeOptions, type Jpeg2000Image, type Jpeg2000Metadata, Jpeg2000ParseError, type Jpeg2000ProgressionOrder, type Jpeg2000QuantizationStyle, type Jpeg2000Transform, Jpeg2000UnsupportedError, type LoadedMathFont, type MathAssembledGlyphs, type MathBox, type MathColor, type MathFont, type MathFontDescriptorMetrics, type MathFontMetrics, type MathGlyphAssembly, type MathGlyphConstruction, type MathGlyphMetrics, type MathGlyphPart, type MathGlyphPlacement, type MathGlyphRun, type MathGlyphVariant, type MathLayoutItem, type MathRule, type MathStretchAxis, type MathStretchConstruction, type MathStretchGlyph, type MathStretchOptions, type MathStretchPlacement, type MathStretchResult, type MathStroke, type MathVariants, NOOP_DIAGNOSTIC_SINK, PdfBytesSchema, type PdfDiagnostic, type PdfDiagnosticSeverity, type PdfDiagnosticSink, PdfEncryptedError, PdfParseError, PdfPasswordRequiredError, type Point, type PositionedFormula, type ProvidedFont, type ReadPdfOptions, type ResolvedFace, type ResolvedFont, STANDARD_METRICS, type StandardFontMeasurerOptions, type StandardFontName, type StyledFragment, type StyledRun, type TextMeasurer, type UnderlineMetrics, type VerticalMetricPolicy, type WinAnsiSubstitution, type WrapOptions, type WrappedLine, type WritePdfOptions, assembleStretchyGlyph, createFontMeasurer, createFontRegistry, createStandardFontMeasurer, decodeCcittFax, decodeJbig2Embedded, decodeJpeg2000, filterScanlines, loadMathFont, looksLikeBareCodestream, parseJp2Container, pdfCodec, readFontFace, readJpeg2000Metadata, readPdf, resolveFaceWithRegistry, resolveStandardFont, scaleMathStretchConstruction, unfilterScanlines, writePdf };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { n as STANDARD_METRICS, r as StandardFontName, t as FontMetrics } from "./afm-widths-DyDq56Ph.js";
|
|
2
|
-
import { crc32 } from "./bytes/crc32.js";
|
|
3
|
-
import { DeflateLevel, InflateResult, MAX_INFLATE_OUTPUT_BYTES, deflate, inflate, inflateTolerant } from "./bytes/flate.js";
|
|
4
|
-
import { ByteReader, isAsciiWhitespace } from "./bytes/reader.js";
|
|
5
|
-
import { ByteWriter, concatBytes } from "./bytes/writer.js";
|
|
6
2
|
import { t as GlyphInkBounds } from "./glyph-bounds-BV_Z40KS.js";
|
|
7
3
|
import { NOOP_DIAGNOSTIC_SINK, PdfDiagnostic, PdfDiagnosticSeverity, PdfDiagnosticSink, PdfEncryptedError, PdfParseError, PdfPasswordRequiredError } from "./diagnostics.js";
|
|
8
4
|
import { PdfBytesSchema, pdfCodec } from "./codec.js";
|
|
@@ -18,13 +14,10 @@ import { CcittFaxImage, CcittFaxOptions, decodeCcittFax } from "./image/ccitt.js
|
|
|
18
14
|
import { n as Jbig2UnsupportedError, t as Jbig2ParseError } from "./jbig2-errors-Bj6MPxrx.js";
|
|
19
15
|
import { Jbig2DecodeOptions, Jbig2Image, decodeJbig2Embedded } from "./image/jbig2.js";
|
|
20
16
|
import { Jp2ChannelDefinition, Jp2ColourSpace, Jp2Container, Jp2ImageHeader, looksLikeBareCodestream, parseJp2Container } from "./image/jp2-boxes.js";
|
|
21
|
-
import { JpegInfo, readJpegInfo } from "./image/jpeg-info.js";
|
|
22
17
|
import { Jpeg2000ProgressionOrder, Jpeg2000QuantizationStyle, Jpeg2000Transform } from "./image/jpeg2000-codestream.js";
|
|
23
18
|
import { Jpeg2000ParseError, Jpeg2000UnsupportedError } from "./image/jpeg2000-errors.js";
|
|
24
19
|
import { Jpeg2000ComponentMetadata, Jpeg2000DecodeOptions, Jpeg2000Image, Jpeg2000Metadata, decodeJpeg2000, readJpeg2000Metadata } from "./image/jpeg2000.js";
|
|
25
|
-
import {
|
|
26
|
-
import { PngEncodeOptions, encodePng } from "./image/png-encode.js";
|
|
27
|
-
import { PngFilterType, filterScanlines, unfilterScanlines } from "./image/png-filter.js";
|
|
20
|
+
import { filterScanlines, unfilterScanlines } from "./image/png-filter.js";
|
|
28
21
|
import { ReadPdfOptions, readPdf } from "./read.js";
|
|
29
22
|
import { WritePdfOptions, writePdf } from "./write.js";
|
|
30
23
|
import { a as MathGlyphPart, c as MathVariants, n as MathGlyphAssembly, o as MathGlyphVariant, r as MathGlyphConstruction } from "./math-table-DhPrNoPa.js";
|
|
@@ -32,4 +25,5 @@ import { a as scaleMathStretchConstruction, i as assembleStretchyGlyph, n as Mat
|
|
|
32
25
|
import { LoadedMathFont, MathFont, MathFontDescriptorMetrics, loadMathFont } from "./math-font.js";
|
|
33
26
|
import { StyledFragment, StyledRun, WrapOptions, WrappedLine } from "./text-layout.js";
|
|
34
27
|
import { MathAssembledGlyphs, MathBox, MathColor, MathFontMetrics, MathGlyphMetrics, MathGlyphPlacement, MathGlyphRun, MathLayoutItem, MathRule, MathStretchAxis, MathStretchGlyph, MathStretchResult, MathStroke } from "document-schema.js";
|
|
35
|
-
export
|
|
28
|
+
export * from "byte-codec";
|
|
29
|
+
export { type CcittFaxImage, type CcittFaxOptions, DEFAULT_VERTICAL_METRIC_POLICY, type EmbeddedFace, type EmbeddedFaceMetrics, type EmbeddedFaceSubstitution, type FontFace, FontFaceParseError, type FontMeasurerOptions, type FontMetrics, type FontRegistry, type FontRegistryOptions, type FontSubstitution, type GlyphInkBounds, type Jbig2DecodeOptions, type Jbig2Image, Jbig2ParseError, Jbig2UnsupportedError, type Jp2ChannelDefinition, type Jp2ColourSpace, type Jp2Container, type Jp2ImageHeader, type Jpeg2000ComponentMetadata, type Jpeg2000DecodeOptions, type Jpeg2000Image, type Jpeg2000Metadata, Jpeg2000ParseError, type Jpeg2000ProgressionOrder, type Jpeg2000QuantizationStyle, type Jpeg2000Transform, Jpeg2000UnsupportedError, type LoadedMathFont, type MathAssembledGlyphs, type MathBox, type MathColor, type MathFont, type MathFontDescriptorMetrics, type MathFontMetrics, type MathGlyphAssembly, type MathGlyphConstruction, type MathGlyphMetrics, type MathGlyphPart, type MathGlyphPlacement, type MathGlyphRun, type MathGlyphVariant, type MathLayoutItem, type MathRule, type MathStretchAxis, type MathStretchConstruction, type MathStretchGlyph, type MathStretchOptions, type MathStretchPlacement, type MathStretchResult, type MathStroke, type MathVariants, NOOP_DIAGNOSTIC_SINK, PdfBytesSchema, type PdfDiagnostic, type PdfDiagnosticSeverity, type PdfDiagnosticSink, PdfEncryptedError, PdfParseError, PdfPasswordRequiredError, type Point, type PositionedFormula, type ProvidedFont, type ReadPdfOptions, type ResolvedFace, type ResolvedFont, STANDARD_METRICS, type StandardFontMeasurerOptions, type StandardFontName, type StyledFragment, type StyledRun, type TextMeasurer, type UnderlineMetrics, type VerticalMetricPolicy, type WinAnsiSubstitution, type WrapOptions, type WrappedLine, type WritePdfOptions, assembleStretchyGlyph, createFontMeasurer, createFontRegistry, createStandardFontMeasurer, decodeCcittFax, decodeJbig2Embedded, decodeJpeg2000, filterScanlines, loadMathFont, looksLikeBareCodestream, parseJp2Container, pdfCodec, readFontFace, readJpeg2000Metadata, readPdf, resolveFaceWithRegistry, resolveStandardFont, scaleMathStretchConstruction, unfilterScanlines, writePdf };
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
import { t as STANDARD_METRICS } from "./afm-widths-Dxucrg7D.js";
|
|
2
|
-
import { ByteReader, isAsciiWhitespace } from "./bytes/reader.js";
|
|
3
|
-
import { crc32 } from "./bytes/crc32.js";
|
|
4
|
-
import { ByteWriter, concatBytes } from "./bytes/writer.js";
|
|
5
2
|
import { NOOP_DIAGNOSTIC_SINK, PdfEncryptedError, PdfParseError, PdfPasswordRequiredError } from "./diagnostics.js";
|
|
6
|
-
import { MAX_INFLATE_OUTPUT_BYTES, deflate, inflate, inflateTolerant } from "./bytes/flate.js";
|
|
7
3
|
import { decodeCcittFax } from "./image/ccitt.js";
|
|
8
4
|
import { Jbig2ParseError, Jbig2UnsupportedError } from "./image/jbig2-errors.js";
|
|
9
5
|
import { decodeJbig2Embedded } from "./image/jbig2.js";
|
|
10
6
|
import { filterScanlines, unfilterScanlines } from "./image/png-filter.js";
|
|
11
7
|
import { resolveStandardFont } from "./fonts.js";
|
|
12
|
-
import { encodePng } from "./image/png-encode.js";
|
|
13
|
-
import { readJpegInfo } from "./image/jpeg-info.js";
|
|
14
8
|
import { Jpeg2000ParseError, Jpeg2000UnsupportedError } from "./image/jpeg2000-errors.js";
|
|
15
9
|
import { looksLikeBareCodestream, parseJp2Container } from "./image/jp2-boxes.js";
|
|
16
10
|
import { decodeJpeg2000, readJpeg2000Metadata } from "./image/jpeg2000.js";
|
|
17
|
-
import { decodePng } from "./image/png-decode.js";
|
|
18
11
|
import { createFontRegistry, resolveFaceWithRegistry } from "./font-registry.js";
|
|
19
12
|
import { assembleStretchyGlyph, scaleMathStretchConstruction } from "./math-stretch.js";
|
|
20
13
|
import { loadMathFont } from "./math-font.js";
|
|
@@ -23,4 +16,5 @@ import { writePdf } from "./write.js";
|
|
|
23
16
|
import { readPdf } from "./read.js";
|
|
24
17
|
import { PdfBytesSchema, pdfCodec } from "./codec.js";
|
|
25
18
|
import { FontFaceParseError, readFontFace } from "./font-face.js";
|
|
26
|
-
export
|
|
19
|
+
export * from "byte-codec";
|
|
20
|
+
export { DEFAULT_VERTICAL_METRIC_POLICY, FontFaceParseError, Jbig2ParseError, Jbig2UnsupportedError, Jpeg2000ParseError, Jpeg2000UnsupportedError, NOOP_DIAGNOSTIC_SINK, PdfBytesSchema, PdfEncryptedError, PdfParseError, PdfPasswordRequiredError, STANDARD_METRICS, assembleStretchyGlyph, createFontMeasurer, createFontRegistry, createStandardFontMeasurer, decodeCcittFax, decodeJbig2Embedded, decodeJpeg2000, filterScanlines, loadMathFont, looksLikeBareCodestream, parseJp2Container, pdfCodec, readFontFace, readJpeg2000Metadata, readPdf, resolveFaceWithRegistry, resolveStandardFont, scaleMathStretchConstruction, unfilterScanlines, writePdf };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pdf-codec",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Hand-written, dependency-minimal PDF codec: parses arbitrary real-world PDFs and generates new ones, built on document-schema.js's LayoutDocument pivot and Zod 4 codecs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"lint": "eslint . --fix --cache --max-warnings 0",
|
|
51
51
|
"typecheck": "tsc --noEmit",
|
|
52
52
|
"test": "vitest run --project unit",
|
|
53
|
+
"test:workers": "vitest run --config vitest.workers.config.ts",
|
|
53
54
|
"test:watch": "vitest --project unit",
|
|
54
55
|
"test:coverage": "vitest run --project unit --coverage",
|
|
55
56
|
"test:corpus": "vitest run --project corpus",
|
|
@@ -70,12 +71,14 @@
|
|
|
70
71
|
"license": "MIT",
|
|
71
72
|
"packageManager": "pnpm@11.6.0",
|
|
72
73
|
"dependencies": {
|
|
73
|
-
"
|
|
74
|
+
"byte-codec": "^1.0.4",
|
|
75
|
+
"document-schema.js": "^2.4.4",
|
|
74
76
|
"fflate": "^0.8.3",
|
|
75
77
|
"zod": "^4.4.3"
|
|
76
78
|
},
|
|
77
79
|
"devDependencies": {
|
|
78
80
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
81
|
+
"@cloudflare/vitest-pool-workers": "^0.20.2",
|
|
79
82
|
"@commitlint/cli": "^21.2.1",
|
|
80
83
|
"@commitlint/config-conventional": "^21.2.0",
|
|
81
84
|
"@eslint/js": "^10.0.1",
|