@fabifont/open-redact-pdf 0.1.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 +24 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +92 -0
- package/dist/types.d.ts +91 -0
- package/dist/types.js +1 -0
- package/package.json +50 -0
- package/vendor/pdf-wasm/pdf_wasm.d.ts +22 -0
- package/vendor/pdf-wasm/pdf_wasm.js +9 -0
- package/vendor/pdf-wasm/pdf_wasm_bg.js +545 -0
- package/vendor/pdf-wasm/pdf_wasm_bg.wasm +0 -0
- package/vendor/pdf-wasm/pdf_wasm_bg.wasm.d.ts +19 -0
package/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# @fabifont/open-redact-pdf
|
|
2
|
+
|
|
3
|
+
Typed TypeScript and WebAssembly SDK for `open-redact-pdf`.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @fabifont/open-redact-pdf
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic usage
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { initWasm, openPdf, getPageCount } from "@fabifont/open-redact-pdf";
|
|
15
|
+
|
|
16
|
+
await initWasm();
|
|
17
|
+
const handle = openPdf(pdfBytes);
|
|
18
|
+
const count = getPageCount(handle);
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
For the full API and integration guidance, see:
|
|
22
|
+
|
|
23
|
+
- https://fabifont.github.io/open-redact-pdf/reference/ts-sdk.html
|
|
24
|
+
- https://fabifont.github.io/open-redact-pdf/guides/browser-integration.html
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ApplyReport, PageSize, PageText, RedactionPlan, TextMatch } from "./types";
|
|
2
|
+
export type { ApplyReport, PageSize, PageText, RedactionMode, RedactionPlan, RedactionTarget, TextItem, TextMatch, } from "./types";
|
|
3
|
+
export type { FillColor, Point, QuadGroupTarget, QuadTarget, RectTarget } from "./types";
|
|
4
|
+
export type PdfHandle = {
|
|
5
|
+
readonly __brand: "PdfHandle";
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Loads the generated WebAssembly module used by the browser-facing SDK.
|
|
9
|
+
*
|
|
10
|
+
* Call this once before opening PDFs. Safe to call concurrently — the module
|
|
11
|
+
* is loaded only once.
|
|
12
|
+
*/
|
|
13
|
+
export declare function initWasm(): Promise<void>;
|
|
14
|
+
/** Opens a PDF from raw bytes and returns an opaque handle. */
|
|
15
|
+
export declare function openPdf(input: Uint8Array): PdfHandle;
|
|
16
|
+
/** Returns the number of pages in the opened PDF. */
|
|
17
|
+
export declare function getPageCount(handle: PdfHandle): number;
|
|
18
|
+
/** Returns the normalized page size for a zero-based page index. */
|
|
19
|
+
export declare function getPageSize(handle: PdfHandle, pageIndex: number): PageSize;
|
|
20
|
+
/** Extracts page text and geometry for the supported subset. */
|
|
21
|
+
export declare function extractText(handle: PdfHandle, pageIndex: number): PageText;
|
|
22
|
+
/** Searches page text in visual order and returns page-space match quads. */
|
|
23
|
+
export declare function searchText(handle: PdfHandle, pageIndex: number, query: string): TextMatch[];
|
|
24
|
+
/** Applies a redaction plan to the opened handle in place. */
|
|
25
|
+
export declare function applyRedactions(handle: PdfHandle, plan: RedactionPlan): ApplyReport;
|
|
26
|
+
/** Saves the current document state as a new PDF byte array. */
|
|
27
|
+
export declare function savePdf(handle: PdfHandle): Uint8Array;
|
|
28
|
+
/**
|
|
29
|
+
* Frees the WASM memory backing a PdfHandle.
|
|
30
|
+
*
|
|
31
|
+
* After calling this, the handle must not be used again. Call this when
|
|
32
|
+
* you are done with a document to avoid leaking memory.
|
|
33
|
+
*/
|
|
34
|
+
export declare function freePdf(handle: PdfHandle): void;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
let wasmModule = null;
|
|
2
|
+
let initPromise = null;
|
|
3
|
+
/**
|
|
4
|
+
* Loads the generated WebAssembly module used by the browser-facing SDK.
|
|
5
|
+
*
|
|
6
|
+
* Call this once before opening PDFs. Safe to call concurrently — the module
|
|
7
|
+
* is loaded only once.
|
|
8
|
+
*/
|
|
9
|
+
export function initWasm() {
|
|
10
|
+
if (!initPromise) {
|
|
11
|
+
initPromise = import("../vendor/pdf-wasm/pdf_wasm").then((module) => {
|
|
12
|
+
wasmModule = module;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return initPromise;
|
|
16
|
+
}
|
|
17
|
+
function requireWasm() {
|
|
18
|
+
if (!wasmModule) {
|
|
19
|
+
throw new Error("WASM module is not initialized. Call initWasm() first.");
|
|
20
|
+
}
|
|
21
|
+
return wasmModule;
|
|
22
|
+
}
|
|
23
|
+
/** Opens a PDF from raw bytes and returns an opaque handle. */
|
|
24
|
+
export function openPdf(input) {
|
|
25
|
+
return requireWasm().openPdf(input);
|
|
26
|
+
}
|
|
27
|
+
/** Returns the number of pages in the opened PDF. */
|
|
28
|
+
export function getPageCount(handle) {
|
|
29
|
+
return requireWasm().getPageCount(handle);
|
|
30
|
+
}
|
|
31
|
+
/** Returns the normalized page size for a zero-based page index. */
|
|
32
|
+
export function getPageSize(handle, pageIndex) {
|
|
33
|
+
return requireWasm().getPageSize(handle, pageIndex);
|
|
34
|
+
}
|
|
35
|
+
/** Extracts page text and geometry for the supported subset. */
|
|
36
|
+
export function extractText(handle, pageIndex) {
|
|
37
|
+
return normalizePageText(requireWasm().extractText(handle, pageIndex));
|
|
38
|
+
}
|
|
39
|
+
/** Searches page text in visual order and returns page-space match quads. */
|
|
40
|
+
export function searchText(handle, pageIndex, query) {
|
|
41
|
+
return requireWasm().searchText(handle, pageIndex, query).map(normalizeTextMatch);
|
|
42
|
+
}
|
|
43
|
+
/** Applies a redaction plan to the opened handle in place. */
|
|
44
|
+
export function applyRedactions(handle, plan) {
|
|
45
|
+
return normalizeApplyReport(requireWasm().applyRedactions(handle, plan));
|
|
46
|
+
}
|
|
47
|
+
/** Saves the current document state as a new PDF byte array. */
|
|
48
|
+
export function savePdf(handle) {
|
|
49
|
+
return requireWasm().savePdf(handle);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Frees the WASM memory backing a PdfHandle.
|
|
53
|
+
*
|
|
54
|
+
* After calling this, the handle must not be used again. Call this when
|
|
55
|
+
* you are done with a document to avoid leaking memory.
|
|
56
|
+
*/
|
|
57
|
+
export function freePdf(handle) {
|
|
58
|
+
handle.free();
|
|
59
|
+
}
|
|
60
|
+
function normalizePageText(raw) {
|
|
61
|
+
return {
|
|
62
|
+
pageIndex: raw.page_index,
|
|
63
|
+
text: raw.text,
|
|
64
|
+
items: raw.items.map((item) => ({
|
|
65
|
+
text: item.text,
|
|
66
|
+
bbox: item.bbox,
|
|
67
|
+
quad: item.quad ? normalizeQuad(item.quad) : undefined,
|
|
68
|
+
charStart: item.char_start,
|
|
69
|
+
charEnd: item.char_end,
|
|
70
|
+
})),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function normalizeTextMatch(raw) {
|
|
74
|
+
return {
|
|
75
|
+
text: raw.text,
|
|
76
|
+
pageIndex: raw.page_index,
|
|
77
|
+
quads: raw.quads.map(normalizeQuad),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function normalizeQuad(quad) {
|
|
81
|
+
return Array.isArray(quad) ? quad : quad.points;
|
|
82
|
+
}
|
|
83
|
+
function normalizeApplyReport(raw) {
|
|
84
|
+
return {
|
|
85
|
+
pagesTouched: raw.pages_touched,
|
|
86
|
+
textGlyphsRemoved: raw.text_glyphs_removed,
|
|
87
|
+
pathPaintsRemoved: raw.path_paints_removed,
|
|
88
|
+
imageDrawsRemoved: raw.image_draws_removed,
|
|
89
|
+
annotationsRemoved: raw.annotations_removed,
|
|
90
|
+
warnings: raw.warnings,
|
|
91
|
+
};
|
|
92
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/** Two-dimensional point in normalized page-space PDF units. */
|
|
2
|
+
export type Point = {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
};
|
|
6
|
+
/** Rectangle redaction target. */
|
|
7
|
+
export type RectTarget = {
|
|
8
|
+
kind: "rect";
|
|
9
|
+
pageIndex: number;
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
};
|
|
15
|
+
/** Single quad redaction target. */
|
|
16
|
+
export type QuadTarget = {
|
|
17
|
+
kind: "quad";
|
|
18
|
+
pageIndex: number;
|
|
19
|
+
points: [Point, Point, Point, Point];
|
|
20
|
+
};
|
|
21
|
+
/** Multi-quad redaction target for visual text selections or grouped matches. */
|
|
22
|
+
export type QuadGroupTarget = {
|
|
23
|
+
kind: "quadGroup";
|
|
24
|
+
pageIndex: number;
|
|
25
|
+
quads: Array<[Point, Point, Point, Point]>;
|
|
26
|
+
};
|
|
27
|
+
/** Canonical redaction target union accepted by the engine. */
|
|
28
|
+
export type RedactionTarget = RectTarget | QuadTarget | QuadGroupTarget;
|
|
29
|
+
/**
|
|
30
|
+
* Controls the visual output of text redaction.
|
|
31
|
+
*
|
|
32
|
+
* - `"strip"` — physically remove bytes; surviving text shifts, no overlay.
|
|
33
|
+
* - `"redact"` — replace bytes with blank space, draw colored overlay. **(default)**
|
|
34
|
+
* - `"erase"` — replace bytes with blank space, no overlay.
|
|
35
|
+
*/
|
|
36
|
+
export type RedactionMode = "strip" | "redact" | "erase";
|
|
37
|
+
/** Redaction plan passed to the apply pipeline. */
|
|
38
|
+
export type RedactionPlan = {
|
|
39
|
+
targets: RedactionTarget[];
|
|
40
|
+
mode?: RedactionMode;
|
|
41
|
+
fillColor?: {
|
|
42
|
+
r: number;
|
|
43
|
+
g: number;
|
|
44
|
+
b: number;
|
|
45
|
+
};
|
|
46
|
+
overlayText?: string | null;
|
|
47
|
+
removeIntersectingAnnotations?: boolean;
|
|
48
|
+
stripMetadata?: boolean;
|
|
49
|
+
stripAttachments?: boolean;
|
|
50
|
+
};
|
|
51
|
+
/** Concrete fill color type derived from the plan shape. */
|
|
52
|
+
export type FillColor = NonNullable<RedactionPlan["fillColor"]>;
|
|
53
|
+
/** Normalized page size in PDF user-space units. */
|
|
54
|
+
export type PageSize = {
|
|
55
|
+
width: number;
|
|
56
|
+
height: number;
|
|
57
|
+
};
|
|
58
|
+
/** Extracted text item with geometry. */
|
|
59
|
+
export type TextItem = {
|
|
60
|
+
text: string;
|
|
61
|
+
bbox: {
|
|
62
|
+
x: number;
|
|
63
|
+
y: number;
|
|
64
|
+
width: number;
|
|
65
|
+
height: number;
|
|
66
|
+
};
|
|
67
|
+
quad?: [Point, Point, Point, Point];
|
|
68
|
+
charStart?: number;
|
|
69
|
+
charEnd?: number;
|
|
70
|
+
};
|
|
71
|
+
/** Extracted text and geometry for a page. */
|
|
72
|
+
export type PageText = {
|
|
73
|
+
pageIndex: number;
|
|
74
|
+
text: string;
|
|
75
|
+
items: TextItem[];
|
|
76
|
+
};
|
|
77
|
+
/** Search result returned in visual glyph order. */
|
|
78
|
+
export type TextMatch = {
|
|
79
|
+
text: string;
|
|
80
|
+
pageIndex: number;
|
|
81
|
+
quads: Array<[Point, Point, Point, Point]>;
|
|
82
|
+
};
|
|
83
|
+
/** Summary of work performed by a redaction apply pass. */
|
|
84
|
+
export type ApplyReport = {
|
|
85
|
+
pagesTouched: number;
|
|
86
|
+
textGlyphsRemoved: number;
|
|
87
|
+
pathPaintsRemoved: number;
|
|
88
|
+
imageDrawsRemoved: number;
|
|
89
|
+
annotationsRemoved: number;
|
|
90
|
+
warnings: string[];
|
|
91
|
+
};
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fabifont/open-redact-pdf",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Browser-first PDF redaction SDK for open-redact-pdf.",
|
|
6
|
+
"keywords": ["pdf", "redaction", "wasm", "typescript", "browser", "privacy"],
|
|
7
|
+
"author": "Fabio Fontana <me@fabifont.dev>",
|
|
8
|
+
"license": "MIT OR Apache-2.0",
|
|
9
|
+
"type": "module",
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=18"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"vendor/pdf-wasm",
|
|
19
|
+
"README.md"
|
|
20
|
+
],
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"import": "./dist/index.js"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/fabifont/open-redact-pdf.git",
|
|
30
|
+
"directory": "packages/ts-sdk"
|
|
31
|
+
},
|
|
32
|
+
"homepage": "https://fabifont.github.io/open-redact-pdf/",
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/fabifont/open-redact-pdf/issues"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsc -p tsconfig.json",
|
|
41
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
42
|
+
"lint": "tsc -p tsconfig.json --noEmit",
|
|
43
|
+
"test": "tsc -p tsconfig.json --noEmit",
|
|
44
|
+
"format": "prettier --write \"src/**/*.ts\""
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"prettier": "^3.5.3",
|
|
48
|
+
"typescript": "^5.9.3"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export class PdfHandle {
|
|
5
|
+
private constructor();
|
|
6
|
+
free(): void;
|
|
7
|
+
[Symbol.dispose](): void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function applyRedactions(handle: PdfHandle, plan: any): any;
|
|
11
|
+
|
|
12
|
+
export function extractText(handle: PdfHandle, page_index: number): any;
|
|
13
|
+
|
|
14
|
+
export function getPageCount(handle: PdfHandle): number;
|
|
15
|
+
|
|
16
|
+
export function getPageSize(handle: PdfHandle, page_index: number): any;
|
|
17
|
+
|
|
18
|
+
export function openPdf(input: Uint8Array): PdfHandle;
|
|
19
|
+
|
|
20
|
+
export function savePdf(handle: PdfHandle): Uint8Array;
|
|
21
|
+
|
|
22
|
+
export function searchText(handle: PdfHandle, page_index: number, query: string): any;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* @ts-self-types="./pdf_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
import * as wasm from "./pdf_wasm_bg.wasm";
|
|
4
|
+
import { __wbg_set_wasm } from "./pdf_wasm_bg.js";
|
|
5
|
+
__wbg_set_wasm(wasm);
|
|
6
|
+
wasm.__wbindgen_start();
|
|
7
|
+
export {
|
|
8
|
+
PdfHandle, applyRedactions, extractText, getPageCount, getPageSize, openPdf, savePdf, searchText
|
|
9
|
+
} from "./pdf_wasm_bg.js";
|
|
@@ -0,0 +1,545 @@
|
|
|
1
|
+
export class PdfHandle {
|
|
2
|
+
static __wrap(ptr) {
|
|
3
|
+
ptr = ptr >>> 0;
|
|
4
|
+
const obj = Object.create(PdfHandle.prototype);
|
|
5
|
+
obj.__wbg_ptr = ptr;
|
|
6
|
+
PdfHandleFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
7
|
+
return obj;
|
|
8
|
+
}
|
|
9
|
+
__destroy_into_raw() {
|
|
10
|
+
const ptr = this.__wbg_ptr;
|
|
11
|
+
this.__wbg_ptr = 0;
|
|
12
|
+
PdfHandleFinalization.unregister(this);
|
|
13
|
+
return ptr;
|
|
14
|
+
}
|
|
15
|
+
free() {
|
|
16
|
+
const ptr = this.__destroy_into_raw();
|
|
17
|
+
wasm.__wbg_pdfhandle_free(ptr, 0);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (Symbol.dispose) PdfHandle.prototype[Symbol.dispose] = PdfHandle.prototype.free;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @param {PdfHandle} handle
|
|
24
|
+
* @param {any} plan
|
|
25
|
+
* @returns {any}
|
|
26
|
+
*/
|
|
27
|
+
export function applyRedactions(handle, plan) {
|
|
28
|
+
_assertClass(handle, PdfHandle);
|
|
29
|
+
const ret = wasm.applyRedactions(handle.__wbg_ptr, plan);
|
|
30
|
+
if (ret[2]) {
|
|
31
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
32
|
+
}
|
|
33
|
+
return takeFromExternrefTable0(ret[0]);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @param {PdfHandle} handle
|
|
38
|
+
* @param {number} page_index
|
|
39
|
+
* @returns {any}
|
|
40
|
+
*/
|
|
41
|
+
export function extractText(handle, page_index) {
|
|
42
|
+
_assertClass(handle, PdfHandle);
|
|
43
|
+
const ret = wasm.extractText(handle.__wbg_ptr, page_index);
|
|
44
|
+
if (ret[2]) {
|
|
45
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
46
|
+
}
|
|
47
|
+
return takeFromExternrefTable0(ret[0]);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @param {PdfHandle} handle
|
|
52
|
+
* @returns {number}
|
|
53
|
+
*/
|
|
54
|
+
export function getPageCount(handle) {
|
|
55
|
+
_assertClass(handle, PdfHandle);
|
|
56
|
+
const ret = wasm.getPageCount(handle.__wbg_ptr);
|
|
57
|
+
return ret >>> 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @param {PdfHandle} handle
|
|
62
|
+
* @param {number} page_index
|
|
63
|
+
* @returns {any}
|
|
64
|
+
*/
|
|
65
|
+
export function getPageSize(handle, page_index) {
|
|
66
|
+
_assertClass(handle, PdfHandle);
|
|
67
|
+
const ret = wasm.getPageSize(handle.__wbg_ptr, page_index);
|
|
68
|
+
if (ret[2]) {
|
|
69
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
70
|
+
}
|
|
71
|
+
return takeFromExternrefTable0(ret[0]);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @param {Uint8Array} input
|
|
76
|
+
* @returns {PdfHandle}
|
|
77
|
+
*/
|
|
78
|
+
export function openPdf(input) {
|
|
79
|
+
const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
|
|
80
|
+
const len0 = WASM_VECTOR_LEN;
|
|
81
|
+
const ret = wasm.openPdf(ptr0, len0);
|
|
82
|
+
if (ret[2]) {
|
|
83
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
84
|
+
}
|
|
85
|
+
return PdfHandle.__wrap(ret[0]);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @param {PdfHandle} handle
|
|
90
|
+
* @returns {Uint8Array}
|
|
91
|
+
*/
|
|
92
|
+
export function savePdf(handle) {
|
|
93
|
+
_assertClass(handle, PdfHandle);
|
|
94
|
+
const ret = wasm.savePdf(handle.__wbg_ptr);
|
|
95
|
+
if (ret[3]) {
|
|
96
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
97
|
+
}
|
|
98
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
99
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
100
|
+
return v1;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* @param {PdfHandle} handle
|
|
105
|
+
* @param {number} page_index
|
|
106
|
+
* @param {string} query
|
|
107
|
+
* @returns {any}
|
|
108
|
+
*/
|
|
109
|
+
export function searchText(handle, page_index, query) {
|
|
110
|
+
_assertClass(handle, PdfHandle);
|
|
111
|
+
const ptr0 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
112
|
+
const len0 = WASM_VECTOR_LEN;
|
|
113
|
+
const ret = wasm.searchText(handle.__wbg_ptr, page_index, ptr0, len0);
|
|
114
|
+
if (ret[2]) {
|
|
115
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
116
|
+
}
|
|
117
|
+
return takeFromExternrefTable0(ret[0]);
|
|
118
|
+
}
|
|
119
|
+
export function __wbg_Error_2e59b1b37a9a34c3(arg0, arg1) {
|
|
120
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
121
|
+
return ret;
|
|
122
|
+
}
|
|
123
|
+
export function __wbg_Number_e6ffdb596c888833(arg0) {
|
|
124
|
+
const ret = Number(arg0);
|
|
125
|
+
return ret;
|
|
126
|
+
}
|
|
127
|
+
export function __wbg_String_8564e559799eccda(arg0, arg1) {
|
|
128
|
+
const ret = String(arg1);
|
|
129
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
130
|
+
const len1 = WASM_VECTOR_LEN;
|
|
131
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
132
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
133
|
+
}
|
|
134
|
+
export function __wbg___wbindgen_bigint_get_as_i64_2c5082002e4826e2(arg0, arg1) {
|
|
135
|
+
const v = arg1;
|
|
136
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
137
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
138
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
139
|
+
}
|
|
140
|
+
export function __wbg___wbindgen_boolean_get_a86c216575a75c30(arg0) {
|
|
141
|
+
const v = arg0;
|
|
142
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
143
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
144
|
+
}
|
|
145
|
+
export function __wbg___wbindgen_debug_string_dd5d2d07ce9e6c57(arg0, arg1) {
|
|
146
|
+
const ret = debugString(arg1);
|
|
147
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
148
|
+
const len1 = WASM_VECTOR_LEN;
|
|
149
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
150
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
151
|
+
}
|
|
152
|
+
export function __wbg___wbindgen_in_4bd7a57e54337366(arg0, arg1) {
|
|
153
|
+
const ret = arg0 in arg1;
|
|
154
|
+
return ret;
|
|
155
|
+
}
|
|
156
|
+
export function __wbg___wbindgen_is_bigint_6c98f7e945dacdde(arg0) {
|
|
157
|
+
const ret = typeof(arg0) === 'bigint';
|
|
158
|
+
return ret;
|
|
159
|
+
}
|
|
160
|
+
export function __wbg___wbindgen_is_function_49868bde5eb1e745(arg0) {
|
|
161
|
+
const ret = typeof(arg0) === 'function';
|
|
162
|
+
return ret;
|
|
163
|
+
}
|
|
164
|
+
export function __wbg___wbindgen_is_object_40c5a80572e8f9d3(arg0) {
|
|
165
|
+
const val = arg0;
|
|
166
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
167
|
+
return ret;
|
|
168
|
+
}
|
|
169
|
+
export function __wbg___wbindgen_is_string_b29b5c5a8065ba1a(arg0) {
|
|
170
|
+
const ret = typeof(arg0) === 'string';
|
|
171
|
+
return ret;
|
|
172
|
+
}
|
|
173
|
+
export function __wbg___wbindgen_is_undefined_c0cca72b82b86f4d(arg0) {
|
|
174
|
+
const ret = arg0 === undefined;
|
|
175
|
+
return ret;
|
|
176
|
+
}
|
|
177
|
+
export function __wbg___wbindgen_jsval_eq_7d430e744a913d26(arg0, arg1) {
|
|
178
|
+
const ret = arg0 === arg1;
|
|
179
|
+
return ret;
|
|
180
|
+
}
|
|
181
|
+
export function __wbg___wbindgen_jsval_loose_eq_3a72ae764d46d944(arg0, arg1) {
|
|
182
|
+
const ret = arg0 == arg1;
|
|
183
|
+
return ret;
|
|
184
|
+
}
|
|
185
|
+
export function __wbg___wbindgen_number_get_7579aab02a8a620c(arg0, arg1) {
|
|
186
|
+
const obj = arg1;
|
|
187
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
188
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
189
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
190
|
+
}
|
|
191
|
+
export function __wbg___wbindgen_string_get_914df97fcfa788f2(arg0, arg1) {
|
|
192
|
+
const obj = arg1;
|
|
193
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
194
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
195
|
+
var len1 = WASM_VECTOR_LEN;
|
|
196
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
197
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
198
|
+
}
|
|
199
|
+
export function __wbg___wbindgen_throw_81fc77679af83bc6(arg0, arg1) {
|
|
200
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
201
|
+
}
|
|
202
|
+
export function __wbg_call_7f2987183bb62793() { return handleError(function (arg0, arg1) {
|
|
203
|
+
const ret = arg0.call(arg1);
|
|
204
|
+
return ret;
|
|
205
|
+
}, arguments); }
|
|
206
|
+
export function __wbg_done_547d467e97529006(arg0) {
|
|
207
|
+
const ret = arg0.done;
|
|
208
|
+
return ret;
|
|
209
|
+
}
|
|
210
|
+
export function __wbg_entries_616b1a459b85be0b(arg0) {
|
|
211
|
+
const ret = Object.entries(arg0);
|
|
212
|
+
return ret;
|
|
213
|
+
}
|
|
214
|
+
export function __wbg_get_4848e350b40afc16(arg0, arg1) {
|
|
215
|
+
const ret = arg0[arg1 >>> 0];
|
|
216
|
+
return ret;
|
|
217
|
+
}
|
|
218
|
+
export function __wbg_get_ed0642c4b9d31ddf() { return handleError(function (arg0, arg1) {
|
|
219
|
+
const ret = Reflect.get(arg0, arg1);
|
|
220
|
+
return ret;
|
|
221
|
+
}, arguments); }
|
|
222
|
+
export function __wbg_get_unchecked_7d7babe32e9e6a54(arg0, arg1) {
|
|
223
|
+
const ret = arg0[arg1 >>> 0];
|
|
224
|
+
return ret;
|
|
225
|
+
}
|
|
226
|
+
export function __wbg_get_with_ref_key_6412cf3094599694(arg0, arg1) {
|
|
227
|
+
const ret = arg0[arg1];
|
|
228
|
+
return ret;
|
|
229
|
+
}
|
|
230
|
+
export function __wbg_instanceof_ArrayBuffer_ff7c1337a5e3b33a(arg0) {
|
|
231
|
+
let result;
|
|
232
|
+
try {
|
|
233
|
+
result = arg0 instanceof ArrayBuffer;
|
|
234
|
+
} catch (_) {
|
|
235
|
+
result = false;
|
|
236
|
+
}
|
|
237
|
+
const ret = result;
|
|
238
|
+
return ret;
|
|
239
|
+
}
|
|
240
|
+
export function __wbg_instanceof_Map_a10a2795ef4bfe97(arg0) {
|
|
241
|
+
let result;
|
|
242
|
+
try {
|
|
243
|
+
result = arg0 instanceof Map;
|
|
244
|
+
} catch (_) {
|
|
245
|
+
result = false;
|
|
246
|
+
}
|
|
247
|
+
const ret = result;
|
|
248
|
+
return ret;
|
|
249
|
+
}
|
|
250
|
+
export function __wbg_instanceof_Uint8Array_4b8da683deb25d72(arg0) {
|
|
251
|
+
let result;
|
|
252
|
+
try {
|
|
253
|
+
result = arg0 instanceof Uint8Array;
|
|
254
|
+
} catch (_) {
|
|
255
|
+
result = false;
|
|
256
|
+
}
|
|
257
|
+
const ret = result;
|
|
258
|
+
return ret;
|
|
259
|
+
}
|
|
260
|
+
export function __wbg_isArray_db61795ad004c139(arg0) {
|
|
261
|
+
const ret = Array.isArray(arg0);
|
|
262
|
+
return ret;
|
|
263
|
+
}
|
|
264
|
+
export function __wbg_isSafeInteger_ea83862ba994770c(arg0) {
|
|
265
|
+
const ret = Number.isSafeInteger(arg0);
|
|
266
|
+
return ret;
|
|
267
|
+
}
|
|
268
|
+
export function __wbg_iterator_de403ef31815a3e6() {
|
|
269
|
+
const ret = Symbol.iterator;
|
|
270
|
+
return ret;
|
|
271
|
+
}
|
|
272
|
+
export function __wbg_length_0c32cb8543c8e4c8(arg0) {
|
|
273
|
+
const ret = arg0.length;
|
|
274
|
+
return ret;
|
|
275
|
+
}
|
|
276
|
+
export function __wbg_length_6e821edde497a532(arg0) {
|
|
277
|
+
const ret = arg0.length;
|
|
278
|
+
return ret;
|
|
279
|
+
}
|
|
280
|
+
export function __wbg_new_4f9fafbb3909af72() {
|
|
281
|
+
const ret = new Object();
|
|
282
|
+
return ret;
|
|
283
|
+
}
|
|
284
|
+
export function __wbg_new_a560378ea1240b14(arg0) {
|
|
285
|
+
const ret = new Uint8Array(arg0);
|
|
286
|
+
return ret;
|
|
287
|
+
}
|
|
288
|
+
export function __wbg_new_f3c9df4f38f3f798() {
|
|
289
|
+
const ret = new Array();
|
|
290
|
+
return ret;
|
|
291
|
+
}
|
|
292
|
+
export function __wbg_next_01132ed6134b8ef5(arg0) {
|
|
293
|
+
const ret = arg0.next;
|
|
294
|
+
return ret;
|
|
295
|
+
}
|
|
296
|
+
export function __wbg_next_b3713ec761a9dbfd() { return handleError(function (arg0) {
|
|
297
|
+
const ret = arg0.next();
|
|
298
|
+
return ret;
|
|
299
|
+
}, arguments); }
|
|
300
|
+
export function __wbg_prototypesetcall_3e05eb9545565046(arg0, arg1, arg2) {
|
|
301
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
302
|
+
}
|
|
303
|
+
export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
|
|
304
|
+
arg0[arg1] = arg2;
|
|
305
|
+
}
|
|
306
|
+
export function __wbg_set_6c60b2e8ad0e9383(arg0, arg1, arg2) {
|
|
307
|
+
arg0[arg1 >>> 0] = arg2;
|
|
308
|
+
}
|
|
309
|
+
export function __wbg_value_7f6052747ccf940f(arg0) {
|
|
310
|
+
const ret = arg0.value;
|
|
311
|
+
return ret;
|
|
312
|
+
}
|
|
313
|
+
export function __wbindgen_cast_0000000000000001(arg0) {
|
|
314
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
315
|
+
const ret = arg0;
|
|
316
|
+
return ret;
|
|
317
|
+
}
|
|
318
|
+
export function __wbindgen_cast_0000000000000002(arg0) {
|
|
319
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
320
|
+
const ret = arg0;
|
|
321
|
+
return ret;
|
|
322
|
+
}
|
|
323
|
+
export function __wbindgen_cast_0000000000000003(arg0, arg1) {
|
|
324
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
325
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
326
|
+
return ret;
|
|
327
|
+
}
|
|
328
|
+
export function __wbindgen_cast_0000000000000004(arg0) {
|
|
329
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
330
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
331
|
+
return ret;
|
|
332
|
+
}
|
|
333
|
+
export function __wbindgen_init_externref_table() {
|
|
334
|
+
const table = wasm.__wbindgen_externrefs;
|
|
335
|
+
const offset = table.grow(4);
|
|
336
|
+
table.set(0, undefined);
|
|
337
|
+
table.set(offset + 0, undefined);
|
|
338
|
+
table.set(offset + 1, null);
|
|
339
|
+
table.set(offset + 2, true);
|
|
340
|
+
table.set(offset + 3, false);
|
|
341
|
+
}
|
|
342
|
+
const PdfHandleFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
343
|
+
? { register: () => {}, unregister: () => {} }
|
|
344
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_pdfhandle_free(ptr >>> 0, 1));
|
|
345
|
+
|
|
346
|
+
function addToExternrefTable0(obj) {
|
|
347
|
+
const idx = wasm.__externref_table_alloc();
|
|
348
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
349
|
+
return idx;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
function _assertClass(instance, klass) {
|
|
353
|
+
if (!(instance instanceof klass)) {
|
|
354
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
function debugString(val) {
|
|
359
|
+
// primitive types
|
|
360
|
+
const type = typeof val;
|
|
361
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
362
|
+
return `${val}`;
|
|
363
|
+
}
|
|
364
|
+
if (type == 'string') {
|
|
365
|
+
return `"${val}"`;
|
|
366
|
+
}
|
|
367
|
+
if (type == 'symbol') {
|
|
368
|
+
const description = val.description;
|
|
369
|
+
if (description == null) {
|
|
370
|
+
return 'Symbol';
|
|
371
|
+
} else {
|
|
372
|
+
return `Symbol(${description})`;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
if (type == 'function') {
|
|
376
|
+
const name = val.name;
|
|
377
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
378
|
+
return `Function(${name})`;
|
|
379
|
+
} else {
|
|
380
|
+
return 'Function';
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
// objects
|
|
384
|
+
if (Array.isArray(val)) {
|
|
385
|
+
const length = val.length;
|
|
386
|
+
let debug = '[';
|
|
387
|
+
if (length > 0) {
|
|
388
|
+
debug += debugString(val[0]);
|
|
389
|
+
}
|
|
390
|
+
for(let i = 1; i < length; i++) {
|
|
391
|
+
debug += ', ' + debugString(val[i]);
|
|
392
|
+
}
|
|
393
|
+
debug += ']';
|
|
394
|
+
return debug;
|
|
395
|
+
}
|
|
396
|
+
// Test for built-in
|
|
397
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
398
|
+
let className;
|
|
399
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
400
|
+
className = builtInMatches[1];
|
|
401
|
+
} else {
|
|
402
|
+
// Failed to match the standard '[object ClassName]'
|
|
403
|
+
return toString.call(val);
|
|
404
|
+
}
|
|
405
|
+
if (className == 'Object') {
|
|
406
|
+
// we're a user defined class or Object
|
|
407
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
408
|
+
// easier than looping through ownProperties of `val`.
|
|
409
|
+
try {
|
|
410
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
411
|
+
} catch (_) {
|
|
412
|
+
return 'Object';
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
// errors
|
|
416
|
+
if (val instanceof Error) {
|
|
417
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
418
|
+
}
|
|
419
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
420
|
+
return className;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
424
|
+
ptr = ptr >>> 0;
|
|
425
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
let cachedDataViewMemory0 = null;
|
|
429
|
+
function getDataViewMemory0() {
|
|
430
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
431
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
432
|
+
}
|
|
433
|
+
return cachedDataViewMemory0;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
function getStringFromWasm0(ptr, len) {
|
|
437
|
+
ptr = ptr >>> 0;
|
|
438
|
+
return decodeText(ptr, len);
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
let cachedUint8ArrayMemory0 = null;
|
|
442
|
+
function getUint8ArrayMemory0() {
|
|
443
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
444
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
445
|
+
}
|
|
446
|
+
return cachedUint8ArrayMemory0;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
function handleError(f, args) {
|
|
450
|
+
try {
|
|
451
|
+
return f.apply(this, args);
|
|
452
|
+
} catch (e) {
|
|
453
|
+
const idx = addToExternrefTable0(e);
|
|
454
|
+
wasm.__wbindgen_exn_store(idx);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
function isLikeNone(x) {
|
|
459
|
+
return x === undefined || x === null;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
463
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
464
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
465
|
+
WASM_VECTOR_LEN = arg.length;
|
|
466
|
+
return ptr;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
470
|
+
if (realloc === undefined) {
|
|
471
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
472
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
473
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
474
|
+
WASM_VECTOR_LEN = buf.length;
|
|
475
|
+
return ptr;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
let len = arg.length;
|
|
479
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
480
|
+
|
|
481
|
+
const mem = getUint8ArrayMemory0();
|
|
482
|
+
|
|
483
|
+
let offset = 0;
|
|
484
|
+
|
|
485
|
+
for (; offset < len; offset++) {
|
|
486
|
+
const code = arg.charCodeAt(offset);
|
|
487
|
+
if (code > 0x7F) break;
|
|
488
|
+
mem[ptr + offset] = code;
|
|
489
|
+
}
|
|
490
|
+
if (offset !== len) {
|
|
491
|
+
if (offset !== 0) {
|
|
492
|
+
arg = arg.slice(offset);
|
|
493
|
+
}
|
|
494
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
495
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
496
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
497
|
+
|
|
498
|
+
offset += ret.written;
|
|
499
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
WASM_VECTOR_LEN = offset;
|
|
503
|
+
return ptr;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
function takeFromExternrefTable0(idx) {
|
|
507
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
508
|
+
wasm.__externref_table_dealloc(idx);
|
|
509
|
+
return value;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
513
|
+
cachedTextDecoder.decode();
|
|
514
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
515
|
+
let numBytesDecoded = 0;
|
|
516
|
+
function decodeText(ptr, len) {
|
|
517
|
+
numBytesDecoded += len;
|
|
518
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
519
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
520
|
+
cachedTextDecoder.decode();
|
|
521
|
+
numBytesDecoded = len;
|
|
522
|
+
}
|
|
523
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
const cachedTextEncoder = new TextEncoder();
|
|
527
|
+
|
|
528
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
529
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
530
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
531
|
+
view.set(buf);
|
|
532
|
+
return {
|
|
533
|
+
read: arg.length,
|
|
534
|
+
written: buf.length
|
|
535
|
+
};
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
let WASM_VECTOR_LEN = 0;
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
let wasm;
|
|
543
|
+
export function __wbg_set_wasm(val) {
|
|
544
|
+
wasm = val;
|
|
545
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_pdfhandle_free: (a: number, b: number) => void;
|
|
5
|
+
export const applyRedactions: (a: number, b: any) => [number, number, number];
|
|
6
|
+
export const extractText: (a: number, b: number) => [number, number, number];
|
|
7
|
+
export const getPageCount: (a: number) => number;
|
|
8
|
+
export const getPageSize: (a: number, b: number) => [number, number, number];
|
|
9
|
+
export const openPdf: (a: number, b: number) => [number, number, number];
|
|
10
|
+
export const savePdf: (a: number) => [number, number, number, number];
|
|
11
|
+
export const searchText: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
12
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
13
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
14
|
+
export const __wbindgen_exn_store: (a: number) => void;
|
|
15
|
+
export const __externref_table_alloc: () => number;
|
|
16
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
17
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
18
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
19
|
+
export const __wbindgen_start: () => void;
|