pdf-codec 3.4.3 → 3.5.0
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 +48 -27
- package/dist/{afm-widths-Dxucrg7D.js → afm-widths-BLl6ORCt.js} +2 -2
- package/dist/{afm-widths-BoeTOK2r.cjs → afm-widths-Cj9d3GVK.cjs} +2 -2
- package/dist/{afm-widths-DyDq56Ph.d.cts → afm-widths-CneRyu5l.d.cts} +1 -1
- package/dist/{afm-widths-DyDq56Ph.d.ts → afm-widths-CneRyu5l.d.ts} +1 -1
- package/dist/afm-widths.cjs +1 -1
- package/dist/afm-widths.d.cts +1 -1
- package/dist/afm-widths.d.ts +1 -1
- package/dist/afm-widths.js +1 -1
- package/dist/content-read.d.cts +2 -2
- package/dist/content-read.d.ts +2 -2
- package/dist/content-write.cjs +1 -1
- package/dist/content-write.d.cts +3 -3
- package/dist/content-write.d.ts +3 -3
- package/dist/content-write.js +1 -1
- package/dist/diagnostics.d.cts +1 -1
- package/dist/diagnostics.d.ts +1 -1
- package/dist/encoding.cjs +1 -1
- package/dist/encoding.js +1 -1
- package/dist/encrypt.d.cts +1 -1
- package/dist/encrypt.d.ts +1 -1
- package/dist/filters.cjs +14 -10
- package/dist/filters.js +14 -10
- package/dist/font-read.cjs +1 -1
- 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/font-substitutes.d.cts +1 -1
- package/dist/font-substitutes.d.ts +1 -1
- package/dist/fonts.d.cts +2 -2
- package/dist/fonts.d.ts +2 -2
- package/dist/image/jbig2-bitmap.d.cts +1 -1
- package/dist/image/jbig2-bitmap.d.ts +1 -1
- package/dist/image/jbig2.cjs +3 -1
- package/dist/image/jbig2.js +3 -1
- package/dist/image/jp2-boxes.d.cts +1 -1
- package/dist/image/jp2-boxes.d.ts +1 -1
- package/dist/image/jpeg2000-codestream.d.cts +3 -3
- package/dist/image/jpeg2000-codestream.d.ts +3 -3
- package/dist/image/jpeg2000-t1.d.cts +1 -1
- package/dist/image/jpeg2000-t1.d.ts +1 -1
- package/dist/image/png-encode.d.cts +1 -1
- package/dist/image/png-encode.d.ts +1 -1
- package/dist/image/png-filter.d.cts +1 -1
- package/dist/image/png-filter.d.ts +1 -1
- package/dist/images-read.cjs +7 -5
- package/dist/images-read.d.cts +1 -1
- package/dist/images-read.d.ts +1 -1
- package/dist/images-read.js +7 -5
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/interpret.d.cts +10 -10
- package/dist/interpret.d.ts +10 -10
- package/dist/layout.d.cts +1 -1
- package/dist/layout.d.ts +1 -1
- package/dist/lexer.d.cts +9 -9
- package/dist/lexer.d.ts +9 -9
- package/dist/math-font.d.cts +1 -1
- package/dist/math-font.d.ts +1 -1
- package/dist/{math-stretch-a_rHNRvc.d.ts → math-stretch-BbC2o4Br.d.ts} +1 -1
- package/dist/{math-stretch-E26z6byT.d.cts → math-stretch-C2JanDAz.d.cts} +1 -1
- package/dist/math-stretch.d.cts +1 -1
- package/dist/math-stretch.d.ts +1 -1
- package/dist/measure.cjs +1 -1
- package/dist/measure.d.cts +1 -1
- package/dist/measure.d.ts +1 -1
- package/dist/measure.js +1 -1
- package/dist/objects.d.cts +12 -12
- package/dist/objects.d.ts +12 -12
- package/dist/util/base64.cjs +4 -4
- package/dist/util/base64.js +4 -4
- package/dist/winansi.cjs +1 -1
- package/dist/winansi.d.cts +1 -1
- package/dist/winansi.d.ts +1 -1
- package/dist/winansi.js +1 -1
- package/dist/write.cjs +1 -1
- package/dist/write.js +1 -1
- package/dist/xref.d.cts +2 -2
- package/dist/xref.d.ts +2 -2
- package/package.json +3 -11
package/dist/objects.d.cts
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
//#region src/objects.d.ts
|
|
2
2
|
type PdfObject = {
|
|
3
|
-
kind:
|
|
3
|
+
kind: "null";
|
|
4
4
|
} | {
|
|
5
|
-
kind:
|
|
5
|
+
kind: "bool";
|
|
6
6
|
value: boolean;
|
|
7
7
|
} | {
|
|
8
|
-
kind:
|
|
8
|
+
kind: "number";
|
|
9
9
|
value: number;
|
|
10
10
|
} | {
|
|
11
|
-
kind:
|
|
11
|
+
kind: "name";
|
|
12
12
|
name: string;
|
|
13
13
|
} | {
|
|
14
|
-
kind:
|
|
14
|
+
kind: "string";
|
|
15
15
|
bytes: Uint8Array<ArrayBuffer>;
|
|
16
16
|
hex: boolean;
|
|
17
17
|
} | {
|
|
18
|
-
kind:
|
|
18
|
+
kind: "array";
|
|
19
19
|
items: PdfObject[];
|
|
20
20
|
} | {
|
|
21
|
-
kind:
|
|
21
|
+
kind: "dict";
|
|
22
22
|
entries: Map<string, PdfObject>;
|
|
23
23
|
} | {
|
|
24
|
-
kind:
|
|
24
|
+
kind: "stream";
|
|
25
25
|
dict: PdfDict;
|
|
26
26
|
raw: Uint8Array<ArrayBuffer>;
|
|
27
27
|
} | {
|
|
28
|
-
kind:
|
|
28
|
+
kind: "ref";
|
|
29
29
|
num: number;
|
|
30
30
|
gen: number;
|
|
31
31
|
};
|
|
32
32
|
type PdfDict = Extract<PdfObject, {
|
|
33
|
-
kind:
|
|
33
|
+
kind: "dict";
|
|
34
34
|
}>;
|
|
35
35
|
type PdfArray = Extract<PdfObject, {
|
|
36
|
-
kind:
|
|
36
|
+
kind: "array";
|
|
37
37
|
}>;
|
|
38
38
|
type PdfStream = Extract<PdfObject, {
|
|
39
|
-
kind:
|
|
39
|
+
kind: "stream";
|
|
40
40
|
}>;
|
|
41
41
|
declare function pdfNull(): PdfObject;
|
|
42
42
|
declare function pdfBool(value: boolean): PdfObject;
|
package/dist/objects.d.ts
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
//#region src/objects.d.ts
|
|
2
2
|
type PdfObject = {
|
|
3
|
-
kind:
|
|
3
|
+
kind: "null";
|
|
4
4
|
} | {
|
|
5
|
-
kind:
|
|
5
|
+
kind: "bool";
|
|
6
6
|
value: boolean;
|
|
7
7
|
} | {
|
|
8
|
-
kind:
|
|
8
|
+
kind: "number";
|
|
9
9
|
value: number;
|
|
10
10
|
} | {
|
|
11
|
-
kind:
|
|
11
|
+
kind: "name";
|
|
12
12
|
name: string;
|
|
13
13
|
} | {
|
|
14
|
-
kind:
|
|
14
|
+
kind: "string";
|
|
15
15
|
bytes: Uint8Array<ArrayBuffer>;
|
|
16
16
|
hex: boolean;
|
|
17
17
|
} | {
|
|
18
|
-
kind:
|
|
18
|
+
kind: "array";
|
|
19
19
|
items: PdfObject[];
|
|
20
20
|
} | {
|
|
21
|
-
kind:
|
|
21
|
+
kind: "dict";
|
|
22
22
|
entries: Map<string, PdfObject>;
|
|
23
23
|
} | {
|
|
24
|
-
kind:
|
|
24
|
+
kind: "stream";
|
|
25
25
|
dict: PdfDict;
|
|
26
26
|
raw: Uint8Array<ArrayBuffer>;
|
|
27
27
|
} | {
|
|
28
|
-
kind:
|
|
28
|
+
kind: "ref";
|
|
29
29
|
num: number;
|
|
30
30
|
gen: number;
|
|
31
31
|
};
|
|
32
32
|
type PdfDict = Extract<PdfObject, {
|
|
33
|
-
kind:
|
|
33
|
+
kind: "dict";
|
|
34
34
|
}>;
|
|
35
35
|
type PdfArray = Extract<PdfObject, {
|
|
36
|
-
kind:
|
|
36
|
+
kind: "array";
|
|
37
37
|
}>;
|
|
38
38
|
type PdfStream = Extract<PdfObject, {
|
|
39
|
-
kind:
|
|
39
|
+
kind: "stream";
|
|
40
40
|
}>;
|
|
41
41
|
declare function pdfNull(): PdfObject;
|
|
42
42
|
declare function pdfBool(value: boolean): PdfObject;
|
package/dist/util/base64.cjs
CHANGED
|
@@ -13,10 +13,10 @@ function bytesToBase64(bytes) {
|
|
|
13
13
|
const b0 = bytes[i];
|
|
14
14
|
const b1 = i + 1 < len ? bytes[i + 1] : 0;
|
|
15
15
|
const b2 = i + 2 < len ? bytes[i + 2] : 0;
|
|
16
|
-
out += TABLE
|
|
17
|
-
out += TABLE
|
|
18
|
-
out += i + 1 < len ? TABLE
|
|
19
|
-
out += i + 2 < len ? TABLE
|
|
16
|
+
out += TABLE.charAt(b0 >> 2);
|
|
17
|
+
out += TABLE.charAt((b0 & 3) << 4 | b1 >> 4);
|
|
18
|
+
out += i + 1 < len ? TABLE.charAt((b1 & 15) << 2 | b2 >> 6) : "=";
|
|
19
|
+
out += i + 2 < len ? TABLE.charAt(b2 & 63) : "=";
|
|
20
20
|
}
|
|
21
21
|
return out;
|
|
22
22
|
}
|
package/dist/util/base64.js
CHANGED
|
@@ -12,10 +12,10 @@ function bytesToBase64(bytes) {
|
|
|
12
12
|
const b0 = bytes[i];
|
|
13
13
|
const b1 = i + 1 < len ? bytes[i + 1] : 0;
|
|
14
14
|
const b2 = i + 2 < len ? bytes[i + 2] : 0;
|
|
15
|
-
out += TABLE
|
|
16
|
-
out += TABLE
|
|
17
|
-
out += i + 1 < len ? TABLE
|
|
18
|
-
out += i + 2 < len ? TABLE
|
|
15
|
+
out += TABLE.charAt(b0 >> 2);
|
|
16
|
+
out += TABLE.charAt((b0 & 3) << 4 | b1 >> 4);
|
|
17
|
+
out += i + 1 < len ? TABLE.charAt((b1 & 15) << 2 | b2 >> 6) : "=";
|
|
18
|
+
out += i + 2 < len ? TABLE.charAt(b2 & 63) : "=";
|
|
19
19
|
}
|
|
20
20
|
return out;
|
|
21
21
|
}
|
package/dist/winansi.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-Cj9d3GVK.cjs");
|
|
3
3
|
exports.encodeForShow = require_afm_widths.encodeForShow;
|
|
4
4
|
exports.sanitizeToWinAnsi = require_afm_widths.sanitizeToWinAnsi;
|
|
5
5
|
exports.winAnsiCodeToUnicode = require_afm_widths.winAnsiCodeToUnicode;
|
package/dist/winansi.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as StandardFontName } from "./afm-widths-
|
|
1
|
+
import { r as StandardFontName } from "./afm-widths-CneRyu5l.cjs";
|
|
2
2
|
//#region src/winansi.d.ts
|
|
3
3
|
declare function winAnsiCodeToUnicode(code: number): number | undefined;
|
|
4
4
|
interface WinAnsiSubstitution {
|
package/dist/winansi.d.ts
CHANGED
package/dist/winansi.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { c as winAnsiCodeToUnicode, o as encodeForShow, s as sanitizeToWinAnsi } from "./afm-widths-
|
|
1
|
+
import { c as winAnsiCodeToUnicode, o as encodeForShow, s as sanitizeToWinAnsi } from "./afm-widths-BLl6ORCt.js";
|
|
2
2
|
export { encodeForShow, sanitizeToWinAnsi, winAnsiCodeToUnicode };
|
package/dist/write.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-Cj9d3GVK.cjs");
|
|
3
3
|
const require_notes_annotation_author = require("./notes-annotation-author.cjs");
|
|
4
4
|
const require_objects = require("./objects.cjs");
|
|
5
5
|
const require_bytes_writer = require("./bytes/writer.cjs");
|
package/dist/write.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as winAnsiGlyphName, n as widthOfCode, t as STANDARD_METRICS } from "./afm-widths-
|
|
1
|
+
import { a as winAnsiGlyphName, n as widthOfCode, t as STANDARD_METRICS } from "./afm-widths-BLl6ORCt.js";
|
|
2
2
|
import { NOTES_ANNOTATION_AUTHOR } from "./notes-annotation-author.js";
|
|
3
3
|
import { pdfArray, pdfDict, pdfHexString, pdfName, pdfNull, pdfNum, pdfRef, pdfStream } from "./objects.js";
|
|
4
4
|
import { ByteWriter, concatBytes } from "./bytes/writer.js";
|
package/dist/xref.d.cts
CHANGED
|
@@ -2,12 +2,12 @@ import { PdfDiagnosticSink } from "./diagnostics.cjs";
|
|
|
2
2
|
import { PdfDict } from "./objects.cjs";
|
|
3
3
|
//#region src/xref.d.ts
|
|
4
4
|
interface XrefOffsetEntry {
|
|
5
|
-
readonly type:
|
|
5
|
+
readonly type: "offset";
|
|
6
6
|
readonly offset: number;
|
|
7
7
|
readonly gen: number;
|
|
8
8
|
}
|
|
9
9
|
interface XrefCompressedEntry {
|
|
10
|
-
readonly type:
|
|
10
|
+
readonly type: "compressed";
|
|
11
11
|
readonly streamObjNum: number;
|
|
12
12
|
readonly indexInStream: number;
|
|
13
13
|
}
|
package/dist/xref.d.ts
CHANGED
|
@@ -2,12 +2,12 @@ import { PdfDiagnosticSink } from "./diagnostics.js";
|
|
|
2
2
|
import { PdfDict } from "./objects.js";
|
|
3
3
|
//#region src/xref.d.ts
|
|
4
4
|
interface XrefOffsetEntry {
|
|
5
|
-
readonly type:
|
|
5
|
+
readonly type: "offset";
|
|
6
6
|
readonly offset: number;
|
|
7
7
|
readonly gen: number;
|
|
8
8
|
}
|
|
9
9
|
interface XrefCompressedEntry {
|
|
10
|
-
readonly type:
|
|
10
|
+
readonly type: "compressed";
|
|
11
11
|
readonly streamObjNum: number;
|
|
12
12
|
readonly indexInStream: number;
|
|
13
13
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pdf-codec",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
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": {
|
|
@@ -97,26 +97,18 @@
|
|
|
97
97
|
"license": "MIT",
|
|
98
98
|
"packageManager": "pnpm@11.6.0",
|
|
99
99
|
"dependencies": {
|
|
100
|
-
"byte-codec": "^1.
|
|
101
|
-
"document-schema.js": "^
|
|
100
|
+
"byte-codec": "^1.2.0",
|
|
101
|
+
"document-schema.js": "^5.1.0",
|
|
102
102
|
"fflate": "^0.8.3",
|
|
103
103
|
"zod": "^4.4.3"
|
|
104
104
|
},
|
|
105
105
|
"devDependencies": {
|
|
106
106
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
107
107
|
"@cloudflare/vitest-pool-workers": "^0.21.2",
|
|
108
|
-
"@commitlint/cli": "^21.2.1",
|
|
109
|
-
"@commitlint/config-conventional": "^21.2.0",
|
|
110
|
-
"@eslint/js": "^10.0.1",
|
|
111
|
-
"@exadev/eslint-config": "^2.1.0",
|
|
112
|
-
"@semantic-release/changelog": "^7.0.0",
|
|
113
|
-
"@semantic-release/git": "^11.0.1",
|
|
114
108
|
"@types/node": "^26.1.1",
|
|
115
109
|
"@vitest/coverage-v8": "^4.1.10",
|
|
116
110
|
"eslint": "^10.8.0",
|
|
117
|
-
"globals": "^17.8.0",
|
|
118
111
|
"husky": "^9.1.7",
|
|
119
|
-
"lint-staged": "^17.2.0",
|
|
120
112
|
"publint": "^0.3.21",
|
|
121
113
|
"semantic-release": "^25.0.8",
|
|
122
114
|
"tsdown": "^0.22.13",
|