js.documents 6.4.1 → 6.5.1
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 +72 -29
- package/dist/codecs/read.cjs +15 -0
- package/dist/codecs/read.js +15 -0
- package/dist/codecs/registry.cjs +18 -0
- package/dist/codecs/registry.js +18 -0
- package/dist/convert/capability.cjs +18 -0
- package/dist/convert/capability.js +18 -0
- package/dist/convert/codec.cjs +15 -0
- package/dist/convert/codec.d.cts +4 -1
- package/dist/convert/codec.d.ts +4 -1
- package/dist/convert/codec.js +16 -4
- package/dist/convert/composition.cjs +59 -4
- package/dist/convert/composition.d.cts +2 -2
- package/dist/convert/composition.d.ts +2 -2
- package/dist/convert/composition.js +59 -4
- package/dist/convert/convert.cjs +12 -0
- package/dist/convert/convert.d.cts +4 -1
- package/dist/convert/convert.d.ts +4 -1
- package/dist/convert/convert.js +10 -1
- package/dist/convert/from-pdf.cjs +12 -0
- package/dist/convert/from-pdf.d.cts +4 -1
- package/dist/convert/from-pdf.d.ts +4 -1
- package/dist/convert/from-pdf.js +10 -1
- package/dist/convert/port.cjs +3 -0
- package/dist/convert/port.d.cts +3 -0
- package/dist/convert/port.d.ts +3 -0
- package/dist/convert/port.js +3 -0
- package/dist/edit/odg/page.d.cts +1 -1
- package/dist/edit/odg/page.d.ts +1 -1
- package/dist/edit/odp/image.cjs +1 -1
- package/dist/edit/odp/image.js +1 -1
- package/dist/edit/odp/shape.cjs +5 -2
- package/dist/edit/odp/shape.d.cts +1 -1
- package/dist/edit/odp/shape.d.ts +1 -1
- package/dist/edit/odp/shape.js +6 -3
- package/dist/edit/odp/slide.d.cts +1 -1
- package/dist/edit/odp/slide.d.ts +1 -1
- package/dist/edit/pptx/image.cjs +1 -1
- package/dist/edit/pptx/image.js +1 -1
- package/dist/edit/pptx/shape.cjs +7 -5
- package/dist/edit/pptx/shape.d.cts +1 -1
- package/dist/edit/pptx/shape.d.ts +1 -1
- package/dist/edit/pptx/shape.js +7 -5
- package/dist/edit/pptx/slide.d.cts +2 -2
- package/dist/edit/pptx/slide.d.ts +2 -2
- package/dist/edit/pptx/table.d.cts +1 -1
- package/dist/edit/pptx/table.d.ts +1 -1
- package/dist/index.cjs +42 -0
- package/dist/index.d.cts +12 -8
- package/dist/index.d.ts +12 -8
- package/dist/index.js +9 -5
- package/dist/metadata/write.cjs +3 -0
- package/dist/metadata/write.js +3 -0
- package/dist/model/bytes.cjs +19 -0
- package/dist/model/bytes.d.cts +4 -1
- package/dist/model/bytes.d.ts +4 -1
- package/dist/model/bytes.js +17 -1
- package/dist/ppt/read.cjs +13 -0
- package/dist/ppt/read.d.cts +5 -0
- package/dist/ppt/read.d.ts +5 -0
- package/dist/ppt/read.js +12 -0
- package/dist/ppt/write.cjs +12 -0
- package/dist/ppt/write.d.cts +5 -0
- package/dist/ppt/write.d.ts +5 -0
- package/dist/ppt/write.js +11 -0
- package/dist/{shape-xpgICOEx.d.ts → shape-B_vI18gH.d.ts} +1 -1
- package/dist/{shape-Ca-xsrde.d.cts → shape-C2ef6uwC.d.cts} +1 -1
- package/dist/{shape-DqkYq1OL.d.cts → shape-CQa4zif9.d.cts} +1 -1
- package/dist/{shape-BY5P8kDn.d.ts → shape-DwZouh8R.d.ts} +1 -1
- package/dist/{table-C_KDsX5R.d.cts → table-CtbzOK8s.d.cts} +1 -1
- package/dist/{table-C3VWWdjr.d.ts → table-D2CgT0Gf.d.ts} +1 -1
- package/package.json +12 -8
|
@@ -21,6 +21,8 @@ const require_csv_write = require("../csv/write.cjs");
|
|
|
21
21
|
const require_svg_text = require("../svg/text.cjs");
|
|
22
22
|
const require_svg_read = require("../svg/read.cjs");
|
|
23
23
|
const require_svg_write = require("../svg/write.cjs");
|
|
24
|
+
const require_ppt_read = require("../ppt/read.cjs");
|
|
25
|
+
const require_ppt_write = require("../ppt/write.cjs");
|
|
24
26
|
const require_ports_abort = require("../ports/abort.cjs");
|
|
25
27
|
const require_layout_reconstruct = require("../layout/reconstruct.cjs");
|
|
26
28
|
const require_convert_pdf_package_tables = require("./pdf-package-tables.cjs");
|
|
@@ -29,6 +31,8 @@ const require_convert_capability = require("./capability.cjs");
|
|
|
29
31
|
let ooxml_js = require("ooxml.js");
|
|
30
32
|
let document_schema_js = require("document-schema.js");
|
|
31
33
|
let odf_js = require("odf.js");
|
|
34
|
+
let doc_codec = require("doc-codec");
|
|
35
|
+
let xls_codec = require("xls-codec");
|
|
32
36
|
let rtf_codec = require("rtf-codec");
|
|
33
37
|
require("markdown-codec");
|
|
34
38
|
let wpd_codec = require("wpd-codec");
|
|
@@ -45,7 +49,10 @@ const CONTENT_FORMATS = [
|
|
|
45
49
|
"svg",
|
|
46
50
|
"csv",
|
|
47
51
|
"markdown",
|
|
48
|
-
"rtf"
|
|
52
|
+
"rtf",
|
|
53
|
+
"doc",
|
|
54
|
+
"xls",
|
|
55
|
+
"ppt"
|
|
49
56
|
];
|
|
50
57
|
function isTextFormatNode(node) {
|
|
51
58
|
return !node.hasSourcePackage;
|
|
@@ -81,11 +88,20 @@ function readSourceContent(format, bytes, options) {
|
|
|
81
88
|
};
|
|
82
89
|
}
|
|
83
90
|
const LATIN1_CHUNK_SIZE = 8192;
|
|
84
|
-
function
|
|
91
|
+
function bytesToLatin1(bytes) {
|
|
85
92
|
let text = "";
|
|
86
93
|
for (let start = 0; start < bytes.length; start += LATIN1_CHUNK_SIZE) text += String.fromCharCode(...bytes.subarray(start, start + LATIN1_CHUNK_SIZE));
|
|
87
94
|
return text;
|
|
88
95
|
}
|
|
96
|
+
function latin1ToBytes(text) {
|
|
97
|
+
const bytes = new Uint8Array(text.length);
|
|
98
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
99
|
+
const code = text.charCodeAt(index);
|
|
100
|
+
if (code > 255) throw new TypeError(`latin1ToBytes: character at index ${String(index)} is U+${code.toString(16).toUpperCase().padStart(4, "0")}, above U+00FF -- this string no longer holds the file's original bytes`);
|
|
101
|
+
bytes[index] = code;
|
|
102
|
+
}
|
|
103
|
+
return bytes;
|
|
104
|
+
}
|
|
89
105
|
const FORMAT_NODES = {
|
|
90
106
|
docx: {
|
|
91
107
|
variant: "wordprocessing",
|
|
@@ -192,11 +208,50 @@ const FORMAT_NODES = {
|
|
|
192
208
|
rtf: {
|
|
193
209
|
variant: "wordprocessing",
|
|
194
210
|
family: "rtf",
|
|
195
|
-
decode: (bytes) =>
|
|
211
|
+
decode: (bytes) => bytesToLatin1(bytes),
|
|
196
212
|
read: (text, options) => (0, rtf_codec.readRtfContent)(text, { signal: options?.signal }).document,
|
|
197
|
-
build: (content) =>
|
|
213
|
+
build: (content) => bytesToLatin1((0, rtf_codec.writeRtfContent)(content)),
|
|
198
214
|
encode: (text) => require_model_bytes.requireArrayBufferBytes((0, rtf_codec.rtfBytesFromLatin1)(text)),
|
|
199
215
|
hasSourcePackage: false
|
|
216
|
+
},
|
|
217
|
+
doc: {
|
|
218
|
+
variant: "wordprocessing",
|
|
219
|
+
family: "doc",
|
|
220
|
+
decode: (bytes) => bytesToLatin1(bytes),
|
|
221
|
+
read: (text, options) => {
|
|
222
|
+
require_ports_abort.throwIfAborted(options?.signal);
|
|
223
|
+
return (0, doc_codec.readDocContent)(latin1ToBytes(text));
|
|
224
|
+
},
|
|
225
|
+
build: (content) => bytesToLatin1((0, doc_codec.writeDocContent)(content)),
|
|
226
|
+
encode: (text) => latin1ToBytes(text),
|
|
227
|
+
hasSourcePackage: false
|
|
228
|
+
},
|
|
229
|
+
xls: {
|
|
230
|
+
variant: "spreadsheet",
|
|
231
|
+
family: "xls",
|
|
232
|
+
decode: (bytes) => bytesToLatin1(bytes),
|
|
233
|
+
read: (text, options) => {
|
|
234
|
+
require_ports_abort.throwIfAborted(options?.signal);
|
|
235
|
+
return (0, xls_codec.readXlsContent)(latin1ToBytes(text));
|
|
236
|
+
},
|
|
237
|
+
build: (content) => {
|
|
238
|
+
if (content.kind !== "spreadsheet") throw new Error("FORMAT_NODES.xls.build: expected a spreadsheet ContentDocument");
|
|
239
|
+
return bytesToLatin1((0, xls_codec.writeXlsContent)(content));
|
|
240
|
+
},
|
|
241
|
+
encode: (text) => latin1ToBytes(text),
|
|
242
|
+
hasSourcePackage: false
|
|
243
|
+
},
|
|
244
|
+
ppt: {
|
|
245
|
+
variant: "presentation",
|
|
246
|
+
family: "ppt",
|
|
247
|
+
decode: (bytes) => bytesToLatin1(bytes),
|
|
248
|
+
read: (text, options) => {
|
|
249
|
+
require_ports_abort.throwIfAborted(options?.signal);
|
|
250
|
+
return require_ppt_read.readPptContent(latin1ToBytes(text));
|
|
251
|
+
},
|
|
252
|
+
build: (content) => bytesToLatin1(require_ppt_write.writePptContent(content)),
|
|
253
|
+
encode: (text) => latin1ToBytes(text),
|
|
254
|
+
hasSourcePackage: false
|
|
200
255
|
}
|
|
201
256
|
};
|
|
202
257
|
const LAYOUT_CAPABLE = /* @__PURE__ */ new Set([
|
|
@@ -30,7 +30,7 @@ interface UnifiedConversionOptions {
|
|
|
30
30
|
readonly onSvgDiagnostic?: SvgDiagnosticSink;
|
|
31
31
|
readonly clock?: ClockPort;
|
|
32
32
|
}
|
|
33
|
-
type ContentFormat = "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "csv" | "markdown" | "rtf";
|
|
33
|
+
type ContentFormat = "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt";
|
|
34
34
|
type LayoutVariant = Exclude<ContentVariant, "formula">;
|
|
35
35
|
interface PackageFormatNode {
|
|
36
36
|
readonly variant: LayoutVariant;
|
|
@@ -43,7 +43,7 @@ interface PackageFormatNode {
|
|
|
43
43
|
}
|
|
44
44
|
interface TextFormatNode {
|
|
45
45
|
readonly variant: LayoutVariant;
|
|
46
|
-
readonly family: "markdown" | "csv" | "svg" | "rtf";
|
|
46
|
+
readonly family: "markdown" | "csv" | "svg" | "rtf" | "doc" | "xls" | "ppt";
|
|
47
47
|
readonly decode: (bytes: Uint8Array<ArrayBuffer>) => string;
|
|
48
48
|
readonly read: (text: string, options?: UnifiedConversionOptions) => ContentDocument;
|
|
49
49
|
readonly build: (content: ContentDocument, options?: UnifiedConversionOptions) => string;
|
|
@@ -30,7 +30,7 @@ interface UnifiedConversionOptions {
|
|
|
30
30
|
readonly onSvgDiagnostic?: SvgDiagnosticSink;
|
|
31
31
|
readonly clock?: ClockPort;
|
|
32
32
|
}
|
|
33
|
-
type ContentFormat = "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "csv" | "markdown" | "rtf";
|
|
33
|
+
type ContentFormat = "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt";
|
|
34
34
|
type LayoutVariant = Exclude<ContentVariant, "formula">;
|
|
35
35
|
interface PackageFormatNode {
|
|
36
36
|
readonly variant: LayoutVariant;
|
|
@@ -43,7 +43,7 @@ interface PackageFormatNode {
|
|
|
43
43
|
}
|
|
44
44
|
interface TextFormatNode {
|
|
45
45
|
readonly variant: LayoutVariant;
|
|
46
|
-
readonly family: "markdown" | "csv" | "svg" | "rtf";
|
|
46
|
+
readonly family: "markdown" | "csv" | "svg" | "rtf" | "doc" | "xls" | "ppt";
|
|
47
47
|
readonly decode: (bytes: Uint8Array<ArrayBuffer>) => string;
|
|
48
48
|
readonly read: (text: string, options?: UnifiedConversionOptions) => ContentDocument;
|
|
49
49
|
readonly build: (content: ContentDocument, options?: UnifiedConversionOptions) => string;
|
|
@@ -20,6 +20,8 @@ import { buildCsvText } from "../csv/write.js";
|
|
|
20
20
|
import { decodeSvgText, encodeSvgText } from "../svg/text.js";
|
|
21
21
|
import { readSvgContent } from "../svg/read.js";
|
|
22
22
|
import { buildSvgText } from "../svg/write.js";
|
|
23
|
+
import { readPptContent } from "../ppt/read.js";
|
|
24
|
+
import { writePptContent } from "../ppt/write.js";
|
|
23
25
|
import { throwIfAborted } from "../ports/abort.js";
|
|
24
26
|
import { reconstructDrawing, reconstructPresentation, reconstructSpreadsheet, reconstructWordprocessing } from "../layout/reconstruct.js";
|
|
25
27
|
import { stampPdfPackageTables } from "./pdf-package-tables.js";
|
|
@@ -28,6 +30,8 @@ import { UnsupportedConversionError } from "./capability.js";
|
|
|
28
30
|
import { buildXlsxPackageFromContent, decodePackage, encodePackage, readXlsxContent } from "ooxml.js";
|
|
29
31
|
import { assembleTree } from "document-schema.js";
|
|
30
32
|
import { decodePackage as decodePackage$1, encodePackage as encodePackage$1 } from "odf.js";
|
|
33
|
+
import { readDocContent, writeDocContent } from "doc-codec";
|
|
34
|
+
import { readXlsContent, writeXlsContent } from "xls-codec";
|
|
31
35
|
import { readRtfContent, rtfBytesFromLatin1, writeRtfContent } from "rtf-codec";
|
|
32
36
|
import "markdown-codec";
|
|
33
37
|
import { readWpdContent } from "wpd-codec";
|
|
@@ -44,7 +48,10 @@ const CONTENT_FORMATS = [
|
|
|
44
48
|
"svg",
|
|
45
49
|
"csv",
|
|
46
50
|
"markdown",
|
|
47
|
-
"rtf"
|
|
51
|
+
"rtf",
|
|
52
|
+
"doc",
|
|
53
|
+
"xls",
|
|
54
|
+
"ppt"
|
|
48
55
|
];
|
|
49
56
|
function isTextFormatNode(node) {
|
|
50
57
|
return !node.hasSourcePackage;
|
|
@@ -80,11 +87,20 @@ function readSourceContent(format, bytes, options) {
|
|
|
80
87
|
};
|
|
81
88
|
}
|
|
82
89
|
const LATIN1_CHUNK_SIZE = 8192;
|
|
83
|
-
function
|
|
90
|
+
function bytesToLatin1(bytes) {
|
|
84
91
|
let text = "";
|
|
85
92
|
for (let start = 0; start < bytes.length; start += LATIN1_CHUNK_SIZE) text += String.fromCharCode(...bytes.subarray(start, start + LATIN1_CHUNK_SIZE));
|
|
86
93
|
return text;
|
|
87
94
|
}
|
|
95
|
+
function latin1ToBytes(text) {
|
|
96
|
+
const bytes = new Uint8Array(text.length);
|
|
97
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
98
|
+
const code = text.charCodeAt(index);
|
|
99
|
+
if (code > 255) throw new TypeError(`latin1ToBytes: character at index ${String(index)} is U+${code.toString(16).toUpperCase().padStart(4, "0")}, above U+00FF -- this string no longer holds the file's original bytes`);
|
|
100
|
+
bytes[index] = code;
|
|
101
|
+
}
|
|
102
|
+
return bytes;
|
|
103
|
+
}
|
|
88
104
|
const FORMAT_NODES = {
|
|
89
105
|
docx: {
|
|
90
106
|
variant: "wordprocessing",
|
|
@@ -191,11 +207,50 @@ const FORMAT_NODES = {
|
|
|
191
207
|
rtf: {
|
|
192
208
|
variant: "wordprocessing",
|
|
193
209
|
family: "rtf",
|
|
194
|
-
decode: (bytes) =>
|
|
210
|
+
decode: (bytes) => bytesToLatin1(bytes),
|
|
195
211
|
read: (text, options) => readRtfContent(text, { signal: options?.signal }).document,
|
|
196
|
-
build: (content) =>
|
|
212
|
+
build: (content) => bytesToLatin1(writeRtfContent(content)),
|
|
197
213
|
encode: (text) => requireArrayBufferBytes(rtfBytesFromLatin1(text)),
|
|
198
214
|
hasSourcePackage: false
|
|
215
|
+
},
|
|
216
|
+
doc: {
|
|
217
|
+
variant: "wordprocessing",
|
|
218
|
+
family: "doc",
|
|
219
|
+
decode: (bytes) => bytesToLatin1(bytes),
|
|
220
|
+
read: (text, options) => {
|
|
221
|
+
throwIfAborted(options?.signal);
|
|
222
|
+
return readDocContent(latin1ToBytes(text));
|
|
223
|
+
},
|
|
224
|
+
build: (content) => bytesToLatin1(writeDocContent(content)),
|
|
225
|
+
encode: (text) => latin1ToBytes(text),
|
|
226
|
+
hasSourcePackage: false
|
|
227
|
+
},
|
|
228
|
+
xls: {
|
|
229
|
+
variant: "spreadsheet",
|
|
230
|
+
family: "xls",
|
|
231
|
+
decode: (bytes) => bytesToLatin1(bytes),
|
|
232
|
+
read: (text, options) => {
|
|
233
|
+
throwIfAborted(options?.signal);
|
|
234
|
+
return readXlsContent(latin1ToBytes(text));
|
|
235
|
+
},
|
|
236
|
+
build: (content) => {
|
|
237
|
+
if (content.kind !== "spreadsheet") throw new Error("FORMAT_NODES.xls.build: expected a spreadsheet ContentDocument");
|
|
238
|
+
return bytesToLatin1(writeXlsContent(content));
|
|
239
|
+
},
|
|
240
|
+
encode: (text) => latin1ToBytes(text),
|
|
241
|
+
hasSourcePackage: false
|
|
242
|
+
},
|
|
243
|
+
ppt: {
|
|
244
|
+
variant: "presentation",
|
|
245
|
+
family: "ppt",
|
|
246
|
+
decode: (bytes) => bytesToLatin1(bytes),
|
|
247
|
+
read: (text, options) => {
|
|
248
|
+
throwIfAborted(options?.signal);
|
|
249
|
+
return readPptContent(latin1ToBytes(text));
|
|
250
|
+
},
|
|
251
|
+
build: (content) => bytesToLatin1(writePptContent(content)),
|
|
252
|
+
encode: (text) => latin1ToBytes(text),
|
|
253
|
+
hasSourcePackage: false
|
|
199
254
|
}
|
|
200
255
|
};
|
|
201
256
|
const LAYOUT_CAPABLE = /* @__PURE__ */ new Set([
|
package/dist/convert/convert.cjs
CHANGED
|
@@ -161,6 +161,15 @@ function xlsxToPdf(bytes, options) {
|
|
|
161
161
|
function rtfToPdf(bytes, options) {
|
|
162
162
|
return require_convert_composition_to_pdf.convertDocument("rtf", "pdf", bytes, options);
|
|
163
163
|
}
|
|
164
|
+
function docToPdf(bytes, options) {
|
|
165
|
+
return require_convert_composition_to_pdf.convertDocument("doc", "pdf", bytes, options);
|
|
166
|
+
}
|
|
167
|
+
function xlsToPdf(bytes, options) {
|
|
168
|
+
return require_convert_composition_to_pdf.convertDocument("xls", "pdf", bytes, options);
|
|
169
|
+
}
|
|
170
|
+
function pptToPdf(bytes, options) {
|
|
171
|
+
return require_convert_composition_to_pdf.convertDocument("ppt", "pdf", bytes, options);
|
|
172
|
+
}
|
|
164
173
|
function xlsxToMarkdown(bytes, options) {
|
|
165
174
|
return require_convert_composition_to_pdf.convertDocument("xlsx", "markdown", bytes, options);
|
|
166
175
|
}
|
|
@@ -322,6 +331,7 @@ exports.csvToMarkdown = csvToMarkdown;
|
|
|
322
331
|
exports.csvToOds = csvToOds;
|
|
323
332
|
exports.csvToPdf = csvToPdf;
|
|
324
333
|
exports.csvToXlsx = csvToXlsx;
|
|
334
|
+
exports.docToPdf = docToPdf;
|
|
325
335
|
exports.docxToMarkdown = docxToMarkdown;
|
|
326
336
|
exports.docxToOdt = docxToOdt;
|
|
327
337
|
exports.docxToPdf = docxToPdf;
|
|
@@ -351,12 +361,14 @@ exports.odtToDocx = odtToDocx;
|
|
|
351
361
|
exports.odtToMarkdown = odtToMarkdown;
|
|
352
362
|
exports.odtToOdp = odtToOdp;
|
|
353
363
|
exports.odtToPdf = odtToPdf;
|
|
364
|
+
exports.pptToPdf = pptToPdf;
|
|
354
365
|
exports.pptxToDocx = pptxToDocx;
|
|
355
366
|
exports.pptxToOdp = pptxToOdp;
|
|
356
367
|
exports.pptxToPdf = pptxToPdf;
|
|
357
368
|
exports.rtfToPdf = rtfToPdf;
|
|
358
369
|
exports.svgToOdg = svgToOdg;
|
|
359
370
|
exports.svgToPdf = svgToPdf;
|
|
371
|
+
exports.xlsToPdf = xlsToPdf;
|
|
360
372
|
exports.xlsxToCsv = xlsxToCsv;
|
|
361
373
|
exports.xlsxToMarkdown = xlsxToMarkdown;
|
|
362
374
|
exports.xlsxToOds = xlsxToOds;
|
|
@@ -86,6 +86,9 @@ declare function odtToOdp(bytes: Uint8Array<ArrayBuffer>, options?: DocumentBrid
|
|
|
86
86
|
declare function odpToOdt(bytes: Uint8Array<ArrayBuffer>, options?: DocumentBridgeOptions): Uint8Array<ArrayBuffer>;
|
|
87
87
|
declare function xlsxToPdf(bytes: Uint8Array<ArrayBuffer>, options?: DocumentToPdfOptions): Uint8Array<ArrayBuffer>;
|
|
88
88
|
declare function rtfToPdf(bytes: Uint8Array<ArrayBuffer>, options?: DocumentToPdfOptions): Uint8Array<ArrayBuffer>;
|
|
89
|
+
declare function docToPdf(bytes: Uint8Array<ArrayBuffer>, options?: DocumentToPdfOptions): Uint8Array<ArrayBuffer>;
|
|
90
|
+
declare function xlsToPdf(bytes: Uint8Array<ArrayBuffer>, options?: DocumentToPdfOptions): Uint8Array<ArrayBuffer>;
|
|
91
|
+
declare function pptToPdf(bytes: Uint8Array<ArrayBuffer>, options?: DocumentToPdfOptions): Uint8Array<ArrayBuffer>;
|
|
89
92
|
declare function xlsxToMarkdown(bytes: Uint8Array<ArrayBuffer>, options?: ComposedDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
90
93
|
declare function markdownToXlsx(bytes: Uint8Array<ArrayBuffer>, options?: ComposedDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
91
94
|
declare function csvToMarkdown(bytes: Uint8Array<ArrayBuffer>, options?: ComposedDocumentOptions & CsvReadOptions): Uint8Array<ArrayBuffer>;
|
|
@@ -118,4 +121,4 @@ interface OdbReportToOdtOptions {
|
|
|
118
121
|
declare function odbReportToOdt(content: ContentDocument, options?: OdbReportToOdtOptions): Uint8Array<ArrayBuffer>;
|
|
119
122
|
declare function odbReportToPdf(content: ContentDocument, options?: DocumentToPdfOptions): Uint8Array<ArrayBuffer>;
|
|
120
123
|
//#endregion
|
|
121
|
-
export { ComposedDocumentOptions, CsvReadOptions, CsvWriteOptions, DocumentBridgeOptions, DocumentToPdfOptions, OdbConversionOptions, OdbReportToDocxOptions, OdbReportToOdtOptions, OdbToCsvOptions, OdmToPdfOptions, OdmUnresolvedSectionError, SvgReadOptions, SvgWriteOptions, csvToMarkdown, csvToOds, csvToPdf, csvToXlsx, docxToMarkdown, docxToOdt, docxToPdf, docxToPptx, inlineOdmSectionToContentSection, markdownToCsv, markdownToDocx, markdownToOdt, markdownToPdf, markdownToXlsx, odbReportToDocx, odbReportToOdt, odbReportToPdf, odbToCsv, odbToXlsx, odfToPdf, odgToPdf, odgToSvg, odmToPdf, odpToOdt, odpToPdf, odpToPptx, odsToCsv, odsToPdf, odsToXlsx, odtToDocx, odtToMarkdown, odtToOdp, odtToPdf, pptxToDocx, pptxToOdp, pptxToPdf, rtfToPdf, svgToOdg, svgToPdf, xlsxToCsv, xlsxToMarkdown, xlsxToOds, xlsxToPdf };
|
|
124
|
+
export { ComposedDocumentOptions, CsvReadOptions, CsvWriteOptions, DocumentBridgeOptions, DocumentToPdfOptions, OdbConversionOptions, OdbReportToDocxOptions, OdbReportToOdtOptions, OdbToCsvOptions, OdmToPdfOptions, OdmUnresolvedSectionError, SvgReadOptions, SvgWriteOptions, csvToMarkdown, csvToOds, csvToPdf, csvToXlsx, docToPdf, docxToMarkdown, docxToOdt, docxToPdf, docxToPptx, inlineOdmSectionToContentSection, markdownToCsv, markdownToDocx, markdownToOdt, markdownToPdf, markdownToXlsx, odbReportToDocx, odbReportToOdt, odbReportToPdf, odbToCsv, odbToXlsx, odfToPdf, odgToPdf, odgToSvg, odmToPdf, odpToOdt, odpToPdf, odpToPptx, odsToCsv, odsToPdf, odsToXlsx, odtToDocx, odtToMarkdown, odtToOdp, odtToPdf, pptToPdf, pptxToDocx, pptxToOdp, pptxToPdf, rtfToPdf, svgToOdg, svgToPdf, xlsToPdf, xlsxToCsv, xlsxToMarkdown, xlsxToOds, xlsxToPdf };
|
|
@@ -86,6 +86,9 @@ declare function odtToOdp(bytes: Uint8Array<ArrayBuffer>, options?: DocumentBrid
|
|
|
86
86
|
declare function odpToOdt(bytes: Uint8Array<ArrayBuffer>, options?: DocumentBridgeOptions): Uint8Array<ArrayBuffer>;
|
|
87
87
|
declare function xlsxToPdf(bytes: Uint8Array<ArrayBuffer>, options?: DocumentToPdfOptions): Uint8Array<ArrayBuffer>;
|
|
88
88
|
declare function rtfToPdf(bytes: Uint8Array<ArrayBuffer>, options?: DocumentToPdfOptions): Uint8Array<ArrayBuffer>;
|
|
89
|
+
declare function docToPdf(bytes: Uint8Array<ArrayBuffer>, options?: DocumentToPdfOptions): Uint8Array<ArrayBuffer>;
|
|
90
|
+
declare function xlsToPdf(bytes: Uint8Array<ArrayBuffer>, options?: DocumentToPdfOptions): Uint8Array<ArrayBuffer>;
|
|
91
|
+
declare function pptToPdf(bytes: Uint8Array<ArrayBuffer>, options?: DocumentToPdfOptions): Uint8Array<ArrayBuffer>;
|
|
89
92
|
declare function xlsxToMarkdown(bytes: Uint8Array<ArrayBuffer>, options?: ComposedDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
90
93
|
declare function markdownToXlsx(bytes: Uint8Array<ArrayBuffer>, options?: ComposedDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
91
94
|
declare function csvToMarkdown(bytes: Uint8Array<ArrayBuffer>, options?: ComposedDocumentOptions & CsvReadOptions): Uint8Array<ArrayBuffer>;
|
|
@@ -118,4 +121,4 @@ interface OdbReportToOdtOptions {
|
|
|
118
121
|
declare function odbReportToOdt(content: ContentDocument, options?: OdbReportToOdtOptions): Uint8Array<ArrayBuffer>;
|
|
119
122
|
declare function odbReportToPdf(content: ContentDocument, options?: DocumentToPdfOptions): Uint8Array<ArrayBuffer>;
|
|
120
123
|
//#endregion
|
|
121
|
-
export { ComposedDocumentOptions, CsvReadOptions, CsvWriteOptions, DocumentBridgeOptions, DocumentToPdfOptions, OdbConversionOptions, OdbReportToDocxOptions, OdbReportToOdtOptions, OdbToCsvOptions, OdmToPdfOptions, OdmUnresolvedSectionError, SvgReadOptions, SvgWriteOptions, csvToMarkdown, csvToOds, csvToPdf, csvToXlsx, docxToMarkdown, docxToOdt, docxToPdf, docxToPptx, inlineOdmSectionToContentSection, markdownToCsv, markdownToDocx, markdownToOdt, markdownToPdf, markdownToXlsx, odbReportToDocx, odbReportToOdt, odbReportToPdf, odbToCsv, odbToXlsx, odfToPdf, odgToPdf, odgToSvg, odmToPdf, odpToOdt, odpToPdf, odpToPptx, odsToCsv, odsToPdf, odsToXlsx, odtToDocx, odtToMarkdown, odtToOdp, odtToPdf, pptxToDocx, pptxToOdp, pptxToPdf, rtfToPdf, svgToOdg, svgToPdf, xlsxToCsv, xlsxToMarkdown, xlsxToOds, xlsxToPdf };
|
|
124
|
+
export { ComposedDocumentOptions, CsvReadOptions, CsvWriteOptions, DocumentBridgeOptions, DocumentToPdfOptions, OdbConversionOptions, OdbReportToDocxOptions, OdbReportToOdtOptions, OdbToCsvOptions, OdmToPdfOptions, OdmUnresolvedSectionError, SvgReadOptions, SvgWriteOptions, csvToMarkdown, csvToOds, csvToPdf, csvToXlsx, docToPdf, docxToMarkdown, docxToOdt, docxToPdf, docxToPptx, inlineOdmSectionToContentSection, markdownToCsv, markdownToDocx, markdownToOdt, markdownToPdf, markdownToXlsx, odbReportToDocx, odbReportToOdt, odbReportToPdf, odbToCsv, odbToXlsx, odfToPdf, odgToPdf, odgToSvg, odmToPdf, odpToOdt, odpToPdf, odpToPptx, odsToCsv, odsToPdf, odsToXlsx, odtToDocx, odtToMarkdown, odtToOdp, odtToPdf, pptToPdf, pptxToDocx, pptxToOdp, pptxToPdf, rtfToPdf, svgToOdg, svgToPdf, xlsToPdf, xlsxToCsv, xlsxToMarkdown, xlsxToOds, xlsxToPdf };
|
package/dist/convert/convert.js
CHANGED
|
@@ -160,6 +160,15 @@ function xlsxToPdf(bytes, options) {
|
|
|
160
160
|
function rtfToPdf(bytes, options) {
|
|
161
161
|
return convertDocument("rtf", "pdf", bytes, options);
|
|
162
162
|
}
|
|
163
|
+
function docToPdf(bytes, options) {
|
|
164
|
+
return convertDocument("doc", "pdf", bytes, options);
|
|
165
|
+
}
|
|
166
|
+
function xlsToPdf(bytes, options) {
|
|
167
|
+
return convertDocument("xls", "pdf", bytes, options);
|
|
168
|
+
}
|
|
169
|
+
function pptToPdf(bytes, options) {
|
|
170
|
+
return convertDocument("ppt", "pdf", bytes, options);
|
|
171
|
+
}
|
|
163
172
|
function xlsxToMarkdown(bytes, options) {
|
|
164
173
|
return convertDocument("xlsx", "markdown", bytes, options);
|
|
165
174
|
}
|
|
@@ -316,4 +325,4 @@ function odbReportToPdf(content, options) {
|
|
|
316
325
|
return out;
|
|
317
326
|
}
|
|
318
327
|
//#endregion
|
|
319
|
-
export { OdmUnresolvedSectionError, csvToMarkdown, csvToOds, csvToPdf, csvToXlsx, docxToMarkdown, docxToOdt, docxToPdf, docxToPptx, inlineOdmSectionToContentSection, markdownToCsv, markdownToDocx, markdownToOdt, markdownToPdf, markdownToXlsx, odbReportToDocx, odbReportToOdt, odbReportToPdf, odbToCsv, odbToXlsx, odfToPdf, odgToPdf, odgToSvg, odmToPdf, odpToOdt, odpToPdf, odpToPptx, odsToCsv, odsToPdf, odsToXlsx, odtToDocx, odtToMarkdown, odtToOdp, odtToPdf, pptxToDocx, pptxToOdp, pptxToPdf, rtfToPdf, svgToOdg, svgToPdf, xlsxToCsv, xlsxToMarkdown, xlsxToOds, xlsxToPdf };
|
|
328
|
+
export { OdmUnresolvedSectionError, csvToMarkdown, csvToOds, csvToPdf, csvToXlsx, docToPdf, docxToMarkdown, docxToOdt, docxToPdf, docxToPptx, inlineOdmSectionToContentSection, markdownToCsv, markdownToDocx, markdownToOdt, markdownToPdf, markdownToXlsx, odbReportToDocx, odbReportToOdt, odbReportToPdf, odbToCsv, odbToXlsx, odfToPdf, odgToPdf, odgToSvg, odmToPdf, odpToOdt, odpToPdf, odpToPptx, odsToCsv, odsToPdf, odsToXlsx, odtToDocx, odtToMarkdown, odtToOdp, odtToPdf, pptToPdf, pptxToDocx, pptxToOdp, pptxToPdf, rtfToPdf, svgToOdg, svgToPdf, xlsToPdf, xlsxToCsv, xlsxToMarkdown, xlsxToOds, xlsxToPdf };
|
|
@@ -64,17 +64,29 @@ function pdfToXlsx(bytes, options) {
|
|
|
64
64
|
function pdfToRtf(bytes, options) {
|
|
65
65
|
return require_convert_composition.convertDocumentFromPdf("rtf", bytes, options);
|
|
66
66
|
}
|
|
67
|
+
function pdfToDoc(bytes, options) {
|
|
68
|
+
return require_convert_composition.convertDocumentFromPdf("doc", bytes, options);
|
|
69
|
+
}
|
|
70
|
+
function pdfToXls(bytes, options) {
|
|
71
|
+
return require_convert_composition.convertDocumentFromPdf("xls", bytes, options);
|
|
72
|
+
}
|
|
73
|
+
function pdfToPpt(bytes, options) {
|
|
74
|
+
return require_convert_composition.convertDocumentFromPdf("ppt", bytes, options);
|
|
75
|
+
}
|
|
67
76
|
//#endregion
|
|
68
77
|
exports.pdfToCsv = pdfToCsv;
|
|
78
|
+
exports.pdfToDoc = pdfToDoc;
|
|
69
79
|
exports.pdfToDocx = pdfToDocx;
|
|
70
80
|
exports.pdfToMarkdown = pdfToMarkdown;
|
|
71
81
|
exports.pdfToOdg = pdfToOdg;
|
|
72
82
|
exports.pdfToOdp = pdfToOdp;
|
|
73
83
|
exports.pdfToOds = pdfToOds;
|
|
74
84
|
exports.pdfToOdt = pdfToOdt;
|
|
85
|
+
exports.pdfToPpt = pdfToPpt;
|
|
75
86
|
exports.pdfToPptx = pdfToPptx;
|
|
76
87
|
exports.pdfToRtf = pdfToRtf;
|
|
77
88
|
exports.pdfToSvg = pdfToSvg;
|
|
89
|
+
exports.pdfToXls = pdfToXls;
|
|
78
90
|
exports.pdfToXlsx = pdfToXlsx;
|
|
79
91
|
exports.readDocumentMetadata = readDocumentMetadata;
|
|
80
92
|
exports.readNativeDocumentTree = readNativeDocumentTree;
|
|
@@ -30,5 +30,8 @@ declare function pdfToCsv(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumen
|
|
|
30
30
|
declare function pdfToSvg(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions & SvgWriteOptions): Uint8Array<ArrayBuffer>;
|
|
31
31
|
declare function pdfToXlsx(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
32
32
|
declare function pdfToRtf(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
33
|
+
declare function pdfToDoc(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
34
|
+
declare function pdfToXls(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
35
|
+
declare function pdfToPpt(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
33
36
|
//#endregion
|
|
34
|
-
export { PdfToDocumentOptions, ReadDocumentMetadataOptions, ReadNativeDocumentTreeOptions, pdfToCsv, pdfToDocx, pdfToMarkdown, pdfToOdg, pdfToOdp, pdfToOds, pdfToOdt, pdfToPptx, pdfToRtf, pdfToSvg, pdfToXlsx, readDocumentMetadata, readNativeDocumentTree };
|
|
37
|
+
export { PdfToDocumentOptions, ReadDocumentMetadataOptions, ReadNativeDocumentTreeOptions, pdfToCsv, pdfToDoc, pdfToDocx, pdfToMarkdown, pdfToOdg, pdfToOdp, pdfToOds, pdfToOdt, pdfToPpt, pdfToPptx, pdfToRtf, pdfToSvg, pdfToXls, pdfToXlsx, readDocumentMetadata, readNativeDocumentTree };
|
|
@@ -30,5 +30,8 @@ declare function pdfToCsv(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumen
|
|
|
30
30
|
declare function pdfToSvg(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions & SvgWriteOptions): Uint8Array<ArrayBuffer>;
|
|
31
31
|
declare function pdfToXlsx(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
32
32
|
declare function pdfToRtf(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
33
|
+
declare function pdfToDoc(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
34
|
+
declare function pdfToXls(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
35
|
+
declare function pdfToPpt(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
33
36
|
//#endregion
|
|
34
|
-
export { PdfToDocumentOptions, ReadDocumentMetadataOptions, ReadNativeDocumentTreeOptions, pdfToCsv, pdfToDocx, pdfToMarkdown, pdfToOdg, pdfToOdp, pdfToOds, pdfToOdt, pdfToPptx, pdfToRtf, pdfToSvg, pdfToXlsx, readDocumentMetadata, readNativeDocumentTree };
|
|
37
|
+
export { PdfToDocumentOptions, ReadDocumentMetadataOptions, ReadNativeDocumentTreeOptions, pdfToCsv, pdfToDoc, pdfToDocx, pdfToMarkdown, pdfToOdg, pdfToOdp, pdfToOds, pdfToOdt, pdfToPpt, pdfToPptx, pdfToRtf, pdfToSvg, pdfToXls, pdfToXlsx, readDocumentMetadata, readNativeDocumentTree };
|
package/dist/convert/from-pdf.js
CHANGED
|
@@ -63,5 +63,14 @@ function pdfToXlsx(bytes, options) {
|
|
|
63
63
|
function pdfToRtf(bytes, options) {
|
|
64
64
|
return convertDocumentFromPdf("rtf", bytes, options);
|
|
65
65
|
}
|
|
66
|
+
function pdfToDoc(bytes, options) {
|
|
67
|
+
return convertDocumentFromPdf("doc", bytes, options);
|
|
68
|
+
}
|
|
69
|
+
function pdfToXls(bytes, options) {
|
|
70
|
+
return convertDocumentFromPdf("xls", bytes, options);
|
|
71
|
+
}
|
|
72
|
+
function pdfToPpt(bytes, options) {
|
|
73
|
+
return convertDocumentFromPdf("ppt", bytes, options);
|
|
74
|
+
}
|
|
66
75
|
//#endregion
|
|
67
|
-
export { pdfToCsv, pdfToDocx, pdfToMarkdown, pdfToOdg, pdfToOdp, pdfToOds, pdfToOdt, pdfToPptx, pdfToRtf, pdfToSvg, pdfToXlsx, readDocumentMetadata, readNativeDocumentTree };
|
|
76
|
+
export { pdfToCsv, pdfToDoc, pdfToDocx, pdfToMarkdown, pdfToOdg, pdfToOdp, pdfToOds, pdfToOdt, pdfToPpt, pdfToPptx, pdfToRtf, pdfToSvg, pdfToXls, pdfToXlsx, readDocumentMetadata, readNativeDocumentTree };
|
package/dist/convert/port.cjs
CHANGED
package/dist/convert/port.d.cts
CHANGED
package/dist/convert/port.d.ts
CHANGED
package/dist/convert/port.js
CHANGED
package/dist/edit/odg/page.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as ImageInit } from "../../image-DzqEWMDw.cjs";
|
|
2
|
-
import { t as OdpShape } from "../../shape-
|
|
2
|
+
import { t as OdpShape } from "../../shape-CQa4zif9.cjs";
|
|
3
3
|
import { a as OdgLineVector, l as PathVectorInit, n as LineVectorInit, o as OdgPathVector, r as OdgBoxVector, s as OdgVector, t as BoxVectorInit } from "../../vector-DDP7hgvm.cjs";
|
|
4
4
|
import { Box, ContentVector } from "document-schema.js";
|
|
5
5
|
import { Package, XmlElement, XmlNode } from "odf.js";
|
package/dist/edit/odg/page.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as ImageInit } from "../../image-DzqEWMDw.js";
|
|
2
|
-
import { t as OdpShape } from "../../shape-
|
|
2
|
+
import { t as OdpShape } from "../../shape-B_vI18gH.js";
|
|
3
3
|
import { a as OdgLineVector, l as PathVectorInit, n as LineVectorInit, o as OdgPathVector, r as OdgBoxVector, s as OdgVector, t as BoxVectorInit } from "../../vector-DDP7hgvm.js";
|
|
4
4
|
import { Box, ContentVector } from "document-schema.js";
|
|
5
5
|
import { Package, XmlElement, XmlNode } from "odf.js";
|
package/dist/edit/odp/image.cjs
CHANGED
|
@@ -4,7 +4,7 @@ const require_edit_odp_shape = require("./shape.cjs");
|
|
|
4
4
|
//#region src/edit/odp/image.ts
|
|
5
5
|
function insertImageFrameMedia(context, frame, image) {
|
|
6
6
|
const { partPath } = require_odf_package_media.addImageMedia(context.pkg, image.bytes, image.format);
|
|
7
|
-
return require_edit_odp_shape.buildImageFrame(partPath, frame);
|
|
7
|
+
return require_edit_odp_shape.buildImageFrame(partPath, frame, image.altText);
|
|
8
8
|
}
|
|
9
9
|
//#endregion
|
|
10
10
|
exports.insertImageFrameMedia = insertImageFrameMedia;
|
package/dist/edit/odp/image.js
CHANGED
|
@@ -3,7 +3,7 @@ import { buildImageFrame } from "./shape.js";
|
|
|
3
3
|
//#region src/edit/odp/image.ts
|
|
4
4
|
function insertImageFrameMedia(context, frame, image) {
|
|
5
5
|
const { partPath } = addImageMedia(context.pkg, image.bytes, image.format);
|
|
6
|
-
return buildImageFrame(partPath, frame);
|
|
6
|
+
return buildImageFrame(partPath, frame, image.altText);
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
|
9
9
|
export { insertImageFrameMedia };
|
package/dist/edit/odp/shape.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_xml_fragment = require("../../xml/fragment.cjs");
|
|
3
|
+
const require_xml_entities = require("../../xml/entities.cjs");
|
|
3
4
|
const require_xml_edit = require("../../xml/edit.cjs");
|
|
4
5
|
const require_edit_geometry = require("../geometry.cjs");
|
|
5
6
|
const require_edit_odt_paragraph = require("../odt/paragraph.cjs");
|
|
@@ -91,13 +92,15 @@ function buildTextBoxFrame(pkg, frame, text) {
|
|
|
91
92
|
"svg:height": (0, odf_js.formatOdfLength)(frame.heightPt)
|
|
92
93
|
}, [require_xml_fragment.el("draw:text-box", {}, [require_edit_odt_paragraph.buildParagraph(pkg, { text })])]);
|
|
93
94
|
}
|
|
94
|
-
function buildImageFrame(partPath, frame) {
|
|
95
|
+
function buildImageFrame(partPath, frame, altText) {
|
|
96
|
+
const children = [require_xml_fragment.el("draw:image", { "xlink:href": partPath })];
|
|
97
|
+
if (altText !== void 0) children.push(require_xml_fragment.el("svg:title", {}, [require_xml_fragment.txt(require_xml_entities.encodeXmlText(altText))]));
|
|
95
98
|
return require_xml_fragment.el("draw:frame", {
|
|
96
99
|
"svg:x": (0, odf_js.formatOdfLength)(frame.xPt),
|
|
97
100
|
"svg:y": (0, odf_js.formatOdfLength)(frame.yPt),
|
|
98
101
|
"svg:width": (0, odf_js.formatOdfLength)(frame.widthPt),
|
|
99
102
|
"svg:height": (0, odf_js.formatOdfLength)(frame.heightPt)
|
|
100
|
-
},
|
|
103
|
+
}, children);
|
|
101
104
|
}
|
|
102
105
|
function buildTableFrame(frame, tableElement) {
|
|
103
106
|
return require_xml_fragment.el("draw:frame", {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as buildTextBoxFrame, n as buildImageFrame, r as buildTableFrame, t as OdpShape } from "../../shape-
|
|
1
|
+
import { i as buildTextBoxFrame, n as buildImageFrame, r as buildTableFrame, t as OdpShape } from "../../shape-CQa4zif9.cjs";
|
|
2
2
|
export { OdpShape, buildImageFrame, buildTableFrame, buildTextBoxFrame };
|
package/dist/edit/odp/shape.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as buildTextBoxFrame, n as buildImageFrame, r as buildTableFrame, t as OdpShape } from "../../shape-
|
|
1
|
+
import { i as buildTextBoxFrame, n as buildImageFrame, r as buildTableFrame, t as OdpShape } from "../../shape-B_vI18gH.js";
|
|
2
2
|
export { OdpShape, buildImageFrame, buildTableFrame, buildTextBoxFrame };
|
package/dist/edit/odp/shape.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { el } from "../../xml/fragment.js";
|
|
1
|
+
import { el, txt } from "../../xml/fragment.js";
|
|
2
|
+
import { encodeXmlText as encodeXmlText$1 } from "../../xml/entities.js";
|
|
2
3
|
import { removeChild } from "../../xml/edit.js";
|
|
3
4
|
import { applyOdfGeometry } from "../geometry.js";
|
|
4
5
|
import { OdtParagraph, buildParagraph } from "../odt/paragraph.js";
|
|
@@ -90,13 +91,15 @@ function buildTextBoxFrame(pkg, frame, text) {
|
|
|
90
91
|
"svg:height": formatOdfLength(frame.heightPt)
|
|
91
92
|
}, [el("draw:text-box", {}, [buildParagraph(pkg, { text })])]);
|
|
92
93
|
}
|
|
93
|
-
function buildImageFrame(partPath, frame) {
|
|
94
|
+
function buildImageFrame(partPath, frame, altText) {
|
|
95
|
+
const children = [el("draw:image", { "xlink:href": partPath })];
|
|
96
|
+
if (altText !== void 0) children.push(el("svg:title", {}, [txt(encodeXmlText$1(altText))]));
|
|
94
97
|
return el("draw:frame", {
|
|
95
98
|
"svg:x": formatOdfLength(frame.xPt),
|
|
96
99
|
"svg:y": formatOdfLength(frame.yPt),
|
|
97
100
|
"svg:width": formatOdfLength(frame.widthPt),
|
|
98
101
|
"svg:height": formatOdfLength(frame.heightPt)
|
|
99
|
-
},
|
|
102
|
+
}, children);
|
|
100
103
|
}
|
|
101
104
|
function buildTableFrame(frame, tableElement) {
|
|
102
105
|
return el("draw:frame", {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as ImageInit } from "../../image-DzqEWMDw.cjs";
|
|
2
|
-
import { t as OdpShape } from "../../shape-
|
|
2
|
+
import { t as OdpShape } from "../../shape-CQa4zif9.cjs";
|
|
3
3
|
import { s as OdgVector } from "../../vector-DDP7hgvm.cjs";
|
|
4
4
|
import { a as TableInit, n as OdtTable } from "../../table-CpEmblWG.cjs";
|
|
5
5
|
import { Box, ContentFormula, ContentVector } from "document-schema.js";
|
package/dist/edit/odp/slide.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as ImageInit } from "../../image-DzqEWMDw.js";
|
|
2
|
-
import { t as OdpShape } from "../../shape-
|
|
2
|
+
import { t as OdpShape } from "../../shape-B_vI18gH.js";
|
|
3
3
|
import { s as OdgVector } from "../../vector-DDP7hgvm.js";
|
|
4
4
|
import { a as TableInit, n as OdtTable } from "../../table-Ck0fyr8d.js";
|
|
5
5
|
import { Box, ContentFormula, ContentVector } from "document-schema.js";
|
package/dist/edit/pptx/image.cjs
CHANGED
|
@@ -21,7 +21,7 @@ function nextShapeId(slideRoot) {
|
|
|
21
21
|
function insertPictureShapeMedia(context, slideRoot, frame, image) {
|
|
22
22
|
const { relationshipId } = require_opc_media.addImageMedia(context.pkg, context.partPath, context.mediaDir, image.format, image.bytes);
|
|
23
23
|
const id = nextShapeId(slideRoot);
|
|
24
|
-
return require_edit_pptx_shape.buildPictureShape(frame, relationshipId, id);
|
|
24
|
+
return require_edit_pptx_shape.buildPictureShape(frame, relationshipId, id, image.altText);
|
|
25
25
|
}
|
|
26
26
|
//#endregion
|
|
27
27
|
exports.insertPictureShapeMedia = insertPictureShapeMedia;
|
package/dist/edit/pptx/image.js
CHANGED
|
@@ -20,7 +20,7 @@ function nextShapeId(slideRoot) {
|
|
|
20
20
|
function insertPictureShapeMedia(context, slideRoot, frame, image) {
|
|
21
21
|
const { relationshipId } = addImageMedia(context.pkg, context.partPath, context.mediaDir, image.format, image.bytes);
|
|
22
22
|
const id = nextShapeId(slideRoot);
|
|
23
|
-
return buildPictureShape(frame, relationshipId, id);
|
|
23
|
+
return buildPictureShape(frame, relationshipId, id, image.altText);
|
|
24
24
|
}
|
|
25
25
|
//#endregion
|
|
26
26
|
export { insertPictureShapeMedia };
|
package/dist/edit/pptx/shape.cjs
CHANGED
|
@@ -285,12 +285,14 @@ function buildTextBoxShape(frame, text, shapeId) {
|
|
|
285
285
|
txBody
|
|
286
286
|
]);
|
|
287
287
|
}
|
|
288
|
-
function buildPictureShape(frame, relationshipId, shapeId) {
|
|
288
|
+
function buildPictureShape(frame, relationshipId, shapeId, altText) {
|
|
289
|
+
const cNvPrAttrs = {
|
|
290
|
+
id: String(shapeId),
|
|
291
|
+
name: `Picture ${shapeId}`
|
|
292
|
+
};
|
|
293
|
+
if (altText !== void 0) cNvPrAttrs.descr = require_xml_entities.encodeXmlText(altText);
|
|
289
294
|
const nvPicPr = require_xml_fragment.el("p:nvPicPr", {}, [
|
|
290
|
-
require_xml_fragment.el("p:cNvPr",
|
|
291
|
-
id: String(shapeId),
|
|
292
|
-
name: `Picture ${shapeId}`
|
|
293
|
-
}),
|
|
295
|
+
require_xml_fragment.el("p:cNvPr", cNvPrAttrs),
|
|
294
296
|
require_xml_fragment.el("p:cNvPicPr"),
|
|
295
297
|
require_xml_fragment.el("p:nvPr")
|
|
296
298
|
]);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as buildDrawingParagraph, i as ROTATION_UNITS_PER_DEGREE, n as DrawingRunInit, o as buildPictureShape, r as PptxShape, s as buildTextBoxShape, t as DrawingParagraphInit } from "../../shape-
|
|
1
|
+
import { a as buildDrawingParagraph, i as ROTATION_UNITS_PER_DEGREE, n as DrawingRunInit, o as buildPictureShape, r as PptxShape, s as buildTextBoxShape, t as DrawingParagraphInit } from "../../shape-C2ef6uwC.cjs";
|
|
2
2
|
export { DrawingParagraphInit, DrawingRunInit, PptxShape, ROTATION_UNITS_PER_DEGREE, buildDrawingParagraph, buildPictureShape, buildTextBoxShape };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as buildDrawingParagraph, i as ROTATION_UNITS_PER_DEGREE, n as DrawingRunInit, o as buildPictureShape, r as PptxShape, s as buildTextBoxShape, t as DrawingParagraphInit } from "../../shape-
|
|
1
|
+
import { a as buildDrawingParagraph, i as ROTATION_UNITS_PER_DEGREE, n as DrawingRunInit, o as buildPictureShape, r as PptxShape, s as buildTextBoxShape, t as DrawingParagraphInit } from "../../shape-DwZouh8R.js";
|
|
2
2
|
export { DrawingParagraphInit, DrawingRunInit, PptxShape, ROTATION_UNITS_PER_DEGREE, buildDrawingParagraph, buildPictureShape, buildTextBoxShape };
|