js.documents 1.92.0 → 1.92.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/dist/edit/pdf/util.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
let ooxml_js = require("ooxml.js");
|
|
3
|
-
let
|
|
3
|
+
let byte_codec = require("byte-codec");
|
|
4
4
|
//#region src/edit/pdf/util.ts
|
|
5
5
|
function spliceOut(container, node) {
|
|
6
6
|
const index = container.indexOf(node);
|
|
@@ -8,20 +8,20 @@ function spliceOut(container, node) {
|
|
|
8
8
|
}
|
|
9
9
|
function decodeImageDimensions(format, bytes) {
|
|
10
10
|
if (format === "jpeg") {
|
|
11
|
-
const info = (0,
|
|
11
|
+
const info = (0, byte_codec.readJpegInfo)(bytes);
|
|
12
12
|
return {
|
|
13
13
|
widthPx: info.width,
|
|
14
14
|
heightPx: info.height
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
const raw = (0,
|
|
17
|
+
const raw = (0, byte_codec.decodePng)(bytes);
|
|
18
18
|
return {
|
|
19
19
|
widthPx: raw.width,
|
|
20
20
|
heightPx: raw.height
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
function registerImageBytes(bytes, format, images) {
|
|
24
|
-
const imageId = `img${(0,
|
|
24
|
+
const imageId = `img${(0, byte_codec.crc32)(bytes).toString(16)}`;
|
|
25
25
|
if (!(imageId in images)) {
|
|
26
26
|
const { widthPx, heightPx } = decodeImageDimensions(format, bytes);
|
|
27
27
|
images[imageId] = {
|
package/dist/edit/pdf/util.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { bytesToBase64 } from "ooxml.js";
|
|
2
|
-
import { crc32, decodePng, readJpegInfo } from "
|
|
2
|
+
import { crc32, decodePng, readJpegInfo } from "byte-codec";
|
|
3
3
|
//#region src/edit/pdf/util.ts
|
|
4
4
|
function spliceOut(container, node) {
|
|
5
5
|
const index = container.indexOf(node);
|
package/dist/layout/shared.cjs
CHANGED
|
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_mathml_layout = require("../mathml/layout.cjs");
|
|
3
3
|
const require_layout_text_layout = require("./text-layout.cjs");
|
|
4
4
|
let ooxml_js = require("ooxml.js");
|
|
5
|
-
let
|
|
5
|
+
let byte_codec = require("byte-codec");
|
|
6
6
|
let document_schema_js = require("document-schema.js");
|
|
7
7
|
//#region src/layout/shared.ts
|
|
8
8
|
const NOMINAL_TEXT_SIZE_PT = 18;
|
|
@@ -111,13 +111,13 @@ function pushCellBorderLines(borders, frameYDown, pageHeightPt, sourcePath, out)
|
|
|
111
111
|
}
|
|
112
112
|
function decodeImageDimensions(format, bytes) {
|
|
113
113
|
if (format === "jpeg") {
|
|
114
|
-
const info = (0,
|
|
114
|
+
const info = (0, byte_codec.readJpegInfo)(bytes);
|
|
115
115
|
return {
|
|
116
116
|
widthPx: info.width,
|
|
117
117
|
heightPx: info.height
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
|
-
const raw = (0,
|
|
120
|
+
const raw = (0, byte_codec.decodePng)(bytes);
|
|
121
121
|
return {
|
|
122
122
|
widthPx: raw.width,
|
|
123
123
|
heightPx: raw.height
|
|
@@ -125,7 +125,7 @@ function decodeImageDimensions(format, bytes) {
|
|
|
125
125
|
}
|
|
126
126
|
function registerImage(block, images) {
|
|
127
127
|
const bytes = (0, ooxml_js.base64ToBytes)(block.base64);
|
|
128
|
-
const imageId = `img${(0,
|
|
128
|
+
const imageId = `img${(0, byte_codec.crc32)(bytes).toString(16)}`;
|
|
129
129
|
if (!(imageId in images)) {
|
|
130
130
|
const { widthPx, heightPx } = decodeImageDimensions(block.format, bytes);
|
|
131
131
|
images[imageId] = {
|
package/dist/layout/shared.js
CHANGED
|
@@ -3,7 +3,7 @@ import { DEFAULT_LAYOUT_FONT } from "../model/style.js";
|
|
|
3
3
|
import { layoutFormula } from "../mathml/layout.js";
|
|
4
4
|
import { wrapRunsToWidth } from "./text-layout.js";
|
|
5
5
|
import { base64ToBytes } from "ooxml.js";
|
|
6
|
-
import { crc32, decodePng, readJpegInfo } from "
|
|
6
|
+
import { crc32, decodePng, readJpegInfo } from "byte-codec";
|
|
7
7
|
//#region src/layout/shared.ts
|
|
8
8
|
const NOMINAL_TEXT_SIZE_PT = 18;
|
|
9
9
|
const MIN_FORMULA_SIZE_PT = 8;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "js.documents",
|
|
3
|
-
"version": "1.92.
|
|
3
|
+
"version": "1.92.2",
|
|
4
4
|
"description": "Bidirectional docx/pptx <-> PDF conversion and a read+write editable OOXML document model, built on ooxml.js and Zod 4 codecs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
],
|
|
59
59
|
"license": "MIT",
|
|
60
60
|
"dependencies": {
|
|
61
|
+
"byte-codec": "^1.0.2",
|
|
61
62
|
"document-schema.js": "^2.4.0",
|
|
62
63
|
"fflate": "^0.8.3",
|
|
63
64
|
"markdown-codec": "^1.1.10",
|