docling.rs-wasm 0.50.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/LICENSE +21 -0
- package/README.md +77 -0
- package/bundler/docling_wasm.d.ts +132 -0
- package/bundler/docling_wasm.js +9 -0
- package/bundler/docling_wasm_bg.js +825 -0
- package/bundler/docling_wasm_bg.wasm +0 -0
- package/bundler/docling_wasm_bg.wasm.d.ts +33 -0
- package/package.json +50 -0
- package/web/docling_wasm.d.ts +190 -0
- package/web/docling_wasm.js +926 -0
- package/web/docling_wasm_bg.wasm +0 -0
- package/web/docling_wasm_bg.wasm.d.ts +33 -0
|
Binary file
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const convert: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number, number];
|
|
5
|
+
export const start: () => void;
|
|
6
|
+
export const supported_extensions: () => [number, number];
|
|
7
|
+
export const version: () => [number, number];
|
|
8
|
+
export const ocr_image: (a: number, b: number, c: number, d: number, e: any, f: number, g: number) => any;
|
|
9
|
+
export const __wbg_digitalconverter_free: (a: number, b: number) => void;
|
|
10
|
+
export const __wbg_scannedconverter_free: (a: number, b: number) => void;
|
|
11
|
+
export const convert_scanned_image: (a: number, b: number, c: number, d: number, e: number, f: number, g: any, h: any, i: number, j: number, k: number, l: number) => any;
|
|
12
|
+
export const digitalconverter_addPageTf: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: any, i: any, j: number) => any;
|
|
13
|
+
export const digitalconverter_add_page: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: any, i: number) => any;
|
|
14
|
+
export const digitalconverter_finish: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
|
|
15
|
+
export const digitalconverter_new: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
16
|
+
export const digitalconverter_page_count: (a: number) => number;
|
|
17
|
+
export const digitalconverter_setDict: (a: number, b: number, c: number) => void;
|
|
18
|
+
export const scannedconverter_addPageTf: (a: number, b: number, c: number, d: number, e: number, f: number, g: any, h: any, i: any) => any;
|
|
19
|
+
export const scannedconverter_add_page: (a: number, b: number, c: number, d: number, e: number, f: number, g: any, h: any) => any;
|
|
20
|
+
export const scannedconverter_finish: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
|
|
21
|
+
export const scannedconverter_new: (a: number, b: number) => number;
|
|
22
|
+
export const scannedconverter_page_count: (a: number) => number;
|
|
23
|
+
export const wasm_bindgen_c5dab95b9564c094___convert__closures_____invoke___wasm_bindgen_c5dab95b9564c094___JsValue__core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_c5dab95b9564c094___JsError___true_: (a: number, b: number, c: any) => [number, number];
|
|
24
|
+
export const wasm_bindgen_c5dab95b9564c094___convert__closures_____invoke___js_sys_29633ec172849407___Function_fn_wasm_bindgen_c5dab95b9564c094___JsValue_____wasm_bindgen_c5dab95b9564c094___sys__Undefined___js_sys_29633ec172849407___Function_fn_wasm_bindgen_c5dab95b9564c094___JsValue_____wasm_bindgen_c5dab95b9564c094___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
|
|
25
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
26
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
27
|
+
export const __wbindgen_exn_store: (a: number) => void;
|
|
28
|
+
export const __externref_table_alloc: () => number;
|
|
29
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
30
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
31
|
+
export const __wbindgen_destroy_closure: (a: number, b: number) => void;
|
|
32
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
33
|
+
export const __wbindgen_start: () => void;
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "docling.rs-wasm",
|
|
3
|
+
"version": "0.50.0",
|
|
4
|
+
"description": "In-browser document conversion: DOCX, HTML, XLSX, PPTX, EPUB, Markdown, … and the text layer of PDFs → Markdown / docling JSON / DocLang, fully client-side (docling.rs compiled to WebAssembly)",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/docling-project/docling.rs.git",
|
|
9
|
+
"directory": "crates/docling-wasm"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/docling-project/docling.rs/tree/master/crates/docling-wasm#readme",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"docling",
|
|
14
|
+
"document",
|
|
15
|
+
"conversion",
|
|
16
|
+
"markdown",
|
|
17
|
+
"pdf",
|
|
18
|
+
"docx",
|
|
19
|
+
"xlsx",
|
|
20
|
+
"pptx",
|
|
21
|
+
"wasm",
|
|
22
|
+
"webassembly",
|
|
23
|
+
"browser",
|
|
24
|
+
"ocr"
|
|
25
|
+
],
|
|
26
|
+
"type": "module",
|
|
27
|
+
"main": "bundler/docling_wasm.js",
|
|
28
|
+
"types": "bundler/docling_wasm.d.ts",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./bundler/docling_wasm.d.ts",
|
|
32
|
+
"default": "./bundler/docling_wasm.js"
|
|
33
|
+
},
|
|
34
|
+
"./web": {
|
|
35
|
+
"types": "./web/docling_wasm.d.ts",
|
|
36
|
+
"default": "./web/docling_wasm.js"
|
|
37
|
+
},
|
|
38
|
+
"./web/docling_wasm_bg.wasm": "./web/docling_wasm_bg.wasm",
|
|
39
|
+
"./bundler/docling_wasm_bg.wasm": "./bundler/docling_wasm_bg.wasm"
|
|
40
|
+
},
|
|
41
|
+
"sideEffects": [
|
|
42
|
+
"./bundler/docling_wasm.js"
|
|
43
|
+
],
|
|
44
|
+
"files": [
|
|
45
|
+
"bundler",
|
|
46
|
+
"web",
|
|
47
|
+
"README.md",
|
|
48
|
+
"LICENSE"
|
|
49
|
+
]
|
|
50
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A digital PDF being converted page by page. Construct it from the file's
|
|
6
|
+
* bytes (the text layer is parsed once, in Rust), then feed the rasterized
|
|
7
|
+
* pages in order.
|
|
8
|
+
*/
|
|
9
|
+
export class DigitalConverter {
|
|
10
|
+
free(): void;
|
|
11
|
+
[Symbol.dispose](): void;
|
|
12
|
+
/**
|
|
13
|
+
* [`add_page`](Self::add_page) with TableFormer for the table regions whose
|
|
14
|
+
* geometric reconstruction looks unreliable.
|
|
15
|
+
*/
|
|
16
|
+
addPageTf(index: number, rgba: Uint8Array, px_w: number, px_h: number, scale: number, layout: any, tf: any, rec?: any | null): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Convert page `index` (0-based) given its rendered bitmap: layout
|
|
19
|
+
* detection plus geometric tables. `scale` is the raster's pixels per PDF
|
|
20
|
+
* point (2.0 for pdf.js `{scale: 2}`). With `rec` (and a dictionary at
|
|
21
|
+
* construction), embedded raster pictures that carry no text cells are
|
|
22
|
+
* OCR'd — the text a digital page's images hide from its text layer.
|
|
23
|
+
*/
|
|
24
|
+
add_page(index: number, rgba: Uint8Array, px_w: number, px_h: number, scale: number, layout: any, rec?: any | null): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Assemble the converted pages into a document and render it as `"md"`
|
|
27
|
+
* (default), `"json"` or `"doclang"`, with `images` picking how pictures
|
|
28
|
+
* render in Markdown. Resets the converter.
|
|
29
|
+
*/
|
|
30
|
+
finish(name: string, to?: string | null, images?: string | null): string;
|
|
31
|
+
/**
|
|
32
|
+
* Parse the PDF's text layer. Fails when there is none — the caller should
|
|
33
|
+
* fall back to the scanned pipeline, exactly as the demo page does.
|
|
34
|
+
* `dict` (optional) is the recognition dictionary text; with it and a
|
|
35
|
+
* `RecSession` on `add_page`, embedded raster pictures get OCR'd too.
|
|
36
|
+
*/
|
|
37
|
+
constructor(bytes: Uint8Array, dict?: string | null);
|
|
38
|
+
/**
|
|
39
|
+
* Pages the text parser found.
|
|
40
|
+
*/
|
|
41
|
+
page_count(): number;
|
|
42
|
+
/**
|
|
43
|
+
* Install the recognition dictionary after construction — the host probes
|
|
44
|
+
* the text layer first (the constructor throws on a scan) and only then
|
|
45
|
+
* fetches the recognition model + dictionary.
|
|
46
|
+
*/
|
|
47
|
+
setDict(dict: string): void;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Multi-page scanned-document converter (lite profile). Feed pages in
|
|
52
|
+
* order, then [`finish`](Self::finish) — cross-page paragraph continuations
|
|
53
|
+
* merge exactly like the native pipeline.
|
|
54
|
+
*/
|
|
55
|
+
export class ScannedConverter {
|
|
56
|
+
free(): void;
|
|
57
|
+
[Symbol.dispose](): void;
|
|
58
|
+
/**
|
|
59
|
+
* Convert one page with TableFormer (#157 stage 3): table regions get the
|
|
60
|
+
* ONNX table-structure model + docling's cell matcher instead of the
|
|
61
|
+
* geometric reconstruction. `tf` is the JS-side session over the encoder /
|
|
62
|
+
* decoder / bbox graphs.
|
|
63
|
+
*/
|
|
64
|
+
addPageTf(rgba: Uint8Array, px_w: number, px_h: number, scale: number, layout: any, rec: any, tf: any): Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* Convert one page (lite profile — geometric tables): `rgba` is the
|
|
67
|
+
* rendered bitmap (canvas ImageData), `scale` its pixels-per-PDF-point
|
|
68
|
+
* (2.0 for pdf.js `{scale: 2}`; 1.0 for a standalone image).
|
|
69
|
+
*/
|
|
70
|
+
add_page(rgba: Uint8Array, px_w: number, px_h: number, scale: number, layout: any, rec: any): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Assemble the accumulated pages into the final document and render it
|
|
73
|
+
* as `"md"` (default), `"json"` or `"doclang"` — the same three the
|
|
74
|
+
* declarative [`crate::convert`] entry point offers. `images` picks how
|
|
75
|
+
* cropped figures render in Markdown (`"placeholder"` | `"embedded"`),
|
|
76
|
+
* like [`crate::convert`]. Resets the converter.
|
|
77
|
+
*/
|
|
78
|
+
finish(name: string, to?: string | null, images?: string | null): string;
|
|
79
|
+
/**
|
|
80
|
+
* `dict` is the recognition dictionary text (`en_dict.txt` for the
|
|
81
|
+
* default English model).
|
|
82
|
+
*/
|
|
83
|
+
constructor(dict: string);
|
|
84
|
+
/**
|
|
85
|
+
* Number of pages converted so far (progress display).
|
|
86
|
+
*/
|
|
87
|
+
page_count(): number;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Convert a document (as bytes + filename, the extension drives format
|
|
92
|
+
* detection) to `to`: `"md"` (Markdown, default), `"json"` (docling-core's
|
|
93
|
+
* `DoclingDocument` wire format, schema 1.10.0) or `"doclang"` (docling's
|
|
94
|
+
* DocLang XML serialization).
|
|
95
|
+
*
|
|
96
|
+
* `images` controls how pictures render in Markdown — `"placeholder"`
|
|
97
|
+
* (default) or `"embedded"` (base64 data URIs), the same option
|
|
98
|
+
* docling-serve exposes. `max_pages` converts only a PDF's first N pages
|
|
99
|
+
* (issue #80's window, first pinned to 1); other formats ignore it.
|
|
100
|
+
*/
|
|
101
|
+
export function convert(bytes: Uint8Array, filename: string, to?: string | null, images?: string | null, max_pages?: number | null): string;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* One-shot scanned-image conversion through the full lite profile (layout +
|
|
105
|
+
* OCR + assembly) — the browser counterpart of the native image path
|
|
106
|
+
* (a standalone image is its own page at scale 1).
|
|
107
|
+
*/
|
|
108
|
+
export function convert_scanned_image(bytes: Uint8Array, name: string, dict: string, layout: any, rec: any, to?: string | null, images?: string | null): Promise<string>;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* OCR a scanned image entirely in the browser: `bytes` is the image file
|
|
112
|
+
* (PNG/JPEG/…), `dict` the recognition dictionary text (`en_dict.txt` for
|
|
113
|
+
* the default English model), `session` the JS inference wrapper. Returns
|
|
114
|
+
* Markdown (default) or docling JSON per `to`, one paragraph per recognized
|
|
115
|
+
* line.
|
|
116
|
+
*/
|
|
117
|
+
export function ocr_image(bytes: Uint8Array, dict: string, session: any, to?: string | null): Promise<string>;
|
|
118
|
+
|
|
119
|
+
export function start(): void;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* The file extensions this build can convert, as a JSON string array —
|
|
123
|
+
* handy for an `<input accept=…>` filter. PDF converts via its embedded
|
|
124
|
+
* text layer (`pdf-text`); the remaining ML formats (images, audio, METS)
|
|
125
|
+
* are excluded: they are not compiled into the wasm build.
|
|
126
|
+
*/
|
|
127
|
+
export function supported_extensions(): string;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* The docling.rs version this module was built from.
|
|
131
|
+
*/
|
|
132
|
+
export function version(): string;
|
|
133
|
+
|
|
134
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
135
|
+
|
|
136
|
+
export interface InitOutput {
|
|
137
|
+
readonly memory: WebAssembly.Memory;
|
|
138
|
+
readonly convert: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number, number];
|
|
139
|
+
readonly start: () => void;
|
|
140
|
+
readonly supported_extensions: () => [number, number];
|
|
141
|
+
readonly version: () => [number, number];
|
|
142
|
+
readonly ocr_image: (a: number, b: number, c: number, d: number, e: any, f: number, g: number) => any;
|
|
143
|
+
readonly __wbg_digitalconverter_free: (a: number, b: number) => void;
|
|
144
|
+
readonly __wbg_scannedconverter_free: (a: number, b: number) => void;
|
|
145
|
+
readonly convert_scanned_image: (a: number, b: number, c: number, d: number, e: number, f: number, g: any, h: any, i: number, j: number, k: number, l: number) => any;
|
|
146
|
+
readonly digitalconverter_addPageTf: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: any, i: any, j: number) => any;
|
|
147
|
+
readonly digitalconverter_add_page: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: any, i: number) => any;
|
|
148
|
+
readonly digitalconverter_finish: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
|
|
149
|
+
readonly digitalconverter_new: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
150
|
+
readonly digitalconverter_page_count: (a: number) => number;
|
|
151
|
+
readonly digitalconverter_setDict: (a: number, b: number, c: number) => void;
|
|
152
|
+
readonly scannedconverter_addPageTf: (a: number, b: number, c: number, d: number, e: number, f: number, g: any, h: any, i: any) => any;
|
|
153
|
+
readonly scannedconverter_add_page: (a: number, b: number, c: number, d: number, e: number, f: number, g: any, h: any) => any;
|
|
154
|
+
readonly scannedconverter_finish: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
|
|
155
|
+
readonly scannedconverter_new: (a: number, b: number) => number;
|
|
156
|
+
readonly scannedconverter_page_count: (a: number) => number;
|
|
157
|
+
readonly wasm_bindgen_c5dab95b9564c094___convert__closures_____invoke___wasm_bindgen_c5dab95b9564c094___JsValue__core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_c5dab95b9564c094___JsError___true_: (a: number, b: number, c: any) => [number, number];
|
|
158
|
+
readonly wasm_bindgen_c5dab95b9564c094___convert__closures_____invoke___js_sys_29633ec172849407___Function_fn_wasm_bindgen_c5dab95b9564c094___JsValue_____wasm_bindgen_c5dab95b9564c094___sys__Undefined___js_sys_29633ec172849407___Function_fn_wasm_bindgen_c5dab95b9564c094___JsValue_____wasm_bindgen_c5dab95b9564c094___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
|
|
159
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
160
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
161
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
162
|
+
readonly __externref_table_alloc: () => number;
|
|
163
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
164
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
165
|
+
readonly __wbindgen_destroy_closure: (a: number, b: number) => void;
|
|
166
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
167
|
+
readonly __wbindgen_start: () => void;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
174
|
+
* a precompiled `WebAssembly.Module`.
|
|
175
|
+
*
|
|
176
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
177
|
+
*
|
|
178
|
+
* @returns {InitOutput}
|
|
179
|
+
*/
|
|
180
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
184
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
185
|
+
*
|
|
186
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
187
|
+
*
|
|
188
|
+
* @returns {Promise<InitOutput>}
|
|
189
|
+
*/
|
|
190
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|