documents.js 1.97.10 → 1.98.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/dist/capability-DX0lCSiI.d.ts +16 -0
- package/dist/capability-an5gSNsu.d.cts +16 -0
- package/dist/convert/capability.cjs +0 -207
- package/dist/convert/capability.d.cts +2 -38
- package/dist/convert/capability.d.ts +2 -38
- package/dist/convert/capability.js +1 -206
- package/dist/convert/composition.cjs +415 -0
- package/dist/convert/composition.d.cts +60 -0
- package/dist/convert/composition.d.ts +60 -0
- package/dist/convert/composition.js +412 -0
- package/dist/convert/convert.cjs +33 -480
- package/dist/convert/convert.d.cts +3 -3
- package/dist/convert/convert.d.ts +2 -2
- package/dist/convert/convert.js +36 -483
- package/dist/convert/local.cjs +33 -33
- package/dist/convert/local.js +34 -34
- package/dist/fonts/registry.d.cts +19 -1
- package/dist/fonts/registry.d.ts +19 -1
- package/dist/hsqldb/binary-script.d.cts +1 -1
- package/dist/hsqldb/binary-script.d.ts +1 -1
- package/dist/hsqldb/cache.d.cts +1 -1
- package/dist/hsqldb/cache.d.ts +1 -1
- package/dist/hsqldb/rowformat.d.cts +24 -1
- package/dist/hsqldb/rowformat.d.ts +24 -1
- package/dist/index.cjs +4 -1
- package/dist/index.d.cts +7 -6
- package/dist/index.d.ts +5 -4
- package/dist/index.js +3 -2
- package/dist/odb/read.d.cts +1 -1
- package/dist/odb/read.d.ts +1 -1
- package/dist/odb/report/content.d.cts +1 -1
- package/dist/odb/report/content.d.ts +1 -1
- package/dist/odb/report/source.d.cts +1 -1
- package/dist/odb/report/source.d.ts +1 -1
- package/package.json +1 -1
- package/dist/registry-DpF4A9EM.d.ts +0 -20
- package/dist/registry-ZAWlWHqJ.d.cts +0 -20
- package/dist/rowformat-Cl2exlEh.d.cts +0 -25
- package/dist/rowformat-Cl2exlEh.d.ts +0 -25
package/dist/convert/convert.cjs
CHANGED
|
@@ -1,36 +1,18 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_model_geometry = require("../model/geometry.cjs");
|
|
3
3
|
const require_model_metadata = require("../model/metadata.cjs");
|
|
4
|
-
const require_edit_docx_editor = require("../edit/docx/editor.cjs");
|
|
5
4
|
const require_edit_docx_content = require("../edit/docx/content.cjs");
|
|
6
|
-
const require_edit_pptx_editor = require("../edit/pptx/editor.cjs");
|
|
7
|
-
const require_edit_pptx_content = require("../edit/pptx/content.cjs");
|
|
8
5
|
const require_edit_odt_content = require("../edit/odt/content.cjs");
|
|
9
|
-
const require_edit_odp_content = require("../edit/odp/content.cjs");
|
|
10
|
-
const require_edit_ods_content = require("../edit/ods/content.cjs");
|
|
11
|
-
const require_edit_odg_content = require("../edit/odg/content.cjs");
|
|
12
|
-
const require_markdown_read = require("../markdown/read.cjs");
|
|
13
|
-
const require_markdown_write = require("../markdown/write.cjs");
|
|
14
6
|
const require_fonts_registry = require("../fonts/registry.cjs");
|
|
15
7
|
const require_mathml_layout = require("../mathml/layout.cjs");
|
|
16
|
-
const require_ooxml_docx_read = require("../ooxml/docx/read.cjs");
|
|
17
|
-
const require_ooxml_pptx_read = require("../ooxml/pptx/read.cjs");
|
|
18
8
|
const require_odf_formula_read = require("../odf/formula/read.cjs");
|
|
19
9
|
const require_odf_odt_read = require("../odf/odt/read.cjs");
|
|
20
|
-
const require_odf_odp_read = require("../odf/odp/read.cjs");
|
|
21
|
-
const require_odf_ods_read = require("../odf/ods/read.cjs");
|
|
22
|
-
const require_odf_odg_read = require("../odf/odg/read.cjs");
|
|
23
|
-
const require_markdown_text = require("../markdown/text.cjs");
|
|
24
10
|
const require_layout_engine = require("../layout/engine.cjs");
|
|
25
|
-
const require_layout_slides = require("../layout/slides.cjs");
|
|
26
11
|
const require_ports_abort = require("../ports/abort.cjs");
|
|
27
|
-
const require_layout_sheets = require("../layout/sheets.cjs");
|
|
28
|
-
const require_layout_drawing = require("../layout/drawing.cjs");
|
|
29
|
-
const require_layout_reconstruct = require("../layout/reconstruct.cjs");
|
|
30
12
|
const require_odb_csv = require("../odb/csv.cjs");
|
|
31
13
|
const require_odb_read = require("../odb/read.cjs");
|
|
32
14
|
const require_odb_spreadsheet = require("../odb/spreadsheet.cjs");
|
|
33
|
-
const
|
|
15
|
+
const require_convert_composition = require("./composition.cjs");
|
|
34
16
|
let ooxml_js = require("ooxml.js");
|
|
35
17
|
let document_schema_js = require("document-schema.js");
|
|
36
18
|
let odf_js = require("odf.js");
|
|
@@ -38,201 +20,25 @@ let pdf_codec = require("pdf-codec");
|
|
|
38
20
|
//#region src/convert/convert.ts
|
|
39
21
|
const mathMetricsAt = (sizePt) => (0, pdf_codec.loadMathFont)().metricsAt(sizePt);
|
|
40
22
|
function docxToPdf(bytes, options) {
|
|
41
|
-
|
|
42
|
-
const read = require_ooxml_docx_read.readDocxContent(pkg, { onMathDiagnostic: options?.onMathDiagnostic });
|
|
43
|
-
if (read.kind !== "wordprocessing") throw new Error("readDocxContent returned a non-wordprocessing ContentDocument");
|
|
44
|
-
const content = {
|
|
45
|
-
...read,
|
|
46
|
-
metadata: require_model_metadata.resolveMetadataTimestamps(read.metadata, options?.clock)
|
|
47
|
-
};
|
|
48
|
-
const fonts = require_fonts_registry.createDocumentFontRegistry({
|
|
49
|
-
kind: "docx",
|
|
50
|
-
package: pkg
|
|
51
|
-
}, options);
|
|
52
|
-
const { document: layout, formulas } = require_layout_engine.convertWordprocessingToLayout(content, {
|
|
53
|
-
measurer: (0, pdf_codec.createFontMeasurer)(fonts),
|
|
54
|
-
mathMetricsAt
|
|
55
|
-
});
|
|
56
|
-
options?.onDocument?.({
|
|
57
|
-
formatVersion: document_schema_js.DOCUMENT_PACKAGE_FORMAT_VERSION,
|
|
58
|
-
content,
|
|
59
|
-
layout
|
|
60
|
-
});
|
|
61
|
-
return (0, pdf_codec.writePdf)(layout, {
|
|
62
|
-
signal: options?.signal,
|
|
63
|
-
onSubstitution: options?.onSubstitution,
|
|
64
|
-
formulas,
|
|
65
|
-
fonts
|
|
66
|
-
});
|
|
23
|
+
return require_convert_composition.convertDocument("docx", "pdf", bytes, options);
|
|
67
24
|
}
|
|
68
25
|
function odtToPdf(bytes, options) {
|
|
69
|
-
|
|
70
|
-
const read = require_odf_odt_read.readOdtContent(pkg);
|
|
71
|
-
if (read.kind !== "wordprocessing") throw new Error("readOdtContent returned a non-wordprocessing ContentDocument");
|
|
72
|
-
const content = {
|
|
73
|
-
...read,
|
|
74
|
-
metadata: require_model_metadata.resolveMetadataTimestamps(read.metadata, options?.clock)
|
|
75
|
-
};
|
|
76
|
-
const fonts = require_fonts_registry.createDocumentFontRegistry({
|
|
77
|
-
kind: "odf",
|
|
78
|
-
package: pkg
|
|
79
|
-
}, options);
|
|
80
|
-
const { document: layout, formulas } = require_layout_engine.convertWordprocessingToLayout(content, {
|
|
81
|
-
measurer: (0, pdf_codec.createFontMeasurer)(fonts),
|
|
82
|
-
mathMetricsAt
|
|
83
|
-
});
|
|
84
|
-
options?.onDocument?.({
|
|
85
|
-
formatVersion: document_schema_js.DOCUMENT_PACKAGE_FORMAT_VERSION,
|
|
86
|
-
content,
|
|
87
|
-
layout
|
|
88
|
-
});
|
|
89
|
-
return (0, pdf_codec.writePdf)(layout, {
|
|
90
|
-
signal: options?.signal,
|
|
91
|
-
onSubstitution: options?.onSubstitution,
|
|
92
|
-
formulas,
|
|
93
|
-
fonts
|
|
94
|
-
});
|
|
26
|
+
return require_convert_composition.convertDocument("odt", "pdf", bytes, options);
|
|
95
27
|
}
|
|
96
28
|
function pptxToPdf(bytes, options) {
|
|
97
|
-
|
|
98
|
-
const read = require_ooxml_pptx_read.readPptxContent(pkg);
|
|
99
|
-
if (read.kind !== "presentation") throw new Error("readPptxContent returned a non-presentation ContentDocument");
|
|
100
|
-
const content = {
|
|
101
|
-
...read,
|
|
102
|
-
metadata: require_model_metadata.resolveMetadataTimestamps(read.metadata, options?.clock)
|
|
103
|
-
};
|
|
104
|
-
const fonts = require_fonts_registry.createDocumentFontRegistry({
|
|
105
|
-
kind: "pptx",
|
|
106
|
-
package: pkg
|
|
107
|
-
}, options);
|
|
108
|
-
const { document: layout, formulas } = require_layout_slides.convertPresentationToLayout(content, {
|
|
109
|
-
measurer: (0, pdf_codec.createFontMeasurer)(fonts),
|
|
110
|
-
mathMetricsAt
|
|
111
|
-
});
|
|
112
|
-
options?.onDocument?.({
|
|
113
|
-
formatVersion: document_schema_js.DOCUMENT_PACKAGE_FORMAT_VERSION,
|
|
114
|
-
content,
|
|
115
|
-
layout
|
|
116
|
-
});
|
|
117
|
-
return (0, pdf_codec.writePdf)(layout, {
|
|
118
|
-
signal: options?.signal,
|
|
119
|
-
onSubstitution: options?.onSubstitution,
|
|
120
|
-
formulas,
|
|
121
|
-
fonts
|
|
122
|
-
});
|
|
29
|
+
return require_convert_composition.convertDocument("pptx", "pdf", bytes, options);
|
|
123
30
|
}
|
|
124
31
|
function odpToPdf(bytes, options) {
|
|
125
|
-
|
|
126
|
-
const read = require_odf_odp_read.readOdpContent(pkg);
|
|
127
|
-
if (read.kind !== "presentation") throw new Error("readOdpContent returned a non-presentation ContentDocument");
|
|
128
|
-
const content = {
|
|
129
|
-
...read,
|
|
130
|
-
metadata: require_model_metadata.resolveMetadataTimestamps(read.metadata, options?.clock)
|
|
131
|
-
};
|
|
132
|
-
const fonts = require_fonts_registry.createDocumentFontRegistry({
|
|
133
|
-
kind: "odf",
|
|
134
|
-
package: pkg
|
|
135
|
-
}, options);
|
|
136
|
-
const { document: layout, formulas } = require_layout_slides.convertPresentationToLayout(content, {
|
|
137
|
-
measurer: (0, pdf_codec.createFontMeasurer)(fonts),
|
|
138
|
-
mathMetricsAt
|
|
139
|
-
});
|
|
140
|
-
options?.onDocument?.({
|
|
141
|
-
formatVersion: document_schema_js.DOCUMENT_PACKAGE_FORMAT_VERSION,
|
|
142
|
-
content,
|
|
143
|
-
layout
|
|
144
|
-
});
|
|
145
|
-
return (0, pdf_codec.writePdf)(layout, {
|
|
146
|
-
signal: options?.signal,
|
|
147
|
-
onSubstitution: options?.onSubstitution,
|
|
148
|
-
formulas,
|
|
149
|
-
fonts
|
|
150
|
-
});
|
|
32
|
+
return require_convert_composition.convertDocument("odp", "pdf", bytes, options);
|
|
151
33
|
}
|
|
152
34
|
function odsToPdf(bytes, options) {
|
|
153
|
-
|
|
154
|
-
const read = require_odf_ods_read.readOdsContent(pkg);
|
|
155
|
-
if (read.kind !== "spreadsheet") throw new Error("readOdsContent returned a non-spreadsheet ContentDocument");
|
|
156
|
-
const content = {
|
|
157
|
-
...read,
|
|
158
|
-
metadata: require_model_metadata.resolveMetadataTimestamps(read.metadata, options?.clock)
|
|
159
|
-
};
|
|
160
|
-
const fonts = require_fonts_registry.createDocumentFontRegistry({
|
|
161
|
-
kind: "odf",
|
|
162
|
-
package: pkg
|
|
163
|
-
}, options);
|
|
164
|
-
const { document: layout, formulas } = require_layout_sheets.convertSpreadsheetToLayout(content, {
|
|
165
|
-
measurer: (0, pdf_codec.createFontMeasurer)(fonts),
|
|
166
|
-
mathMetricsAt,
|
|
167
|
-
signal: options?.signal
|
|
168
|
-
});
|
|
169
|
-
options?.onDocument?.({
|
|
170
|
-
formatVersion: document_schema_js.DOCUMENT_PACKAGE_FORMAT_VERSION,
|
|
171
|
-
content,
|
|
172
|
-
layout
|
|
173
|
-
});
|
|
174
|
-
return (0, pdf_codec.writePdf)(layout, {
|
|
175
|
-
signal: options?.signal,
|
|
176
|
-
onSubstitution: options?.onSubstitution,
|
|
177
|
-
formulas,
|
|
178
|
-
fonts
|
|
179
|
-
});
|
|
35
|
+
return require_convert_composition.convertDocument("ods", "pdf", bytes, options);
|
|
180
36
|
}
|
|
181
37
|
function odgToPdf(bytes, options) {
|
|
182
|
-
|
|
183
|
-
const read = require_odf_odg_read.readOdgContent(pkg);
|
|
184
|
-
if (read.kind !== "drawing") throw new Error("readOdgContent returned a non-drawing ContentDocument");
|
|
185
|
-
const content = {
|
|
186
|
-
...read,
|
|
187
|
-
metadata: require_model_metadata.resolveMetadataTimestamps(read.metadata, options?.clock)
|
|
188
|
-
};
|
|
189
|
-
const fonts = require_fonts_registry.createDocumentFontRegistry({
|
|
190
|
-
kind: "odf",
|
|
191
|
-
package: pkg
|
|
192
|
-
}, options);
|
|
193
|
-
const layout = require_layout_drawing.convertDrawingToLayout(content, { measurer: (0, pdf_codec.createFontMeasurer)(fonts) });
|
|
194
|
-
options?.onDocument?.({
|
|
195
|
-
formatVersion: document_schema_js.DOCUMENT_PACKAGE_FORMAT_VERSION,
|
|
196
|
-
content,
|
|
197
|
-
layout
|
|
198
|
-
});
|
|
199
|
-
return (0, pdf_codec.writePdf)(layout, {
|
|
200
|
-
signal: options?.signal,
|
|
201
|
-
onSubstitution: options?.onSubstitution,
|
|
202
|
-
fonts
|
|
203
|
-
});
|
|
38
|
+
return require_convert_composition.convertDocument("odg", "pdf", bytes, options);
|
|
204
39
|
}
|
|
205
40
|
function markdownToPdf(bytes, options) {
|
|
206
|
-
|
|
207
|
-
const text = require_markdown_text.decodeMarkdownText(bytes);
|
|
208
|
-
const read = require_markdown_read.readMarkdownContent(text, {
|
|
209
|
-
signal: options?.signal,
|
|
210
|
-
images: options?.images
|
|
211
|
-
});
|
|
212
|
-
if (read.kind !== "wordprocessing") throw new Error("readMarkdownContent returned a non-wordprocessing ContentDocument");
|
|
213
|
-
const content = {
|
|
214
|
-
...read,
|
|
215
|
-
metadata: require_model_metadata.resolveMetadataTimestamps(read.metadata, options?.clock)
|
|
216
|
-
};
|
|
217
|
-
const fonts = (0, pdf_codec.createFontRegistry)({
|
|
218
|
-
fonts: options?.fonts,
|
|
219
|
-
onSubstitution: options?.onFontSubstitution
|
|
220
|
-
});
|
|
221
|
-
const { document: layout, formulas } = require_layout_engine.convertWordprocessingToLayout(content, {
|
|
222
|
-
measurer: (0, pdf_codec.createFontMeasurer)(fonts),
|
|
223
|
-
mathMetricsAt
|
|
224
|
-
});
|
|
225
|
-
options?.onDocument?.({
|
|
226
|
-
formatVersion: document_schema_js.DOCUMENT_PACKAGE_FORMAT_VERSION,
|
|
227
|
-
content,
|
|
228
|
-
layout
|
|
229
|
-
});
|
|
230
|
-
return (0, pdf_codec.writePdf)(layout, {
|
|
231
|
-
signal: options?.signal,
|
|
232
|
-
onSubstitution: options?.onSubstitution,
|
|
233
|
-
formulas,
|
|
234
|
-
fonts
|
|
235
|
-
});
|
|
41
|
+
return require_convert_composition.convertDocument("markdown", "pdf", bytes, options);
|
|
236
42
|
}
|
|
237
43
|
const STANDALONE_FORMULA_SIZE_PT = 18;
|
|
238
44
|
const STANDALONE_FORMULA_MARGIN_PT = 72;
|
|
@@ -284,332 +90,79 @@ function odfToPdf(bytes, options) {
|
|
|
284
90
|
});
|
|
285
91
|
}
|
|
286
92
|
function pdfToDocx(bytes, options) {
|
|
287
|
-
|
|
288
|
-
signal: options?.signal,
|
|
289
|
-
sink: options?.sink
|
|
290
|
-
});
|
|
291
|
-
const content = require_layout_reconstruct.reconstructWordprocessing(layout, { signal: options?.signal });
|
|
292
|
-
options?.onDocument?.({
|
|
293
|
-
formatVersion: document_schema_js.DOCUMENT_PACKAGE_FORMAT_VERSION,
|
|
294
|
-
content,
|
|
295
|
-
layout
|
|
296
|
-
});
|
|
297
|
-
return (0, ooxml_js.encodePackage)(require_edit_docx_content.buildDocxPackage(content));
|
|
93
|
+
return require_convert_composition.convertDocument("pdf", "docx", bytes, options);
|
|
298
94
|
}
|
|
299
95
|
function pdfToPptx(bytes, options) {
|
|
300
|
-
|
|
301
|
-
signal: options?.signal,
|
|
302
|
-
sink: options?.sink
|
|
303
|
-
});
|
|
304
|
-
const content = require_layout_reconstruct.reconstructPresentation(layout, { signal: options?.signal });
|
|
305
|
-
options?.onDocument?.({
|
|
306
|
-
formatVersion: document_schema_js.DOCUMENT_PACKAGE_FORMAT_VERSION,
|
|
307
|
-
content,
|
|
308
|
-
layout
|
|
309
|
-
});
|
|
310
|
-
return (0, ooxml_js.encodePackage)(require_edit_pptx_content.buildPptxPackage(content));
|
|
96
|
+
return require_convert_composition.convertDocument("pdf", "pptx", bytes, options);
|
|
311
97
|
}
|
|
312
98
|
function pdfToOdt(bytes, options) {
|
|
313
|
-
|
|
314
|
-
signal: options?.signal,
|
|
315
|
-
sink: options?.sink
|
|
316
|
-
});
|
|
317
|
-
const content = require_layout_reconstruct.reconstructWordprocessing(layout, { signal: options?.signal });
|
|
318
|
-
options?.onDocument?.({
|
|
319
|
-
formatVersion: document_schema_js.DOCUMENT_PACKAGE_FORMAT_VERSION,
|
|
320
|
-
content,
|
|
321
|
-
layout
|
|
322
|
-
});
|
|
323
|
-
return (0, odf_js.encodePackage)(require_edit_odt_content.buildOdtPackage(content));
|
|
99
|
+
return require_convert_composition.convertDocument("pdf", "odt", bytes, options);
|
|
324
100
|
}
|
|
325
101
|
function pdfToOdp(bytes, options) {
|
|
326
|
-
|
|
327
|
-
signal: options?.signal,
|
|
328
|
-
sink: options?.sink
|
|
329
|
-
});
|
|
330
|
-
const content = require_layout_reconstruct.reconstructPresentation(layout, { signal: options?.signal });
|
|
331
|
-
options?.onDocument?.({
|
|
332
|
-
formatVersion: document_schema_js.DOCUMENT_PACKAGE_FORMAT_VERSION,
|
|
333
|
-
content,
|
|
334
|
-
layout
|
|
335
|
-
});
|
|
336
|
-
return (0, odf_js.encodePackage)(require_edit_odp_content.buildOdpPackage(content));
|
|
102
|
+
return require_convert_composition.convertDocument("pdf", "odp", bytes, options);
|
|
337
103
|
}
|
|
338
104
|
function pdfToOdg(bytes, options) {
|
|
339
|
-
|
|
340
|
-
signal: options?.signal,
|
|
341
|
-
sink: options?.sink
|
|
342
|
-
});
|
|
343
|
-
const content = require_layout_reconstruct.reconstructDrawing(layout, { signal: options?.signal });
|
|
344
|
-
options?.onDocument?.({
|
|
345
|
-
formatVersion: document_schema_js.DOCUMENT_PACKAGE_FORMAT_VERSION,
|
|
346
|
-
content,
|
|
347
|
-
layout
|
|
348
|
-
});
|
|
349
|
-
return (0, odf_js.encodePackage)(require_edit_odg_content.buildOdgPackage(content));
|
|
105
|
+
return require_convert_composition.convertDocument("pdf", "odg", bytes, options);
|
|
350
106
|
}
|
|
351
107
|
function pdfToOds(bytes, options) {
|
|
352
|
-
|
|
353
|
-
signal: options?.signal,
|
|
354
|
-
sink: options?.sink
|
|
355
|
-
});
|
|
356
|
-
const content = require_layout_reconstruct.reconstructSpreadsheet(layout, { signal: options?.signal });
|
|
357
|
-
options?.onDocument?.({
|
|
358
|
-
formatVersion: document_schema_js.DOCUMENT_PACKAGE_FORMAT_VERSION,
|
|
359
|
-
content,
|
|
360
|
-
layout
|
|
361
|
-
});
|
|
362
|
-
return (0, odf_js.encodePackage)(require_edit_ods_content.buildOdsPackage(content));
|
|
108
|
+
return require_convert_composition.convertDocument("pdf", "ods", bytes, options);
|
|
363
109
|
}
|
|
364
110
|
function pdfToMarkdown(bytes, options) {
|
|
365
|
-
|
|
366
|
-
signal: options?.signal,
|
|
367
|
-
sink: options?.sink
|
|
368
|
-
});
|
|
369
|
-
const content = require_layout_reconstruct.reconstructWordprocessing(layout, { signal: options?.signal });
|
|
370
|
-
options?.onDocument?.({
|
|
371
|
-
formatVersion: document_schema_js.DOCUMENT_PACKAGE_FORMAT_VERSION,
|
|
372
|
-
content,
|
|
373
|
-
layout
|
|
374
|
-
});
|
|
375
|
-
const text = require_markdown_write.buildMarkdownText(content);
|
|
376
|
-
return require_markdown_text.encodeMarkdownText(text);
|
|
111
|
+
return require_convert_composition.convertDocument("pdf", "markdown", bytes, options);
|
|
377
112
|
}
|
|
378
113
|
function odtToDocx(bytes, options) {
|
|
379
|
-
|
|
380
|
-
const pkg = (0, odf_js.decodePackage)(bytes);
|
|
381
|
-
const content = require_odf_odt_read.readOdtContent(pkg);
|
|
382
|
-
if (content.kind !== "wordprocessing") throw new Error("readOdtContent returned a non-wordprocessing ContentDocument");
|
|
383
|
-
require_ports_abort.throwIfAborted(options?.signal);
|
|
384
|
-
options?.onDocument?.({
|
|
385
|
-
formatVersion: document_schema_js.DOCUMENT_PACKAGE_FORMAT_VERSION,
|
|
386
|
-
content
|
|
387
|
-
});
|
|
388
|
-
return (0, ooxml_js.encodePackage)(require_edit_docx_content.buildDocxPackage(content, { onMathDiagnostic: options?.onMathDiagnostic }));
|
|
114
|
+
return require_convert_composition.convertDocument("odt", "docx", bytes, options);
|
|
389
115
|
}
|
|
390
116
|
function docxToOdt(bytes, options) {
|
|
391
|
-
|
|
392
|
-
const pkg = (0, ooxml_js.decodePackage)(bytes);
|
|
393
|
-
const content = require_ooxml_docx_read.readDocxContent(pkg, { onMathDiagnostic: options?.onMathDiagnostic });
|
|
394
|
-
if (content.kind !== "wordprocessing") throw new Error("readDocxContent returned a non-wordprocessing ContentDocument");
|
|
395
|
-
require_ports_abort.throwIfAborted(options?.signal);
|
|
396
|
-
options?.onDocument?.({
|
|
397
|
-
formatVersion: document_schema_js.DOCUMENT_PACKAGE_FORMAT_VERSION,
|
|
398
|
-
content
|
|
399
|
-
});
|
|
400
|
-
return (0, odf_js.encodePackage)(require_edit_odt_content.buildOdtPackage(content));
|
|
117
|
+
return require_convert_composition.convertDocument("docx", "odt", bytes, options);
|
|
401
118
|
}
|
|
402
119
|
function odpToPptx(bytes, options) {
|
|
403
|
-
|
|
404
|
-
const pkg = (0, odf_js.decodePackage)(bytes);
|
|
405
|
-
const content = require_odf_odp_read.readOdpContent(pkg);
|
|
406
|
-
if (content.kind !== "presentation") throw new Error("readOdpContent returned a non-presentation ContentDocument");
|
|
407
|
-
require_ports_abort.throwIfAborted(options?.signal);
|
|
408
|
-
options?.onDocument?.({
|
|
409
|
-
formatVersion: document_schema_js.DOCUMENT_PACKAGE_FORMAT_VERSION,
|
|
410
|
-
content
|
|
411
|
-
});
|
|
412
|
-
return (0, ooxml_js.encodePackage)(require_edit_pptx_content.buildPptxPackage(content));
|
|
120
|
+
return require_convert_composition.convertDocument("odp", "pptx", bytes, options);
|
|
413
121
|
}
|
|
414
122
|
function pptxToOdp(bytes, options) {
|
|
415
|
-
|
|
416
|
-
const pkg = (0, ooxml_js.decodePackage)(bytes);
|
|
417
|
-
const content = require_ooxml_pptx_read.readPptxContent(pkg);
|
|
418
|
-
if (content.kind !== "presentation") throw new Error("readPptxContent returned a non-presentation ContentDocument");
|
|
419
|
-
require_ports_abort.throwIfAborted(options?.signal);
|
|
420
|
-
options?.onDocument?.({
|
|
421
|
-
formatVersion: document_schema_js.DOCUMENT_PACKAGE_FORMAT_VERSION,
|
|
422
|
-
content
|
|
423
|
-
});
|
|
424
|
-
return (0, odf_js.encodePackage)(require_edit_odp_content.buildOdpPackage(content));
|
|
123
|
+
return require_convert_composition.convertDocument("pptx", "odp", bytes, options);
|
|
425
124
|
}
|
|
426
125
|
function odsToXlsx(bytes, options) {
|
|
427
|
-
|
|
428
|
-
const pkg = (0, odf_js.decodePackage)(bytes);
|
|
429
|
-
const content = require_odf_ods_read.readOdsContent(pkg);
|
|
430
|
-
if (content.kind !== "spreadsheet") throw new Error("readOdsContent returned a non-spreadsheet ContentDocument");
|
|
431
|
-
require_ports_abort.throwIfAborted(options?.signal);
|
|
432
|
-
options?.onDocument?.({
|
|
433
|
-
formatVersion: document_schema_js.DOCUMENT_PACKAGE_FORMAT_VERSION,
|
|
434
|
-
content
|
|
435
|
-
});
|
|
436
|
-
return (0, ooxml_js.encodePackage)((0, ooxml_js.buildXlsxPackage)(content));
|
|
126
|
+
return require_convert_composition.convertDocument("ods", "xlsx", bytes, options);
|
|
437
127
|
}
|
|
438
128
|
function xlsxToOds(bytes, options) {
|
|
439
|
-
|
|
440
|
-
const pkg = (0, ooxml_js.decodePackage)(bytes);
|
|
441
|
-
const content = (0, ooxml_js.readXlsxContent)(pkg);
|
|
442
|
-
if (content.kind !== "spreadsheet") throw new Error("readXlsxContent returned a non-spreadsheet ContentDocument");
|
|
443
|
-
require_ports_abort.throwIfAborted(options?.signal);
|
|
444
|
-
options?.onDocument?.({
|
|
445
|
-
formatVersion: document_schema_js.DOCUMENT_PACKAGE_FORMAT_VERSION,
|
|
446
|
-
content
|
|
447
|
-
});
|
|
448
|
-
return (0, odf_js.encodePackage)(require_edit_ods_content.buildOdsPackage(content));
|
|
129
|
+
return require_convert_composition.convertDocument("xlsx", "ods", bytes, options);
|
|
449
130
|
}
|
|
450
131
|
function markdownToDocx(bytes, options) {
|
|
451
|
-
|
|
452
|
-
const text = require_markdown_text.decodeMarkdownText(bytes);
|
|
453
|
-
const content = require_markdown_read.readMarkdownContent(text, {
|
|
454
|
-
signal: options?.signal,
|
|
455
|
-
images: options?.images
|
|
456
|
-
});
|
|
457
|
-
if (content.kind !== "wordprocessing") throw new Error("readMarkdownContent returned a non-wordprocessing ContentDocument");
|
|
458
|
-
require_ports_abort.throwIfAborted(options?.signal);
|
|
459
|
-
options?.onDocument?.({
|
|
460
|
-
formatVersion: document_schema_js.DOCUMENT_PACKAGE_FORMAT_VERSION,
|
|
461
|
-
content
|
|
462
|
-
});
|
|
463
|
-
return (0, ooxml_js.encodePackage)(require_edit_docx_content.buildDocxPackage(content, { onMathDiagnostic: options?.onMathDiagnostic }));
|
|
132
|
+
return require_convert_composition.convertDocument("markdown", "docx", bytes, options);
|
|
464
133
|
}
|
|
465
134
|
function docxToMarkdown(bytes, options) {
|
|
466
|
-
|
|
467
|
-
const pkg = (0, ooxml_js.decodePackage)(bytes);
|
|
468
|
-
const content = require_ooxml_docx_read.readDocxContent(pkg, { onMathDiagnostic: options?.onMathDiagnostic });
|
|
469
|
-
if (content.kind !== "wordprocessing") throw new Error("readDocxContent returned a non-wordprocessing ContentDocument");
|
|
470
|
-
require_ports_abort.throwIfAborted(options?.signal);
|
|
471
|
-
options?.onDocument?.({
|
|
472
|
-
formatVersion: document_schema_js.DOCUMENT_PACKAGE_FORMAT_VERSION,
|
|
473
|
-
content
|
|
474
|
-
});
|
|
475
|
-
const text = require_markdown_write.buildMarkdownText(content);
|
|
476
|
-
return require_markdown_text.encodeMarkdownText(text);
|
|
135
|
+
return require_convert_composition.convertDocument("docx", "markdown", bytes, options);
|
|
477
136
|
}
|
|
478
137
|
function markdownToOdt(bytes, options) {
|
|
479
|
-
|
|
480
|
-
const text = require_markdown_text.decodeMarkdownText(bytes);
|
|
481
|
-
const content = require_markdown_read.readMarkdownContent(text, {
|
|
482
|
-
signal: options?.signal,
|
|
483
|
-
images: options?.images
|
|
484
|
-
});
|
|
485
|
-
if (content.kind !== "wordprocessing") throw new Error("readMarkdownContent returned a non-wordprocessing ContentDocument");
|
|
486
|
-
require_ports_abort.throwIfAborted(options?.signal);
|
|
487
|
-
options?.onDocument?.({
|
|
488
|
-
formatVersion: document_schema_js.DOCUMENT_PACKAGE_FORMAT_VERSION,
|
|
489
|
-
content
|
|
490
|
-
});
|
|
491
|
-
return (0, odf_js.encodePackage)(require_edit_odt_content.buildOdtPackage(content));
|
|
138
|
+
return require_convert_composition.convertDocument("markdown", "odt", bytes, options);
|
|
492
139
|
}
|
|
493
140
|
function odtToMarkdown(bytes, options) {
|
|
494
|
-
|
|
495
|
-
const pkg = (0, odf_js.decodePackage)(bytes);
|
|
496
|
-
const content = require_odf_odt_read.readOdtContent(pkg);
|
|
497
|
-
if (content.kind !== "wordprocessing") throw new Error("readOdtContent returned a non-wordprocessing ContentDocument");
|
|
498
|
-
require_ports_abort.throwIfAborted(options?.signal);
|
|
499
|
-
options?.onDocument?.({
|
|
500
|
-
formatVersion: document_schema_js.DOCUMENT_PACKAGE_FORMAT_VERSION,
|
|
501
|
-
content
|
|
502
|
-
});
|
|
503
|
-
const text = require_markdown_write.buildMarkdownText(content);
|
|
504
|
-
return require_markdown_text.encodeMarkdownText(text);
|
|
141
|
+
return require_convert_composition.convertDocument("odt", "markdown", bytes, options);
|
|
505
142
|
}
|
|
506
143
|
function docxToPptx(bytes, options) {
|
|
507
|
-
|
|
508
|
-
const content = require_ooxml_docx_read.readDocxContent((0, odf_js.decodePackage)(bytes));
|
|
509
|
-
if (content.kind !== "wordprocessing") throw new Error("readDocxContent returned a non-wordprocessing ContentDocument");
|
|
510
|
-
const presentation = require_convert_variant_bridges.wordprocessingToPresentation(content);
|
|
511
|
-
require_ports_abort.throwIfAborted(options?.signal);
|
|
512
|
-
options?.onDocument?.({
|
|
513
|
-
formatVersion: document_schema_js.DOCUMENT_PACKAGE_FORMAT_VERSION,
|
|
514
|
-
content: presentation
|
|
515
|
-
});
|
|
516
|
-
return (0, ooxml_js.encodePackage)(require_edit_pptx_content.buildPptxPackage(presentation));
|
|
144
|
+
return require_convert_composition.convertDocument("docx", "pptx", bytes, options);
|
|
517
145
|
}
|
|
518
146
|
function pptxToDocx(bytes, options) {
|
|
519
|
-
|
|
520
|
-
const content = require_ooxml_pptx_read.readPptxContent((0, odf_js.decodePackage)(bytes));
|
|
521
|
-
if (content.kind !== "presentation") throw new Error("readPptxContent returned a non-presentation ContentDocument");
|
|
522
|
-
const wordprocessing = require_convert_variant_bridges.presentationToWordprocessing(content);
|
|
523
|
-
require_ports_abort.throwIfAborted(options?.signal);
|
|
524
|
-
options?.onDocument?.({
|
|
525
|
-
formatVersion: document_schema_js.DOCUMENT_PACKAGE_FORMAT_VERSION,
|
|
526
|
-
content: wordprocessing
|
|
527
|
-
});
|
|
528
|
-
return (0, ooxml_js.encodePackage)(require_edit_docx_content.buildDocxPackage(wordprocessing, { onMathDiagnostic: options?.onMathDiagnostic }));
|
|
147
|
+
return require_convert_composition.convertDocument("pptx", "docx", bytes, options);
|
|
529
148
|
}
|
|
530
149
|
function odtToOdp(bytes, options) {
|
|
531
|
-
|
|
532
|
-
const pkg = (0, odf_js.decodePackage)(bytes);
|
|
533
|
-
const content = require_odf_odt_read.readOdtContent(pkg);
|
|
534
|
-
if (content.kind !== "wordprocessing") throw new Error("readOdtContent returned a non-wordprocessing ContentDocument");
|
|
535
|
-
const presentation = require_convert_variant_bridges.wordprocessingToPresentation(content);
|
|
536
|
-
require_ports_abort.throwIfAborted(options?.signal);
|
|
537
|
-
options?.onDocument?.({
|
|
538
|
-
formatVersion: document_schema_js.DOCUMENT_PACKAGE_FORMAT_VERSION,
|
|
539
|
-
content: presentation
|
|
540
|
-
});
|
|
541
|
-
return (0, ooxml_js.encodePackage)(require_edit_odp_content.buildOdpPackage(presentation));
|
|
150
|
+
return require_convert_composition.convertDocument("odt", "odp", bytes, options);
|
|
542
151
|
}
|
|
543
152
|
function odpToOdt(bytes, options) {
|
|
544
|
-
|
|
545
|
-
const pkg = (0, odf_js.decodePackage)(bytes);
|
|
546
|
-
const content = require_odf_odp_read.readOdpContent(pkg);
|
|
547
|
-
if (content.kind !== "presentation") throw new Error("readOdpContent returned a non-presentation ContentDocument");
|
|
548
|
-
const wordprocessing = require_convert_variant_bridges.presentationToWordprocessing(content);
|
|
549
|
-
require_ports_abort.throwIfAborted(options?.signal);
|
|
550
|
-
options?.onDocument?.({
|
|
551
|
-
formatVersion: document_schema_js.DOCUMENT_PACKAGE_FORMAT_VERSION,
|
|
552
|
-
content: wordprocessing
|
|
553
|
-
});
|
|
554
|
-
return (0, ooxml_js.encodePackage)(require_edit_odt_content.buildOdtPackage(wordprocessing));
|
|
153
|
+
return require_convert_composition.convertDocument("odp", "odt", bytes, options);
|
|
555
154
|
}
|
|
556
155
|
function xlsxToPdf(bytes, options) {
|
|
557
|
-
|
|
558
|
-
const odsBytes = xlsxToOds(bytes, { signal: options?.signal });
|
|
559
|
-
require_ports_abort.throwIfAborted(options?.signal);
|
|
560
|
-
return odsToPdf(odsBytes, {
|
|
561
|
-
signal: options?.signal,
|
|
562
|
-
onSubstitution: options?.onSubstitution,
|
|
563
|
-
onDocument: options?.onDocument,
|
|
564
|
-
fonts: options?.fonts,
|
|
565
|
-
onFontSubstitution: options?.onFontSubstitution,
|
|
566
|
-
clock: options?.clock
|
|
567
|
-
});
|
|
156
|
+
return require_convert_composition.convertDocument("xlsx", "pdf", bytes, options);
|
|
568
157
|
}
|
|
569
158
|
function pdfToXlsx(bytes, options) {
|
|
570
|
-
|
|
571
|
-
const odsBytes = pdfToOds(bytes, {
|
|
572
|
-
signal: options?.signal,
|
|
573
|
-
sink: options?.sink
|
|
574
|
-
});
|
|
575
|
-
require_ports_abort.throwIfAborted(options?.signal);
|
|
576
|
-
return odsToXlsx(odsBytes, {
|
|
577
|
-
signal: options?.signal,
|
|
578
|
-
onDocument: options?.onDocument
|
|
579
|
-
});
|
|
159
|
+
return require_convert_composition.convertDocument("pdf", "xlsx", bytes, options);
|
|
580
160
|
}
|
|
581
161
|
function xlsxToMarkdown(bytes, options) {
|
|
582
|
-
|
|
583
|
-
const pdfBytes = xlsxToPdf(bytes, {
|
|
584
|
-
signal: options?.signal,
|
|
585
|
-
fonts: options?.fonts,
|
|
586
|
-
onFontSubstitution: options?.onFontSubstitution,
|
|
587
|
-
onSubstitution: options?.onSubstitution,
|
|
588
|
-
clock: options?.clock
|
|
589
|
-
});
|
|
590
|
-
require_ports_abort.throwIfAborted(options?.signal);
|
|
591
|
-
return pdfToMarkdown(pdfBytes, {
|
|
592
|
-
signal: options?.signal,
|
|
593
|
-
sink: options?.sink,
|
|
594
|
-
onDocument: options?.onDocument
|
|
595
|
-
});
|
|
162
|
+
return require_convert_composition.convertDocument("xlsx", "markdown", bytes, options);
|
|
596
163
|
}
|
|
597
164
|
function markdownToXlsx(bytes, options) {
|
|
598
|
-
|
|
599
|
-
const pdfBytes = markdownToPdf(bytes, {
|
|
600
|
-
signal: options?.signal,
|
|
601
|
-
fonts: options?.fonts,
|
|
602
|
-
onFontSubstitution: options?.onFontSubstitution,
|
|
603
|
-
onSubstitution: options?.onSubstitution,
|
|
604
|
-
clock: options?.clock,
|
|
605
|
-
images: options?.images
|
|
606
|
-
});
|
|
607
|
-
require_ports_abort.throwIfAborted(options?.signal);
|
|
608
|
-
return pdfToXlsx(pdfBytes, {
|
|
609
|
-
signal: options?.signal,
|
|
610
|
-
sink: options?.sink,
|
|
611
|
-
onDocument: options?.onDocument
|
|
612
|
-
});
|
|
165
|
+
return require_convert_composition.convertDocument("markdown", "xlsx", bytes, options);
|
|
613
166
|
}
|
|
614
167
|
var OdmUnresolvedSectionError = class extends Error {
|
|
615
168
|
hrefs;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { t as ClockPort } from "../clock-C7SUuYN0.cjs";
|
|
2
|
-
import { n as HsqldbDecodeOptions } from "../rowformat-Cl2exlEh.cjs";
|
|
3
2
|
import { t as OmmlDiagnostic } from "../shared-DLZ3IQUl.cjs";
|
|
4
|
-
import {
|
|
3
|
+
import { HsqldbDecodeOptions } from "../hsqldb/rowformat.cjs";
|
|
4
|
+
import { DocumentFontRegistryOptions } from "../fonts/registry.cjs";
|
|
5
5
|
import { ContentDocument, ContentSection, DocumentPackage } from "document-schema.js";
|
|
6
6
|
import { MarkdownImageResolver } from "markdown-codec";
|
|
7
|
-
import { OdmSection, Package } from "odf.js";
|
|
8
7
|
import { PdfDiagnosticSink, WinAnsiSubstitution } from "pdf-codec";
|
|
8
|
+
import { OdmSection, Package } from "odf.js";
|
|
9
9
|
//#region src/convert/convert.d.ts
|
|
10
10
|
interface DocumentToPdfOptions extends DocumentFontRegistryOptions {
|
|
11
11
|
readonly signal?: AbortSignal;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as ClockPort } from "../clock-C7SUuYN0.js";
|
|
2
|
-
import { n as HsqldbDecodeOptions } from "../rowformat-Cl2exlEh.js";
|
|
3
2
|
import { t as OmmlDiagnostic } from "../shared-DUOzjwcL.js";
|
|
4
|
-
import {
|
|
3
|
+
import { HsqldbDecodeOptions } from "../hsqldb/rowformat.js";
|
|
4
|
+
import { DocumentFontRegistryOptions } from "../fonts/registry.js";
|
|
5
5
|
import { ContentDocument, ContentSection, DocumentPackage } from "document-schema.js";
|
|
6
6
|
import { OdmSection, Package } from "odf.js";
|
|
7
7
|
import { MarkdownImageResolver } from "markdown-codec";
|