documents.js 1.58.0 → 1.59.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 +10 -7
- package/dist/convert/capability.cjs +198 -0
- package/dist/convert/capability.d.cts +42 -0
- package/dist/convert/capability.d.ts +42 -0
- package/dist/convert/capability.js +195 -0
- package/dist/convert/codec.cjs +5 -0
- package/dist/convert/codec.d.cts +2 -1
- package/dist/convert/codec.d.ts +2 -1
- package/dist/convert/codec.js +6 -2
- package/dist/convert/convert.cjs +24 -0
- package/dist/convert/convert.d.cts +3 -1
- package/dist/convert/convert.d.ts +3 -1
- package/dist/convert/convert.js +23 -1
- package/dist/convert/local.cjs +26 -335
- package/dist/convert/local.js +26 -335
- package/dist/edit/ods/column-row.cjs +31 -0
- package/dist/edit/ods/column-row.d.cts +6 -0
- package/dist/edit/ods/column-row.d.ts +6 -0
- package/dist/edit/ods/column-row.js +29 -0
- package/dist/edit/ods/content.cjs +2 -0
- package/dist/edit/ods/content.js +2 -0
- package/dist/edit/ods/sheet.cjs +7 -0
- package/dist/edit/ods/sheet.d.cts +2 -0
- package/dist/edit/ods/sheet.d.ts +2 -0
- package/dist/edit/ods/sheet.js +7 -0
- package/dist/index.cjs +3 -0
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/dist/convert/convert.cjs
CHANGED
|
@@ -322,6 +322,28 @@ function xlsxToOds(bytes, options) {
|
|
|
322
322
|
});
|
|
323
323
|
return (0, odf_js.encodePackage)(require_edit_ods_content.buildOdsPackage(content));
|
|
324
324
|
}
|
|
325
|
+
function xlsxToPdf(bytes, options) {
|
|
326
|
+
require_ports_abort.throwIfAborted(options?.signal);
|
|
327
|
+
const odsBytes = xlsxToOds(bytes, { signal: options?.signal });
|
|
328
|
+
require_ports_abort.throwIfAborted(options?.signal);
|
|
329
|
+
return odsToPdf(odsBytes, {
|
|
330
|
+
signal: options?.signal,
|
|
331
|
+
onSubstitution: options?.onSubstitution,
|
|
332
|
+
onDocument: options?.onDocument
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
function pdfToXlsx(bytes, options) {
|
|
336
|
+
require_ports_abort.throwIfAborted(options?.signal);
|
|
337
|
+
const odsBytes = pdfToOds(bytes, {
|
|
338
|
+
signal: options?.signal,
|
|
339
|
+
sink: options?.sink
|
|
340
|
+
});
|
|
341
|
+
require_ports_abort.throwIfAborted(options?.signal);
|
|
342
|
+
return odsToXlsx(odsBytes, {
|
|
343
|
+
signal: options?.signal,
|
|
344
|
+
onDocument: options?.onDocument
|
|
345
|
+
});
|
|
346
|
+
}
|
|
325
347
|
var OdmUnresolvedSectionError = class extends Error {
|
|
326
348
|
hrefs;
|
|
327
349
|
constructor(hrefs) {
|
|
@@ -438,6 +460,8 @@ exports.pdfToOdp = pdfToOdp;
|
|
|
438
460
|
exports.pdfToOds = pdfToOds;
|
|
439
461
|
exports.pdfToOdt = pdfToOdt;
|
|
440
462
|
exports.pdfToPptx = pdfToPptx;
|
|
463
|
+
exports.pdfToXlsx = pdfToXlsx;
|
|
441
464
|
exports.pptxToOdp = pptxToOdp;
|
|
442
465
|
exports.pptxToPdf = pptxToPdf;
|
|
443
466
|
exports.xlsxToOds = xlsxToOds;
|
|
467
|
+
exports.xlsxToPdf = xlsxToPdf;
|
|
@@ -37,6 +37,8 @@ declare function odpToPptx(bytes: Uint8Array<ArrayBuffer>, options?: DocumentBri
|
|
|
37
37
|
declare function pptxToOdp(bytes: Uint8Array<ArrayBuffer>, options?: DocumentBridgeOptions): Uint8Array<ArrayBuffer>;
|
|
38
38
|
declare function odsToXlsx(bytes: Uint8Array<ArrayBuffer>, options?: DocumentBridgeOptions): Uint8Array<ArrayBuffer>;
|
|
39
39
|
declare function xlsxToOds(bytes: Uint8Array<ArrayBuffer>, options?: DocumentBridgeOptions): Uint8Array<ArrayBuffer>;
|
|
40
|
+
declare function xlsxToPdf(bytes: Uint8Array<ArrayBuffer>, options?: DocumentToPdfOptions): Uint8Array<ArrayBuffer>;
|
|
41
|
+
declare function pdfToXlsx(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
40
42
|
interface OdmToPdfOptions extends DocumentToPdfOptions {
|
|
41
43
|
readonly resolveSubDocument?: (href: string) => Uint8Array<ArrayBuffer> | undefined;
|
|
42
44
|
}
|
|
@@ -52,4 +54,4 @@ interface OdbToCsvOptions extends DocumentBridgeOptions {
|
|
|
52
54
|
}
|
|
53
55
|
declare function odbToCsv(bytes: Uint8Array<ArrayBuffer>, options?: OdbToCsvOptions): Uint8Array<ArrayBuffer>;
|
|
54
56
|
//#endregion
|
|
55
|
-
export { DocumentBridgeOptions, DocumentToPdfOptions, OdbToCsvOptions, OdmToPdfOptions, OdmUnresolvedSectionError, PdfToDocumentOptions, docxToOdt, docxToPdf, inlineOdmSectionToContentSection, odbToCsv, odbToXlsx, odfToPdf, odgToPdf, odmToPdf, odpToPdf, odpToPptx, odsToPdf, odsToXlsx, odtToDocx, odtToPdf, pdfToDocx, pdfToOdg, pdfToOdp, pdfToOds, pdfToOdt, pdfToPptx, pptxToOdp, pptxToPdf, xlsxToOds };
|
|
57
|
+
export { DocumentBridgeOptions, DocumentToPdfOptions, OdbToCsvOptions, OdmToPdfOptions, OdmUnresolvedSectionError, PdfToDocumentOptions, docxToOdt, docxToPdf, inlineOdmSectionToContentSection, odbToCsv, odbToXlsx, odfToPdf, odgToPdf, odmToPdf, odpToPdf, odpToPptx, odsToPdf, odsToXlsx, odtToDocx, odtToPdf, pdfToDocx, pdfToOdg, pdfToOdp, pdfToOds, pdfToOdt, pdfToPptx, pdfToXlsx, pptxToOdp, pptxToPdf, xlsxToOds, xlsxToPdf };
|
|
@@ -37,6 +37,8 @@ declare function odpToPptx(bytes: Uint8Array<ArrayBuffer>, options?: DocumentBri
|
|
|
37
37
|
declare function pptxToOdp(bytes: Uint8Array<ArrayBuffer>, options?: DocumentBridgeOptions): Uint8Array<ArrayBuffer>;
|
|
38
38
|
declare function odsToXlsx(bytes: Uint8Array<ArrayBuffer>, options?: DocumentBridgeOptions): Uint8Array<ArrayBuffer>;
|
|
39
39
|
declare function xlsxToOds(bytes: Uint8Array<ArrayBuffer>, options?: DocumentBridgeOptions): Uint8Array<ArrayBuffer>;
|
|
40
|
+
declare function xlsxToPdf(bytes: Uint8Array<ArrayBuffer>, options?: DocumentToPdfOptions): Uint8Array<ArrayBuffer>;
|
|
41
|
+
declare function pdfToXlsx(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
40
42
|
interface OdmToPdfOptions extends DocumentToPdfOptions {
|
|
41
43
|
readonly resolveSubDocument?: (href: string) => Uint8Array<ArrayBuffer> | undefined;
|
|
42
44
|
}
|
|
@@ -52,4 +54,4 @@ interface OdbToCsvOptions extends DocumentBridgeOptions {
|
|
|
52
54
|
}
|
|
53
55
|
declare function odbToCsv(bytes: Uint8Array<ArrayBuffer>, options?: OdbToCsvOptions): Uint8Array<ArrayBuffer>;
|
|
54
56
|
//#endregion
|
|
55
|
-
export { DocumentBridgeOptions, DocumentToPdfOptions, OdbToCsvOptions, OdmToPdfOptions, OdmUnresolvedSectionError, PdfToDocumentOptions, docxToOdt, docxToPdf, inlineOdmSectionToContentSection, odbToCsv, odbToXlsx, odfToPdf, odgToPdf, odmToPdf, odpToPdf, odpToPptx, odsToPdf, odsToXlsx, odtToDocx, odtToPdf, pdfToDocx, pdfToOdg, pdfToOdp, pdfToOds, pdfToOdt, pdfToPptx, pptxToOdp, pptxToPdf, xlsxToOds };
|
|
57
|
+
export { DocumentBridgeOptions, DocumentToPdfOptions, OdbToCsvOptions, OdmToPdfOptions, OdmUnresolvedSectionError, PdfToDocumentOptions, docxToOdt, docxToPdf, inlineOdmSectionToContentSection, odbToCsv, odbToXlsx, odfToPdf, odgToPdf, odmToPdf, odpToPdf, odpToPptx, odsToPdf, odsToXlsx, odtToDocx, odtToPdf, pdfToDocx, pdfToOdg, pdfToOdp, pdfToOds, pdfToOdt, pdfToPptx, pdfToXlsx, pptxToOdp, pptxToPdf, xlsxToOds, xlsxToPdf };
|
package/dist/convert/convert.js
CHANGED
|
@@ -321,6 +321,28 @@ function xlsxToOds(bytes, options) {
|
|
|
321
321
|
});
|
|
322
322
|
return encodePackage$1(buildOdsPackage(content));
|
|
323
323
|
}
|
|
324
|
+
function xlsxToPdf(bytes, options) {
|
|
325
|
+
throwIfAborted(options?.signal);
|
|
326
|
+
const odsBytes = xlsxToOds(bytes, { signal: options?.signal });
|
|
327
|
+
throwIfAborted(options?.signal);
|
|
328
|
+
return odsToPdf(odsBytes, {
|
|
329
|
+
signal: options?.signal,
|
|
330
|
+
onSubstitution: options?.onSubstitution,
|
|
331
|
+
onDocument: options?.onDocument
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
function pdfToXlsx(bytes, options) {
|
|
335
|
+
throwIfAborted(options?.signal);
|
|
336
|
+
const odsBytes = pdfToOds(bytes, {
|
|
337
|
+
signal: options?.signal,
|
|
338
|
+
sink: options?.sink
|
|
339
|
+
});
|
|
340
|
+
throwIfAborted(options?.signal);
|
|
341
|
+
return odsToXlsx(odsBytes, {
|
|
342
|
+
signal: options?.signal,
|
|
343
|
+
onDocument: options?.onDocument
|
|
344
|
+
});
|
|
345
|
+
}
|
|
324
346
|
var OdmUnresolvedSectionError = class extends Error {
|
|
325
347
|
hrefs;
|
|
326
348
|
constructor(hrefs) {
|
|
@@ -416,4 +438,4 @@ function odbToCsv(bytes, options) {
|
|
|
416
438
|
return buildOdbTableCsv(tables, options?.table);
|
|
417
439
|
}
|
|
418
440
|
//#endregion
|
|
419
|
-
export { OdmUnresolvedSectionError, docxToOdt, docxToPdf, inlineOdmSectionToContentSection, odbToCsv, odbToXlsx, odfToPdf, odgToPdf, odmToPdf, odpToPdf, odpToPptx, odsToPdf, odsToXlsx, odtToDocx, odtToPdf, pdfToDocx, pdfToOdg, pdfToOdp, pdfToOds, pdfToOdt, pdfToPptx, pptxToOdp, pptxToPdf, xlsxToOds };
|
|
441
|
+
export { OdmUnresolvedSectionError, docxToOdt, docxToPdf, inlineOdmSectionToContentSection, odbToCsv, odbToXlsx, odfToPdf, odgToPdf, odmToPdf, odpToPdf, odpToPptx, odsToPdf, odsToXlsx, odtToDocx, odtToPdf, pdfToDocx, pdfToOdg, pdfToOdp, pdfToOds, pdfToOdt, pdfToPptx, pdfToXlsx, pptxToOdp, pptxToPdf, xlsxToOds, xlsxToPdf };
|
package/dist/convert/local.cjs
CHANGED
|
@@ -1,84 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
2
|
+
const require_convert_capability = require("./capability.cjs");
|
|
3
3
|
//#region src/convert/local.ts
|
|
4
|
-
const SUPPORTED_CONVERSIONS =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
source: "pptx",
|
|
11
|
-
target: "pdf"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
source: "odt",
|
|
15
|
-
target: "pdf"
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
source: "odp",
|
|
19
|
-
target: "pdf"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
source: "ods",
|
|
23
|
-
target: "pdf"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
source: "odg",
|
|
27
|
-
target: "pdf"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
source: "odf",
|
|
31
|
-
target: "pdf"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
source: "pdf",
|
|
35
|
-
target: "docx"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
source: "pdf",
|
|
39
|
-
target: "pptx"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
source: "pdf",
|
|
43
|
-
target: "odt"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
source: "pdf",
|
|
47
|
-
target: "odp"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
source: "pdf",
|
|
51
|
-
target: "ods"
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
source: "pdf",
|
|
55
|
-
target: "odg"
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
source: "odt",
|
|
59
|
-
target: "docx"
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
source: "docx",
|
|
63
|
-
target: "odt"
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
source: "odp",
|
|
67
|
-
target: "pptx"
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
source: "pptx",
|
|
71
|
-
target: "odp"
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
source: "ods",
|
|
75
|
-
target: "xlsx"
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
source: "xlsx",
|
|
79
|
-
target: "ods"
|
|
80
|
-
}
|
|
81
|
-
];
|
|
4
|
+
const SUPPORTED_CONVERSIONS = require_convert_capability.DIRECT_EDGES.map((edge) => ({
|
|
5
|
+
source: edge.source,
|
|
6
|
+
target: edge.target
|
|
7
|
+
}));
|
|
82
8
|
function substitutionDiagnostic(substitution, context) {
|
|
83
9
|
return {
|
|
84
10
|
severity: "info",
|
|
@@ -106,286 +32,51 @@ function createLocalDocumentConverter() {
|
|
|
106
32
|
const onDocument = (pkg) => {
|
|
107
33
|
documentPackage = pkg;
|
|
108
34
|
};
|
|
109
|
-
|
|
110
|
-
|
|
35
|
+
const strategy = require_convert_capability.resolveConversionPath(source.format, targetFormat);
|
|
36
|
+
if (strategy?.kind !== "direct") return Promise.reject(/* @__PURE__ */ new Error(`unsupported conversion: ${source.format} -> ${targetFormat}`));
|
|
37
|
+
const edge = strategy.edge;
|
|
38
|
+
if (edge.kind === "toPdf") {
|
|
39
|
+
const bytes = edge.convert(source.bytes, {
|
|
111
40
|
signal: options.signal,
|
|
112
41
|
onSubstitution: (s, c) => diagnostics.push(substitutionDiagnostic(s, c)),
|
|
113
42
|
onDocument
|
|
114
43
|
});
|
|
115
44
|
return Promise.resolve({
|
|
116
45
|
document: {
|
|
117
|
-
format:
|
|
46
|
+
format: edge.target,
|
|
118
47
|
bytes
|
|
119
48
|
},
|
|
120
49
|
diagnostics,
|
|
121
50
|
package: documentPackage
|
|
122
51
|
});
|
|
123
52
|
}
|
|
124
|
-
if (
|
|
125
|
-
const bytes =
|
|
126
|
-
signal: options.signal,
|
|
127
|
-
onSubstitution: (s, c) => diagnostics.push(substitutionDiagnostic(s, c)),
|
|
128
|
-
onDocument
|
|
129
|
-
});
|
|
130
|
-
return Promise.resolve({
|
|
131
|
-
document: {
|
|
132
|
-
format: "pdf",
|
|
133
|
-
bytes
|
|
134
|
-
},
|
|
135
|
-
diagnostics,
|
|
136
|
-
package: documentPackage
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
if (source.format === "odt" && targetFormat === "pdf") {
|
|
140
|
-
const bytes = require_convert_convert.odtToPdf(source.bytes, {
|
|
141
|
-
signal: options.signal,
|
|
142
|
-
onSubstitution: (s, c) => diagnostics.push(substitutionDiagnostic(s, c)),
|
|
143
|
-
onDocument
|
|
144
|
-
});
|
|
145
|
-
return Promise.resolve({
|
|
146
|
-
document: {
|
|
147
|
-
format: "pdf",
|
|
148
|
-
bytes
|
|
149
|
-
},
|
|
150
|
-
diagnostics,
|
|
151
|
-
package: documentPackage
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
if (source.format === "odp" && targetFormat === "pdf") {
|
|
155
|
-
const bytes = require_convert_convert.odpToPdf(source.bytes, {
|
|
156
|
-
signal: options.signal,
|
|
157
|
-
onSubstitution: (s, c) => diagnostics.push(substitutionDiagnostic(s, c)),
|
|
158
|
-
onDocument
|
|
159
|
-
});
|
|
160
|
-
return Promise.resolve({
|
|
161
|
-
document: {
|
|
162
|
-
format: "pdf",
|
|
163
|
-
bytes
|
|
164
|
-
},
|
|
165
|
-
diagnostics,
|
|
166
|
-
package: documentPackage
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
if (source.format === "ods" && targetFormat === "pdf") {
|
|
170
|
-
const bytes = require_convert_convert.odsToPdf(source.bytes, {
|
|
171
|
-
signal: options.signal,
|
|
172
|
-
onSubstitution: (s, c) => diagnostics.push(substitutionDiagnostic(s, c)),
|
|
173
|
-
onDocument
|
|
174
|
-
});
|
|
175
|
-
return Promise.resolve({
|
|
176
|
-
document: {
|
|
177
|
-
format: "pdf",
|
|
178
|
-
bytes
|
|
179
|
-
},
|
|
180
|
-
diagnostics,
|
|
181
|
-
package: documentPackage
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
if (source.format === "odg" && targetFormat === "pdf") {
|
|
185
|
-
const bytes = require_convert_convert.odgToPdf(source.bytes, {
|
|
186
|
-
signal: options.signal,
|
|
187
|
-
onSubstitution: (s, c) => diagnostics.push(substitutionDiagnostic(s, c)),
|
|
188
|
-
onDocument
|
|
189
|
-
});
|
|
190
|
-
return Promise.resolve({
|
|
191
|
-
document: {
|
|
192
|
-
format: "pdf",
|
|
193
|
-
bytes
|
|
194
|
-
},
|
|
195
|
-
diagnostics,
|
|
196
|
-
package: documentPackage
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
if (source.format === "odf" && targetFormat === "pdf") {
|
|
200
|
-
const bytes = require_convert_convert.odfToPdf(source.bytes, {
|
|
201
|
-
signal: options.signal,
|
|
202
|
-
onSubstitution: (s, c) => diagnostics.push(substitutionDiagnostic(s, c)),
|
|
203
|
-
onDocument
|
|
204
|
-
});
|
|
205
|
-
return Promise.resolve({
|
|
206
|
-
document: {
|
|
207
|
-
format: "pdf",
|
|
208
|
-
bytes
|
|
209
|
-
},
|
|
210
|
-
diagnostics,
|
|
211
|
-
package: documentPackage
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
if (source.format === "pdf" && targetFormat === "docx") {
|
|
215
|
-
const bytes = require_convert_convert.pdfToDocx(source.bytes, {
|
|
216
|
-
signal: options.signal,
|
|
217
|
-
sink: (d) => diagnostics.push(fromPdfDiagnostic(d)),
|
|
218
|
-
onDocument
|
|
219
|
-
});
|
|
220
|
-
return Promise.resolve({
|
|
221
|
-
document: {
|
|
222
|
-
format: "docx",
|
|
223
|
-
bytes
|
|
224
|
-
},
|
|
225
|
-
diagnostics,
|
|
226
|
-
package: documentPackage
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
if (source.format === "pdf" && targetFormat === "pptx") {
|
|
230
|
-
const bytes = require_convert_convert.pdfToPptx(source.bytes, {
|
|
231
|
-
signal: options.signal,
|
|
232
|
-
sink: (d) => diagnostics.push(fromPdfDiagnostic(d)),
|
|
233
|
-
onDocument
|
|
234
|
-
});
|
|
235
|
-
return Promise.resolve({
|
|
236
|
-
document: {
|
|
237
|
-
format: "pptx",
|
|
238
|
-
bytes
|
|
239
|
-
},
|
|
240
|
-
diagnostics,
|
|
241
|
-
package: documentPackage
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
if (source.format === "pdf" && targetFormat === "odt") {
|
|
245
|
-
const bytes = require_convert_convert.pdfToOdt(source.bytes, {
|
|
246
|
-
signal: options.signal,
|
|
247
|
-
sink: (d) => diagnostics.push(fromPdfDiagnostic(d)),
|
|
248
|
-
onDocument
|
|
249
|
-
});
|
|
250
|
-
return Promise.resolve({
|
|
251
|
-
document: {
|
|
252
|
-
format: "odt",
|
|
253
|
-
bytes
|
|
254
|
-
},
|
|
255
|
-
diagnostics,
|
|
256
|
-
package: documentPackage
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
if (source.format === "pdf" && targetFormat === "odp") {
|
|
260
|
-
const bytes = require_convert_convert.pdfToOdp(source.bytes, {
|
|
261
|
-
signal: options.signal,
|
|
262
|
-
sink: (d) => diagnostics.push(fromPdfDiagnostic(d)),
|
|
263
|
-
onDocument
|
|
264
|
-
});
|
|
265
|
-
return Promise.resolve({
|
|
266
|
-
document: {
|
|
267
|
-
format: "odp",
|
|
268
|
-
bytes
|
|
269
|
-
},
|
|
270
|
-
diagnostics,
|
|
271
|
-
package: documentPackage
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
if (source.format === "pdf" && targetFormat === "ods") {
|
|
275
|
-
const bytes = require_convert_convert.pdfToOds(source.bytes, {
|
|
276
|
-
signal: options.signal,
|
|
277
|
-
sink: (d) => diagnostics.push(fromPdfDiagnostic(d)),
|
|
278
|
-
onDocument
|
|
279
|
-
});
|
|
280
|
-
return Promise.resolve({
|
|
281
|
-
document: {
|
|
282
|
-
format: "ods",
|
|
283
|
-
bytes
|
|
284
|
-
},
|
|
285
|
-
diagnostics,
|
|
286
|
-
package: documentPackage
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
if (source.format === "pdf" && targetFormat === "odg") {
|
|
290
|
-
const bytes = require_convert_convert.pdfToOdg(source.bytes, {
|
|
53
|
+
if (edge.kind === "fromPdf") {
|
|
54
|
+
const bytes = edge.convert(source.bytes, {
|
|
291
55
|
signal: options.signal,
|
|
292
56
|
sink: (d) => diagnostics.push(fromPdfDiagnostic(d)),
|
|
293
57
|
onDocument
|
|
294
58
|
});
|
|
295
59
|
return Promise.resolve({
|
|
296
60
|
document: {
|
|
297
|
-
format:
|
|
298
|
-
bytes
|
|
299
|
-
},
|
|
300
|
-
diagnostics,
|
|
301
|
-
package: documentPackage
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
if (source.format === "odt" && targetFormat === "docx") {
|
|
305
|
-
const bytes = require_convert_convert.odtToDocx(source.bytes, {
|
|
306
|
-
signal: options.signal,
|
|
307
|
-
onDocument
|
|
308
|
-
});
|
|
309
|
-
return Promise.resolve({
|
|
310
|
-
document: {
|
|
311
|
-
format: "docx",
|
|
312
|
-
bytes
|
|
313
|
-
},
|
|
314
|
-
diagnostics,
|
|
315
|
-
package: documentPackage
|
|
316
|
-
});
|
|
317
|
-
}
|
|
318
|
-
if (source.format === "docx" && targetFormat === "odt") {
|
|
319
|
-
const bytes = require_convert_convert.docxToOdt(source.bytes, {
|
|
320
|
-
signal: options.signal,
|
|
321
|
-
onDocument
|
|
322
|
-
});
|
|
323
|
-
return Promise.resolve({
|
|
324
|
-
document: {
|
|
325
|
-
format: "odt",
|
|
326
|
-
bytes
|
|
327
|
-
},
|
|
328
|
-
diagnostics,
|
|
329
|
-
package: documentPackage
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
if (source.format === "odp" && targetFormat === "pptx") {
|
|
333
|
-
const bytes = require_convert_convert.odpToPptx(source.bytes, {
|
|
334
|
-
signal: options.signal,
|
|
335
|
-
onDocument
|
|
336
|
-
});
|
|
337
|
-
return Promise.resolve({
|
|
338
|
-
document: {
|
|
339
|
-
format: "pptx",
|
|
340
|
-
bytes
|
|
341
|
-
},
|
|
342
|
-
diagnostics,
|
|
343
|
-
package: documentPackage
|
|
344
|
-
});
|
|
345
|
-
}
|
|
346
|
-
if (source.format === "pptx" && targetFormat === "odp") {
|
|
347
|
-
const bytes = require_convert_convert.pptxToOdp(source.bytes, {
|
|
348
|
-
signal: options.signal,
|
|
349
|
-
onDocument
|
|
350
|
-
});
|
|
351
|
-
return Promise.resolve({
|
|
352
|
-
document: {
|
|
353
|
-
format: "odp",
|
|
354
|
-
bytes
|
|
355
|
-
},
|
|
356
|
-
diagnostics,
|
|
357
|
-
package: documentPackage
|
|
358
|
-
});
|
|
359
|
-
}
|
|
360
|
-
if (source.format === "ods" && targetFormat === "xlsx") {
|
|
361
|
-
const bytes = require_convert_convert.odsToXlsx(source.bytes, {
|
|
362
|
-
signal: options.signal,
|
|
363
|
-
onDocument
|
|
364
|
-
});
|
|
365
|
-
return Promise.resolve({
|
|
366
|
-
document: {
|
|
367
|
-
format: "xlsx",
|
|
368
|
-
bytes
|
|
369
|
-
},
|
|
370
|
-
diagnostics,
|
|
371
|
-
package: documentPackage
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
if (source.format === "xlsx" && targetFormat === "ods") {
|
|
375
|
-
const bytes = require_convert_convert.xlsxToOds(source.bytes, {
|
|
376
|
-
signal: options.signal,
|
|
377
|
-
onDocument
|
|
378
|
-
});
|
|
379
|
-
return Promise.resolve({
|
|
380
|
-
document: {
|
|
381
|
-
format: "ods",
|
|
61
|
+
format: edge.target,
|
|
382
62
|
bytes
|
|
383
63
|
},
|
|
384
64
|
diagnostics,
|
|
385
65
|
package: documentPackage
|
|
386
66
|
});
|
|
387
67
|
}
|
|
388
|
-
|
|
68
|
+
const bytes = edge.convert(source.bytes, {
|
|
69
|
+
signal: options.signal,
|
|
70
|
+
onDocument
|
|
71
|
+
});
|
|
72
|
+
return Promise.resolve({
|
|
73
|
+
document: {
|
|
74
|
+
format: edge.target,
|
|
75
|
+
bytes
|
|
76
|
+
},
|
|
77
|
+
diagnostics,
|
|
78
|
+
package: documentPackage
|
|
79
|
+
});
|
|
389
80
|
}
|
|
390
81
|
};
|
|
391
82
|
}
|