js.documents 4.0.19 → 4.4.5
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 +43 -29
- package/dist/cell-typing-CEWlywIc.d.cts +22 -0
- package/dist/cell-typing-CEWlywIc.d.ts +22 -0
- package/dist/codecs/read.cjs +66 -0
- package/dist/codecs/read.d.cts +15 -0
- package/dist/codecs/read.d.ts +15 -0
- package/dist/codecs/read.js +64 -0
- package/dist/codecs/registry.cjs +13 -59
- package/dist/codecs/registry.d.cts +2 -8
- package/dist/codecs/registry.d.ts +2 -8
- package/dist/codecs/registry.js +20 -64
- package/dist/convert/codec.cjs +11 -10
- package/dist/convert/codec.js +2 -1
- package/dist/convert/composition-to-pdf.cjs +133 -0
- package/dist/convert/composition-to-pdf.d.cts +7 -0
- package/dist/convert/composition-to-pdf.d.ts +7 -0
- package/dist/convert/composition-to-pdf.js +131 -0
- package/dist/convert/composition.cjs +31 -129
- package/dist/convert/composition.d.cts +14 -4
- package/dist/convert/composition.d.ts +14 -4
- package/dist/convert/composition.js +25 -128
- package/dist/convert/convert.cjs +35 -75
- package/dist/convert/convert.d.cts +5 -20
- package/dist/convert/convert.d.ts +5 -20
- package/dist/convert/convert.js +2 -32
- package/dist/convert/from-package.cjs +2 -1
- package/dist/convert/from-package.js +2 -1
- package/dist/convert/from-pdf.cjs +50 -0
- package/dist/convert/from-pdf.d.cts +26 -0
- package/dist/convert/from-pdf.d.ts +26 -0
- package/dist/convert/from-pdf.js +39 -0
- package/dist/convert/local.cjs +2 -1
- package/dist/convert/local.js +2 -1
- package/dist/convert/pdf-package-tables.cjs +76 -0
- package/dist/convert/pdf-package-tables.d.cts +6 -0
- package/dist/convert/pdf-package-tables.d.ts +6 -0
- package/dist/convert/pdf-package-tables.js +75 -0
- package/dist/csv/read.d.cts +1 -1
- package/dist/csv/read.d.ts +1 -1
- package/dist/diagnostics-DVAXKgcf.d.cts +10 -0
- package/dist/diagnostics-DVAXKgcf.d.ts +10 -0
- package/dist/edit/docx/content.cjs +1 -0
- package/dist/edit/docx/content.js +1 -0
- package/dist/edit/docx/paragraph.cjs +18 -1
- package/dist/edit/docx/paragraph.d.cts +3 -0
- package/dist/edit/docx/paragraph.d.ts +3 -0
- package/dist/edit/docx/paragraph.js +18 -1
- package/dist/edit/docx/props.cjs +1 -0
- package/dist/edit/docx/props.js +1 -0
- package/dist/edit/markdown/editor.cjs +1 -1
- package/dist/edit/markdown/editor.js +1 -1
- package/dist/edit/pdf/item.cjs +42 -1
- package/dist/edit/pdf/item.d.cts +2 -2
- package/dist/edit/pdf/item.d.ts +2 -2
- package/dist/edit/pdf/item.js +42 -2
- package/dist/edit/pdf/page.d.cts +1 -1
- package/dist/edit/pdf/page.d.ts +1 -1
- package/dist/fonts/registry.d.cts +1 -19
- package/dist/fonts/registry.d.ts +1 -19
- 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 +1 -24
- package/dist/hsqldb/rowformat.d.ts +1 -24
- package/dist/index.cjs +17 -16
- package/dist/index.d.cts +11 -10
- package/dist/index.d.ts +11 -10
- package/dist/index.js +8 -7
- package/dist/{item-D9vQKT0T.d.cts → item-DhXpJNAQ.d.cts} +17 -3
- package/dist/{item-D9vQKT0T.d.ts → item-DhXpJNAQ.d.ts} +17 -3
- package/dist/layout/cell-typing.d.cts +1 -21
- package/dist/layout/cell-typing.d.ts +1 -21
- package/dist/layout/reconstruct.cjs +177 -14
- package/dist/layout/reconstruct.d.cts +1 -1
- package/dist/layout/reconstruct.d.ts +1 -1
- package/dist/layout/reconstruct.js +175 -12
- package/dist/layout/shared.cjs +2 -2
- package/dist/layout/shared.js +1 -1
- package/dist/markdown/math.cjs +5 -7
- package/dist/markdown/math.js +5 -7
- package/dist/markdown/read.cjs +15 -1
- package/dist/markdown/read.js +16 -2
- package/dist/markdown/write.cjs +7 -10
- package/dist/markdown/write.d.cts +3 -6
- package/dist/markdown/write.d.ts +3 -6
- package/dist/markdown/write.js +8 -11
- package/dist/metadata/write.cjs +2 -1
- package/dist/metadata/write.js +2 -1
- package/dist/model/bytes.cjs +8 -0
- package/dist/model/bytes.d.cts +2 -1
- package/dist/model/bytes.d.ts +2 -1
- package/dist/model/bytes.js +8 -1
- 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/dist/odf/odt/read.cjs +1 -1
- package/dist/odf/odt/read.js +1 -1
- package/dist/registry-BcBT-bnX.d.cts +20 -0
- package/dist/registry-D1Pu5XxB.d.ts +20 -0
- package/dist/rowformat-Cl2exlEh.d.cts +25 -0
- package/dist/rowformat-Cl2exlEh.d.ts +25 -0
- package/dist/svg/diagnostics.d.cts +1 -9
- package/dist/svg/diagnostics.d.ts +1 -9
- package/dist/svg/read.d.cts +1 -1
- package/dist/svg/read.d.ts +1 -1
- package/dist/svg/write.d.cts +1 -1
- package/dist/svg/write.d.ts +1 -1
- package/package.json +27 -10
- package/dist/metadata/read.cjs +0 -15
- package/dist/metadata/read.d.cts +0 -9
- package/dist/metadata/read.d.ts +0 -9
- package/dist/metadata/read.js +0 -14
package/dist/convert/convert.cjs
CHANGED
|
@@ -12,7 +12,7 @@ const require_ports_abort = require("../ports/abort.cjs");
|
|
|
12
12
|
const require_odb_csv = require("../odb/csv.cjs");
|
|
13
13
|
const require_odb_read = require("../odb/read.cjs");
|
|
14
14
|
const require_odb_spreadsheet = require("../odb/spreadsheet.cjs");
|
|
15
|
-
const
|
|
15
|
+
const require_convert_composition_to_pdf = require("./composition-to-pdf.cjs");
|
|
16
16
|
let ooxml_js = require("ooxml.js");
|
|
17
17
|
let document_schema_js = require("document-schema.js");
|
|
18
18
|
let pdf_codec = require("pdf-codec");
|
|
@@ -20,31 +20,31 @@ let odf_js = require("odf.js");
|
|
|
20
20
|
//#region src/convert/convert.ts
|
|
21
21
|
const mathMetricsAt = (sizePt) => (0, pdf_codec.loadMathFont)().metricsAt(sizePt);
|
|
22
22
|
function docxToPdf(bytes, options) {
|
|
23
|
-
return
|
|
23
|
+
return require_convert_composition_to_pdf.convertDocument("docx", "pdf", bytes, options);
|
|
24
24
|
}
|
|
25
25
|
function odtToPdf(bytes, options) {
|
|
26
|
-
return
|
|
26
|
+
return require_convert_composition_to_pdf.convertDocument("odt", "pdf", bytes, options);
|
|
27
27
|
}
|
|
28
28
|
function pptxToPdf(bytes, options) {
|
|
29
|
-
return
|
|
29
|
+
return require_convert_composition_to_pdf.convertDocument("pptx", "pdf", bytes, options);
|
|
30
30
|
}
|
|
31
31
|
function odpToPdf(bytes, options) {
|
|
32
|
-
return
|
|
32
|
+
return require_convert_composition_to_pdf.convertDocument("odp", "pdf", bytes, options);
|
|
33
33
|
}
|
|
34
34
|
function odsToPdf(bytes, options) {
|
|
35
|
-
return
|
|
35
|
+
return require_convert_composition_to_pdf.convertDocument("ods", "pdf", bytes, options);
|
|
36
36
|
}
|
|
37
37
|
function odgToPdf(bytes, options) {
|
|
38
|
-
return
|
|
38
|
+
return require_convert_composition_to_pdf.convertDocument("odg", "pdf", bytes, options);
|
|
39
39
|
}
|
|
40
40
|
function markdownToPdf(bytes, options) {
|
|
41
|
-
return
|
|
41
|
+
return require_convert_composition_to_pdf.convertDocument("markdown", "pdf", bytes, options);
|
|
42
42
|
}
|
|
43
43
|
function csvToPdf(bytes, options) {
|
|
44
|
-
return
|
|
44
|
+
return require_convert_composition_to_pdf.convertDocument("csv", "pdf", bytes, options);
|
|
45
45
|
}
|
|
46
46
|
function svgToPdf(bytes, options) {
|
|
47
|
-
return
|
|
47
|
+
return require_convert_composition_to_pdf.convertDocument("svg", "pdf", bytes, options);
|
|
48
48
|
}
|
|
49
49
|
const STANDALONE_FORMULA_SIZE_PT = 18;
|
|
50
50
|
const STANDALONE_FORMULA_MARGIN_PT = 72;
|
|
@@ -95,110 +95,80 @@ function odfToPdf(bytes, options) {
|
|
|
95
95
|
}]));
|
|
96
96
|
return out;
|
|
97
97
|
}
|
|
98
|
-
function pdfToDocx(bytes, options) {
|
|
99
|
-
return require_convert_composition.convertDocument("pdf", "docx", bytes, options);
|
|
100
|
-
}
|
|
101
|
-
function pdfToPptx(bytes, options) {
|
|
102
|
-
return require_convert_composition.convertDocument("pdf", "pptx", bytes, options);
|
|
103
|
-
}
|
|
104
|
-
function pdfToOdt(bytes, options) {
|
|
105
|
-
return require_convert_composition.convertDocument("pdf", "odt", bytes, options);
|
|
106
|
-
}
|
|
107
|
-
function pdfToOdp(bytes, options) {
|
|
108
|
-
return require_convert_composition.convertDocument("pdf", "odp", bytes, options);
|
|
109
|
-
}
|
|
110
|
-
function pdfToOdg(bytes, options) {
|
|
111
|
-
return require_convert_composition.convertDocument("pdf", "odg", bytes, options);
|
|
112
|
-
}
|
|
113
|
-
function pdfToOds(bytes, options) {
|
|
114
|
-
return require_convert_composition.convertDocument("pdf", "ods", bytes, options);
|
|
115
|
-
}
|
|
116
|
-
function pdfToMarkdown(bytes, options) {
|
|
117
|
-
return require_convert_composition.convertDocument("pdf", "markdown", bytes, options);
|
|
118
|
-
}
|
|
119
|
-
function pdfToCsv(bytes, options) {
|
|
120
|
-
return require_convert_composition.convertDocument("pdf", "csv", bytes, options);
|
|
121
|
-
}
|
|
122
|
-
function pdfToSvg(bytes, options) {
|
|
123
|
-
return require_convert_composition.convertDocument("pdf", "svg", bytes, options);
|
|
124
|
-
}
|
|
125
98
|
function odtToDocx(bytes, options) {
|
|
126
|
-
return
|
|
99
|
+
return require_convert_composition_to_pdf.convertDocument("odt", "docx", bytes, options);
|
|
127
100
|
}
|
|
128
101
|
function docxToOdt(bytes, options) {
|
|
129
|
-
return
|
|
102
|
+
return require_convert_composition_to_pdf.convertDocument("docx", "odt", bytes, options);
|
|
130
103
|
}
|
|
131
104
|
function odpToPptx(bytes, options) {
|
|
132
|
-
return
|
|
105
|
+
return require_convert_composition_to_pdf.convertDocument("odp", "pptx", bytes, options);
|
|
133
106
|
}
|
|
134
107
|
function pptxToOdp(bytes, options) {
|
|
135
|
-
return
|
|
108
|
+
return require_convert_composition_to_pdf.convertDocument("pptx", "odp", bytes, options);
|
|
136
109
|
}
|
|
137
110
|
function odsToXlsx(bytes, options) {
|
|
138
|
-
return
|
|
111
|
+
return require_convert_composition_to_pdf.convertDocument("ods", "xlsx", bytes, options);
|
|
139
112
|
}
|
|
140
113
|
function xlsxToOds(bytes, options) {
|
|
141
|
-
return
|
|
114
|
+
return require_convert_composition_to_pdf.convertDocument("xlsx", "ods", bytes, options);
|
|
142
115
|
}
|
|
143
116
|
function markdownToDocx(bytes, options) {
|
|
144
|
-
return
|
|
117
|
+
return require_convert_composition_to_pdf.convertDocument("markdown", "docx", bytes, options);
|
|
145
118
|
}
|
|
146
119
|
function docxToMarkdown(bytes, options) {
|
|
147
|
-
return
|
|
120
|
+
return require_convert_composition_to_pdf.convertDocument("docx", "markdown", bytes, options);
|
|
148
121
|
}
|
|
149
122
|
function markdownToOdt(bytes, options) {
|
|
150
|
-
return
|
|
123
|
+
return require_convert_composition_to_pdf.convertDocument("markdown", "odt", bytes, options);
|
|
151
124
|
}
|
|
152
125
|
function odtToMarkdown(bytes, options) {
|
|
153
|
-
return
|
|
126
|
+
return require_convert_composition_to_pdf.convertDocument("odt", "markdown", bytes, options);
|
|
154
127
|
}
|
|
155
128
|
function csvToXlsx(bytes, options) {
|
|
156
|
-
return
|
|
129
|
+
return require_convert_composition_to_pdf.convertDocument("csv", "xlsx", bytes, options);
|
|
157
130
|
}
|
|
158
131
|
function xlsxToCsv(bytes, options) {
|
|
159
|
-
return
|
|
132
|
+
return require_convert_composition_to_pdf.convertDocument("xlsx", "csv", bytes, options);
|
|
160
133
|
}
|
|
161
134
|
function csvToOds(bytes, options) {
|
|
162
|
-
return
|
|
135
|
+
return require_convert_composition_to_pdf.convertDocument("csv", "ods", bytes, options);
|
|
163
136
|
}
|
|
164
137
|
function odsToCsv(bytes, options) {
|
|
165
|
-
return
|
|
138
|
+
return require_convert_composition_to_pdf.convertDocument("ods", "csv", bytes, options);
|
|
166
139
|
}
|
|
167
140
|
function svgToOdg(bytes, options) {
|
|
168
|
-
return
|
|
141
|
+
return require_convert_composition_to_pdf.convertDocument("svg", "odg", bytes, options);
|
|
169
142
|
}
|
|
170
143
|
function odgToSvg(bytes, options) {
|
|
171
|
-
return
|
|
144
|
+
return require_convert_composition_to_pdf.convertDocument("odg", "svg", bytes, options);
|
|
172
145
|
}
|
|
173
146
|
function docxToPptx(bytes, options) {
|
|
174
|
-
return
|
|
147
|
+
return require_convert_composition_to_pdf.convertDocument("docx", "pptx", bytes, options);
|
|
175
148
|
}
|
|
176
149
|
function pptxToDocx(bytes, options) {
|
|
177
|
-
return
|
|
150
|
+
return require_convert_composition_to_pdf.convertDocument("pptx", "docx", bytes, options);
|
|
178
151
|
}
|
|
179
152
|
function odtToOdp(bytes, options) {
|
|
180
|
-
return
|
|
153
|
+
return require_convert_composition_to_pdf.convertDocument("odt", "odp", bytes, options);
|
|
181
154
|
}
|
|
182
155
|
function odpToOdt(bytes, options) {
|
|
183
|
-
return
|
|
156
|
+
return require_convert_composition_to_pdf.convertDocument("odp", "odt", bytes, options);
|
|
184
157
|
}
|
|
185
158
|
function xlsxToPdf(bytes, options) {
|
|
186
|
-
return
|
|
187
|
-
}
|
|
188
|
-
function pdfToXlsx(bytes, options) {
|
|
189
|
-
return require_convert_composition.convertDocument("pdf", "xlsx", bytes, options);
|
|
159
|
+
return require_convert_composition_to_pdf.convertDocument("xlsx", "pdf", bytes, options);
|
|
190
160
|
}
|
|
191
161
|
function xlsxToMarkdown(bytes, options) {
|
|
192
|
-
return
|
|
162
|
+
return require_convert_composition_to_pdf.convertDocument("xlsx", "markdown", bytes, options);
|
|
193
163
|
}
|
|
194
164
|
function markdownToXlsx(bytes, options) {
|
|
195
|
-
return
|
|
165
|
+
return require_convert_composition_to_pdf.convertDocument("markdown", "xlsx", bytes, options);
|
|
196
166
|
}
|
|
197
167
|
function csvToMarkdown(bytes, options) {
|
|
198
|
-
return
|
|
168
|
+
return require_convert_composition_to_pdf.convertDocument("csv", "markdown", bytes, options);
|
|
199
169
|
}
|
|
200
170
|
function markdownToCsv(bytes, options) {
|
|
201
|
-
return
|
|
171
|
+
return require_convert_composition_to_pdf.convertDocument("markdown", "csv", bytes, options);
|
|
202
172
|
}
|
|
203
173
|
var OdmUnresolvedSectionError = class extends Error {
|
|
204
174
|
hrefs;
|
|
@@ -378,16 +348,6 @@ exports.odtToDocx = odtToDocx;
|
|
|
378
348
|
exports.odtToMarkdown = odtToMarkdown;
|
|
379
349
|
exports.odtToOdp = odtToOdp;
|
|
380
350
|
exports.odtToPdf = odtToPdf;
|
|
381
|
-
exports.pdfToCsv = pdfToCsv;
|
|
382
|
-
exports.pdfToDocx = pdfToDocx;
|
|
383
|
-
exports.pdfToMarkdown = pdfToMarkdown;
|
|
384
|
-
exports.pdfToOdg = pdfToOdg;
|
|
385
|
-
exports.pdfToOdp = pdfToOdp;
|
|
386
|
-
exports.pdfToOds = pdfToOds;
|
|
387
|
-
exports.pdfToOdt = pdfToOdt;
|
|
388
|
-
exports.pdfToPptx = pdfToPptx;
|
|
389
|
-
exports.pdfToSvg = pdfToSvg;
|
|
390
|
-
exports.pdfToXlsx = pdfToXlsx;
|
|
391
351
|
exports.pptxToDocx = pptxToDocx;
|
|
392
352
|
exports.pptxToOdp = pptxToOdp;
|
|
393
353
|
exports.pptxToPdf = pptxToPdf;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as ClockPort } from "../clock-C7SUuYN0.cjs";
|
|
2
|
-
import { SvgDiagnosticSink } from "../
|
|
3
|
-
import { CellTypeInferenceSink } from "../
|
|
2
|
+
import { i as SvgDiagnosticSink } from "../diagnostics-DVAXKgcf.cjs";
|
|
3
|
+
import { i as CellTypeInferenceSink } from "../cell-typing-CEWlywIc.cjs";
|
|
4
4
|
import { t as OmmlDiagnostic } from "../shared-DLZ3IQUl.cjs";
|
|
5
|
-
import { HsqldbDecodeOptions } from "../
|
|
6
|
-
import { DocumentFontRegistryOptions } from "../
|
|
5
|
+
import { n as HsqldbDecodeOptions } from "../rowformat-Cl2exlEh.cjs";
|
|
6
|
+
import { t as DocumentFontRegistryOptions } from "../registry-BcBT-bnX.cjs";
|
|
7
7
|
import { ContentDocument, ContentSection, DocumentPackage } from "document-schema.js";
|
|
8
8
|
import { PdfDiagnosticSink, WinAnsiSubstitution } from "pdf-codec";
|
|
9
9
|
import { MarkdownImageResolver } from "markdown-codec";
|
|
@@ -46,20 +46,6 @@ interface SvgWriteOptions {
|
|
|
46
46
|
declare function csvToPdf(bytes: Uint8Array<ArrayBuffer>, options?: DocumentToPdfOptions & CsvReadOptions): Uint8Array<ArrayBuffer>;
|
|
47
47
|
declare function svgToPdf(bytes: Uint8Array<ArrayBuffer>, options?: DocumentToPdfOptions & SvgReadOptions): Uint8Array<ArrayBuffer>;
|
|
48
48
|
declare function odfToPdf(bytes: Uint8Array<ArrayBuffer>, options?: DocumentToPdfOptions): Uint8Array<ArrayBuffer>;
|
|
49
|
-
interface PdfToDocumentOptions {
|
|
50
|
-
readonly signal?: AbortSignal;
|
|
51
|
-
readonly sink?: PdfDiagnosticSink;
|
|
52
|
-
readonly onDocument?: (pkg: DocumentPackage) => void;
|
|
53
|
-
}
|
|
54
|
-
declare function pdfToDocx(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
55
|
-
declare function pdfToPptx(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
56
|
-
declare function pdfToOdt(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
57
|
-
declare function pdfToOdp(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
58
|
-
declare function pdfToOdg(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
59
|
-
declare function pdfToOds(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
60
|
-
declare function pdfToMarkdown(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
61
|
-
declare function pdfToCsv(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions & CsvWriteOptions): Uint8Array<ArrayBuffer>;
|
|
62
|
-
declare function pdfToSvg(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions & SvgWriteOptions): Uint8Array<ArrayBuffer>;
|
|
63
49
|
interface DocumentBridgeOptions {
|
|
64
50
|
readonly signal?: AbortSignal;
|
|
65
51
|
readonly onDocument?: (pkg: DocumentPackage) => void;
|
|
@@ -99,7 +85,6 @@ declare function pptxToDocx(bytes: Uint8Array<ArrayBuffer>, options?: DocumentBr
|
|
|
99
85
|
declare function odtToOdp(bytes: Uint8Array<ArrayBuffer>, options?: DocumentBridgeOptions): Uint8Array<ArrayBuffer>;
|
|
100
86
|
declare function odpToOdt(bytes: Uint8Array<ArrayBuffer>, options?: DocumentBridgeOptions): Uint8Array<ArrayBuffer>;
|
|
101
87
|
declare function xlsxToPdf(bytes: Uint8Array<ArrayBuffer>, options?: DocumentToPdfOptions): Uint8Array<ArrayBuffer>;
|
|
102
|
-
declare function pdfToXlsx(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
103
88
|
declare function xlsxToMarkdown(bytes: Uint8Array<ArrayBuffer>, options?: ComposedDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
104
89
|
declare function markdownToXlsx(bytes: Uint8Array<ArrayBuffer>, options?: ComposedDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
105
90
|
declare function csvToMarkdown(bytes: Uint8Array<ArrayBuffer>, options?: ComposedDocumentOptions & CsvReadOptions): Uint8Array<ArrayBuffer>;
|
|
@@ -132,4 +117,4 @@ interface OdbReportToOdtOptions {
|
|
|
132
117
|
declare function odbReportToOdt(content: ContentDocument, options?: OdbReportToOdtOptions): Uint8Array<ArrayBuffer>;
|
|
133
118
|
declare function odbReportToPdf(content: ContentDocument, options?: DocumentToPdfOptions): Uint8Array<ArrayBuffer>;
|
|
134
119
|
//#endregion
|
|
135
|
-
export { ComposedDocumentOptions, CsvReadOptions, CsvWriteOptions, DocumentBridgeOptions, DocumentToPdfOptions, OdbConversionOptions, OdbReportToDocxOptions, OdbReportToOdtOptions, OdbToCsvOptions, OdmToPdfOptions, OdmUnresolvedSectionError,
|
|
120
|
+
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, svgToOdg, svgToPdf, xlsxToCsv, xlsxToMarkdown, xlsxToOds, xlsxToPdf };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as ClockPort } from "../clock-C7SUuYN0.js";
|
|
2
|
-
import { SvgDiagnosticSink } from "../
|
|
3
|
-
import { CellTypeInferenceSink } from "../
|
|
2
|
+
import { i as SvgDiagnosticSink } from "../diagnostics-DVAXKgcf.js";
|
|
3
|
+
import { i as CellTypeInferenceSink } from "../cell-typing-CEWlywIc.js";
|
|
4
4
|
import { t as OmmlDiagnostic } from "../shared-DUOzjwcL.js";
|
|
5
|
-
import { HsqldbDecodeOptions } from "../
|
|
6
|
-
import { DocumentFontRegistryOptions } from "../
|
|
5
|
+
import { n as HsqldbDecodeOptions } from "../rowformat-Cl2exlEh.js";
|
|
6
|
+
import { t as DocumentFontRegistryOptions } from "../registry-D1Pu5XxB.js";
|
|
7
7
|
import { ContentDocument, ContentSection, DocumentPackage } from "document-schema.js";
|
|
8
8
|
import { PdfDiagnosticSink, WinAnsiSubstitution } from "pdf-codec";
|
|
9
9
|
import { OdmSection, Package } from "odf.js";
|
|
@@ -46,20 +46,6 @@ interface SvgWriteOptions {
|
|
|
46
46
|
declare function csvToPdf(bytes: Uint8Array<ArrayBuffer>, options?: DocumentToPdfOptions & CsvReadOptions): Uint8Array<ArrayBuffer>;
|
|
47
47
|
declare function svgToPdf(bytes: Uint8Array<ArrayBuffer>, options?: DocumentToPdfOptions & SvgReadOptions): Uint8Array<ArrayBuffer>;
|
|
48
48
|
declare function odfToPdf(bytes: Uint8Array<ArrayBuffer>, options?: DocumentToPdfOptions): Uint8Array<ArrayBuffer>;
|
|
49
|
-
interface PdfToDocumentOptions {
|
|
50
|
-
readonly signal?: AbortSignal;
|
|
51
|
-
readonly sink?: PdfDiagnosticSink;
|
|
52
|
-
readonly onDocument?: (pkg: DocumentPackage) => void;
|
|
53
|
-
}
|
|
54
|
-
declare function pdfToDocx(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
55
|
-
declare function pdfToPptx(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
56
|
-
declare function pdfToOdt(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
57
|
-
declare function pdfToOdp(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
58
|
-
declare function pdfToOdg(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
59
|
-
declare function pdfToOds(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
60
|
-
declare function pdfToMarkdown(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
61
|
-
declare function pdfToCsv(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions & CsvWriteOptions): Uint8Array<ArrayBuffer>;
|
|
62
|
-
declare function pdfToSvg(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions & SvgWriteOptions): Uint8Array<ArrayBuffer>;
|
|
63
49
|
interface DocumentBridgeOptions {
|
|
64
50
|
readonly signal?: AbortSignal;
|
|
65
51
|
readonly onDocument?: (pkg: DocumentPackage) => void;
|
|
@@ -99,7 +85,6 @@ declare function pptxToDocx(bytes: Uint8Array<ArrayBuffer>, options?: DocumentBr
|
|
|
99
85
|
declare function odtToOdp(bytes: Uint8Array<ArrayBuffer>, options?: DocumentBridgeOptions): Uint8Array<ArrayBuffer>;
|
|
100
86
|
declare function odpToOdt(bytes: Uint8Array<ArrayBuffer>, options?: DocumentBridgeOptions): Uint8Array<ArrayBuffer>;
|
|
101
87
|
declare function xlsxToPdf(bytes: Uint8Array<ArrayBuffer>, options?: DocumentToPdfOptions): Uint8Array<ArrayBuffer>;
|
|
102
|
-
declare function pdfToXlsx(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
103
88
|
declare function xlsxToMarkdown(bytes: Uint8Array<ArrayBuffer>, options?: ComposedDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
104
89
|
declare function markdownToXlsx(bytes: Uint8Array<ArrayBuffer>, options?: ComposedDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
105
90
|
declare function csvToMarkdown(bytes: Uint8Array<ArrayBuffer>, options?: ComposedDocumentOptions & CsvReadOptions): Uint8Array<ArrayBuffer>;
|
|
@@ -132,4 +117,4 @@ interface OdbReportToOdtOptions {
|
|
|
132
117
|
declare function odbReportToOdt(content: ContentDocument, options?: OdbReportToOdtOptions): Uint8Array<ArrayBuffer>;
|
|
133
118
|
declare function odbReportToPdf(content: ContentDocument, options?: DocumentToPdfOptions): Uint8Array<ArrayBuffer>;
|
|
134
119
|
//#endregion
|
|
135
|
-
export { ComposedDocumentOptions, CsvReadOptions, CsvWriteOptions, DocumentBridgeOptions, DocumentToPdfOptions, OdbConversionOptions, OdbReportToDocxOptions, OdbReportToOdtOptions, OdbToCsvOptions, OdmToPdfOptions, OdmUnresolvedSectionError,
|
|
120
|
+
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, svgToOdg, svgToPdf, xlsxToCsv, xlsxToMarkdown, xlsxToOds, xlsxToPdf };
|
package/dist/convert/convert.js
CHANGED
|
@@ -11,7 +11,7 @@ import { throwIfAborted } from "../ports/abort.js";
|
|
|
11
11
|
import { buildOdbTableCsv } from "../odb/csv.js";
|
|
12
12
|
import { readOdbTables } from "../odb/read.js";
|
|
13
13
|
import { odbTablesToSpreadsheetDocument } from "../odb/spreadsheet.js";
|
|
14
|
-
import { convertDocument } from "./composition.js";
|
|
14
|
+
import { convertDocument } from "./composition-to-pdf.js";
|
|
15
15
|
import { buildXlsxPackageFromContent, encodePackage } from "ooxml.js";
|
|
16
16
|
import { COLOR_BLACK, PAGE_SIZE_A4, assemblePackage } from "document-schema.js";
|
|
17
17
|
import { LAYOUT_FORMAT_VERSION, createFontMeasurer, createFontRegistry, loadMathFont, writePdf } from "pdf-codec";
|
|
@@ -94,33 +94,6 @@ function odfToPdf(bytes, options) {
|
|
|
94
94
|
}]));
|
|
95
95
|
return out;
|
|
96
96
|
}
|
|
97
|
-
function pdfToDocx(bytes, options) {
|
|
98
|
-
return convertDocument("pdf", "docx", bytes, options);
|
|
99
|
-
}
|
|
100
|
-
function pdfToPptx(bytes, options) {
|
|
101
|
-
return convertDocument("pdf", "pptx", bytes, options);
|
|
102
|
-
}
|
|
103
|
-
function pdfToOdt(bytes, options) {
|
|
104
|
-
return convertDocument("pdf", "odt", bytes, options);
|
|
105
|
-
}
|
|
106
|
-
function pdfToOdp(bytes, options) {
|
|
107
|
-
return convertDocument("pdf", "odp", bytes, options);
|
|
108
|
-
}
|
|
109
|
-
function pdfToOdg(bytes, options) {
|
|
110
|
-
return convertDocument("pdf", "odg", bytes, options);
|
|
111
|
-
}
|
|
112
|
-
function pdfToOds(bytes, options) {
|
|
113
|
-
return convertDocument("pdf", "ods", bytes, options);
|
|
114
|
-
}
|
|
115
|
-
function pdfToMarkdown(bytes, options) {
|
|
116
|
-
return convertDocument("pdf", "markdown", bytes, options);
|
|
117
|
-
}
|
|
118
|
-
function pdfToCsv(bytes, options) {
|
|
119
|
-
return convertDocument("pdf", "csv", bytes, options);
|
|
120
|
-
}
|
|
121
|
-
function pdfToSvg(bytes, options) {
|
|
122
|
-
return convertDocument("pdf", "svg", bytes, options);
|
|
123
|
-
}
|
|
124
97
|
function odtToDocx(bytes, options) {
|
|
125
98
|
return convertDocument("odt", "docx", bytes, options);
|
|
126
99
|
}
|
|
@@ -184,9 +157,6 @@ function odpToOdt(bytes, options) {
|
|
|
184
157
|
function xlsxToPdf(bytes, options) {
|
|
185
158
|
return convertDocument("xlsx", "pdf", bytes, options);
|
|
186
159
|
}
|
|
187
|
-
function pdfToXlsx(bytes, options) {
|
|
188
|
-
return convertDocument("pdf", "xlsx", bytes, options);
|
|
189
|
-
}
|
|
190
160
|
function xlsxToMarkdown(bytes, options) {
|
|
191
161
|
return convertDocument("xlsx", "markdown", bytes, options);
|
|
192
162
|
}
|
|
@@ -343,4 +313,4 @@ function odbReportToPdf(content, options) {
|
|
|
343
313
|
return out;
|
|
344
314
|
}
|
|
345
315
|
//#endregion
|
|
346
|
-
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,
|
|
316
|
+
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, svgToOdg, svgToPdf, xlsxToCsv, xlsxToMarkdown, xlsxToOds, xlsxToPdf };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_model_geometry = require("../model/geometry.cjs");
|
|
3
|
+
const require_model_bytes = require("../model/bytes.cjs");
|
|
3
4
|
const require_layout_shared = require("../layout/shared.cjs");
|
|
4
5
|
require("../layout/sheets.cjs");
|
|
5
6
|
const require_layout_drawing = require("../layout/drawing.cjs");
|
|
@@ -15,7 +16,7 @@ function buildDocumentBytes(pkg, target) {
|
|
|
15
16
|
if (target === "odf") throw new Error("'odf' (a standalone formula document) cannot be built from a DocumentPackage -- there is no ContentDocument-to-odf builder");
|
|
16
17
|
const content = require_codecs_registry.DOCUMENT_FORMAT_CODECS[target].content;
|
|
17
18
|
if (!content?.write) throw new Error(`DocumentFormat '${target}' has no content.write codec in DOCUMENT_FORMAT_CODECS, and is not 'pdf'/'odf' -- this is an internal invariant violation, not a caller error`);
|
|
18
|
-
return
|
|
19
|
+
return require_model_bytes.requireArrayBufferBytes(content.write((0, document_schema_js.flattenPackage)(pkg)));
|
|
19
20
|
}
|
|
20
21
|
function pageOfFrame(state, frame) {
|
|
21
22
|
return state.pages[frame.pageIndex];
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { flipY } from "../model/geometry.js";
|
|
2
|
+
import { requireArrayBufferBytes } from "../model/bytes.js";
|
|
2
3
|
import { pushCellBorderLines, registerImage, runFont } from "../layout/shared.js";
|
|
3
4
|
import "../layout/sheets.js";
|
|
4
5
|
import { convertVector } from "../layout/drawing.js";
|
|
5
|
-
import { DOCUMENT_FORMAT_CODECS
|
|
6
|
+
import { DOCUMENT_FORMAT_CODECS } from "../codecs/registry.js";
|
|
6
7
|
import { COLOR_BLACK, DEFAULT_LAYOUT_FONT, flattenPackage } from "document-schema.js";
|
|
7
8
|
import { LAYOUT_FORMAT_VERSION, writePdf } from "pdf-codec";
|
|
8
9
|
//#region src/convert/from-package.ts
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_convert_composition = require("./composition.cjs");
|
|
3
|
+
const require_codecs_read = require("../codecs/read.cjs");
|
|
4
|
+
//#region src/convert/from-pdf.ts
|
|
5
|
+
function readDocumentMetadata(format, bytes, options) {
|
|
6
|
+
if (format === "pdf") return require_codecs_read.readDocumentLayout(bytes, { signal: options?.signal }).metadata;
|
|
7
|
+
return require_codecs_read.CONTENT_READERS[format](bytes, { signal: options?.signal }).metadata;
|
|
8
|
+
}
|
|
9
|
+
function pdfToDocx(bytes, options) {
|
|
10
|
+
return require_convert_composition.convertDocumentFromPdf("docx", bytes, options);
|
|
11
|
+
}
|
|
12
|
+
function pdfToPptx(bytes, options) {
|
|
13
|
+
return require_convert_composition.convertDocumentFromPdf("pptx", bytes, options);
|
|
14
|
+
}
|
|
15
|
+
function pdfToOdt(bytes, options) {
|
|
16
|
+
return require_convert_composition.convertDocumentFromPdf("odt", bytes, options);
|
|
17
|
+
}
|
|
18
|
+
function pdfToOdp(bytes, options) {
|
|
19
|
+
return require_convert_composition.convertDocumentFromPdf("odp", bytes, options);
|
|
20
|
+
}
|
|
21
|
+
function pdfToOdg(bytes, options) {
|
|
22
|
+
return require_convert_composition.convertDocumentFromPdf("odg", bytes, options);
|
|
23
|
+
}
|
|
24
|
+
function pdfToOds(bytes, options) {
|
|
25
|
+
return require_convert_composition.convertDocumentFromPdf("ods", bytes, options);
|
|
26
|
+
}
|
|
27
|
+
function pdfToMarkdown(bytes, options) {
|
|
28
|
+
return require_convert_composition.convertDocumentFromPdf("markdown", bytes, options);
|
|
29
|
+
}
|
|
30
|
+
function pdfToCsv(bytes, options) {
|
|
31
|
+
return require_convert_composition.convertDocumentFromPdf("csv", bytes, options);
|
|
32
|
+
}
|
|
33
|
+
function pdfToSvg(bytes, options) {
|
|
34
|
+
return require_convert_composition.convertDocumentFromPdf("svg", bytes, options);
|
|
35
|
+
}
|
|
36
|
+
function pdfToXlsx(bytes, options) {
|
|
37
|
+
return require_convert_composition.convertDocumentFromPdf("xlsx", bytes, options);
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
exports.pdfToCsv = pdfToCsv;
|
|
41
|
+
exports.pdfToDocx = pdfToDocx;
|
|
42
|
+
exports.pdfToMarkdown = pdfToMarkdown;
|
|
43
|
+
exports.pdfToOdg = pdfToOdg;
|
|
44
|
+
exports.pdfToOdp = pdfToOdp;
|
|
45
|
+
exports.pdfToOds = pdfToOds;
|
|
46
|
+
exports.pdfToOdt = pdfToOdt;
|
|
47
|
+
exports.pdfToPptx = pdfToPptx;
|
|
48
|
+
exports.pdfToSvg = pdfToSvg;
|
|
49
|
+
exports.pdfToXlsx = pdfToXlsx;
|
|
50
|
+
exports.readDocumentMetadata = readDocumentMetadata;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DocumentFormat } from "./port.cjs";
|
|
2
|
+
import { CsvWriteOptions, SvgWriteOptions } from "./convert.cjs";
|
|
3
|
+
import { DocumentPackage, LayoutMetadata } from "document-schema.js";
|
|
4
|
+
import { PdfDiagnosticSink } from "pdf-codec";
|
|
5
|
+
//#region src/convert/from-pdf.d.ts
|
|
6
|
+
interface ReadDocumentMetadataOptions {
|
|
7
|
+
readonly signal?: AbortSignal;
|
|
8
|
+
}
|
|
9
|
+
declare function readDocumentMetadata(format: DocumentFormat, bytes: Uint8Array<ArrayBuffer>, options?: ReadDocumentMetadataOptions): LayoutMetadata;
|
|
10
|
+
interface PdfToDocumentOptions {
|
|
11
|
+
readonly signal?: AbortSignal;
|
|
12
|
+
readonly sink?: PdfDiagnosticSink;
|
|
13
|
+
readonly onDocument?: (pkg: DocumentPackage) => void;
|
|
14
|
+
}
|
|
15
|
+
declare function pdfToDocx(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
16
|
+
declare function pdfToPptx(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
17
|
+
declare function pdfToOdt(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
18
|
+
declare function pdfToOdp(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
19
|
+
declare function pdfToOdg(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
20
|
+
declare function pdfToOds(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
21
|
+
declare function pdfToMarkdown(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
22
|
+
declare function pdfToCsv(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions & CsvWriteOptions): Uint8Array<ArrayBuffer>;
|
|
23
|
+
declare function pdfToSvg(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions & SvgWriteOptions): Uint8Array<ArrayBuffer>;
|
|
24
|
+
declare function pdfToXlsx(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { PdfToDocumentOptions, ReadDocumentMetadataOptions, pdfToCsv, pdfToDocx, pdfToMarkdown, pdfToOdg, pdfToOdp, pdfToOds, pdfToOdt, pdfToPptx, pdfToSvg, pdfToXlsx, readDocumentMetadata };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DocumentFormat } from "./port.js";
|
|
2
|
+
import { CsvWriteOptions, SvgWriteOptions } from "./convert.js";
|
|
3
|
+
import { DocumentPackage, LayoutMetadata } from "document-schema.js";
|
|
4
|
+
import { PdfDiagnosticSink } from "pdf-codec";
|
|
5
|
+
//#region src/convert/from-pdf.d.ts
|
|
6
|
+
interface ReadDocumentMetadataOptions {
|
|
7
|
+
readonly signal?: AbortSignal;
|
|
8
|
+
}
|
|
9
|
+
declare function readDocumentMetadata(format: DocumentFormat, bytes: Uint8Array<ArrayBuffer>, options?: ReadDocumentMetadataOptions): LayoutMetadata;
|
|
10
|
+
interface PdfToDocumentOptions {
|
|
11
|
+
readonly signal?: AbortSignal;
|
|
12
|
+
readonly sink?: PdfDiagnosticSink;
|
|
13
|
+
readonly onDocument?: (pkg: DocumentPackage) => void;
|
|
14
|
+
}
|
|
15
|
+
declare function pdfToDocx(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
16
|
+
declare function pdfToPptx(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
17
|
+
declare function pdfToOdt(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
18
|
+
declare function pdfToOdp(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
19
|
+
declare function pdfToOdg(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
20
|
+
declare function pdfToOds(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
21
|
+
declare function pdfToMarkdown(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
22
|
+
declare function pdfToCsv(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions & CsvWriteOptions): Uint8Array<ArrayBuffer>;
|
|
23
|
+
declare function pdfToSvg(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions & SvgWriteOptions): Uint8Array<ArrayBuffer>;
|
|
24
|
+
declare function pdfToXlsx(bytes: Uint8Array<ArrayBuffer>, options?: PdfToDocumentOptions): Uint8Array<ArrayBuffer>;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { PdfToDocumentOptions, ReadDocumentMetadataOptions, pdfToCsv, pdfToDocx, pdfToMarkdown, pdfToOdg, pdfToOdp, pdfToOds, pdfToOdt, pdfToPptx, pdfToSvg, pdfToXlsx, readDocumentMetadata };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { convertDocumentFromPdf } from "./composition.js";
|
|
2
|
+
import { CONTENT_READERS, readDocumentLayout } from "../codecs/read.js";
|
|
3
|
+
//#region src/convert/from-pdf.ts
|
|
4
|
+
function readDocumentMetadata(format, bytes, options) {
|
|
5
|
+
if (format === "pdf") return readDocumentLayout(bytes, { signal: options?.signal }).metadata;
|
|
6
|
+
return CONTENT_READERS[format](bytes, { signal: options?.signal }).metadata;
|
|
7
|
+
}
|
|
8
|
+
function pdfToDocx(bytes, options) {
|
|
9
|
+
return convertDocumentFromPdf("docx", bytes, options);
|
|
10
|
+
}
|
|
11
|
+
function pdfToPptx(bytes, options) {
|
|
12
|
+
return convertDocumentFromPdf("pptx", bytes, options);
|
|
13
|
+
}
|
|
14
|
+
function pdfToOdt(bytes, options) {
|
|
15
|
+
return convertDocumentFromPdf("odt", bytes, options);
|
|
16
|
+
}
|
|
17
|
+
function pdfToOdp(bytes, options) {
|
|
18
|
+
return convertDocumentFromPdf("odp", bytes, options);
|
|
19
|
+
}
|
|
20
|
+
function pdfToOdg(bytes, options) {
|
|
21
|
+
return convertDocumentFromPdf("odg", bytes, options);
|
|
22
|
+
}
|
|
23
|
+
function pdfToOds(bytes, options) {
|
|
24
|
+
return convertDocumentFromPdf("ods", bytes, options);
|
|
25
|
+
}
|
|
26
|
+
function pdfToMarkdown(bytes, options) {
|
|
27
|
+
return convertDocumentFromPdf("markdown", bytes, options);
|
|
28
|
+
}
|
|
29
|
+
function pdfToCsv(bytes, options) {
|
|
30
|
+
return convertDocumentFromPdf("csv", bytes, options);
|
|
31
|
+
}
|
|
32
|
+
function pdfToSvg(bytes, options) {
|
|
33
|
+
return convertDocumentFromPdf("svg", bytes, options);
|
|
34
|
+
}
|
|
35
|
+
function pdfToXlsx(bytes, options) {
|
|
36
|
+
return convertDocumentFromPdf("xlsx", bytes, options);
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { pdfToCsv, pdfToDocx, pdfToMarkdown, pdfToOdg, pdfToOdp, pdfToOds, pdfToOdt, pdfToPptx, pdfToSvg, pdfToXlsx, readDocumentMetadata };
|
package/dist/convert/local.cjs
CHANGED
|
@@ -2,6 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_convert_capability = require("./capability.cjs");
|
|
3
3
|
const require_convert_port = require("./port.cjs");
|
|
4
4
|
const require_convert_composition = require("./composition.cjs");
|
|
5
|
+
const require_convert_composition_to_pdf = require("./composition-to-pdf.cjs");
|
|
5
6
|
const require_convert_convert = require("./convert.cjs");
|
|
6
7
|
//#region src/convert/local.ts
|
|
7
8
|
const SUPPORTED_CONVERSIONS = (() => {
|
|
@@ -76,7 +77,7 @@ function createLocalDocumentConverter() {
|
|
|
76
77
|
});
|
|
77
78
|
}
|
|
78
79
|
if (require_convert_composition.resolveCompositionPlan(source.format, targetFormat) === void 0) return Promise.reject(new require_convert_capability.UnsupportedConversionError(source.format, targetFormat));
|
|
79
|
-
const bytes =
|
|
80
|
+
const bytes = require_convert_composition_to_pdf.convertDocument(source.format, targetFormat, source.bytes, {
|
|
80
81
|
signal: options.signal,
|
|
81
82
|
fonts: options.fonts,
|
|
82
83
|
onFontSubstitution,
|
package/dist/convert/local.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { UnsupportedConversionError } from "./capability.js";
|
|
2
2
|
import { DOCUMENT_FORMATS } from "./port.js";
|
|
3
|
-
import {
|
|
3
|
+
import { resolveCompositionPlan } from "./composition.js";
|
|
4
|
+
import { convertDocument } from "./composition-to-pdf.js";
|
|
4
5
|
import { odfToPdf } from "./convert.js";
|
|
5
6
|
//#region src/convert/local.ts
|
|
6
7
|
const SUPPORTED_CONVERSIONS = (() => {
|