pdf-oxide-wasm 0.3.49 → 0.3.51
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/bundler/pdf_oxide.d.ts +218 -0
- package/bundler/pdf_oxide.js +1 -1
- package/bundler/pdf_oxide_bg.js +711 -0
- package/bundler/pdf_oxide_bg.wasm +0 -0
- package/bundler/pdf_oxide_bg.wasm.d.ts +34 -1
- package/nodejs/pdf_oxide.d.ts +218 -0
- package/nodejs/pdf_oxide.js +724 -0
- package/nodejs/pdf_oxide_bg.wasm +0 -0
- package/nodejs/pdf_oxide_bg.wasm.d.ts +34 -1
- package/package.json +1 -1
- package/web/pdf_oxide.d.ts +252 -1
- package/web/pdf_oxide.js +711 -0
- package/web/pdf_oxide_bg.wasm +0 -0
- package/web/pdf_oxide_bg.wasm.d.ts +34 -1
package/bundler/pdf_oxide.d.ts
CHANGED
|
@@ -45,6 +45,93 @@ export class ArtifactStyle {
|
|
|
45
45
|
constructor();
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* A parsed Document Security Store (`/DSS`, ISO 32000-2 §12.8.4.3).
|
|
50
|
+
* Count + index accessors mirror `WasmCertificate`'s flat shape
|
|
51
|
+
* (wasm-bindgen cannot return `Uint8Array[]` directly).
|
|
52
|
+
*/
|
|
53
|
+
export class Dss {
|
|
54
|
+
private constructor();
|
|
55
|
+
free(): void;
|
|
56
|
+
[Symbol.dispose](): void;
|
|
57
|
+
/**
|
|
58
|
+
* The `i`-th DER certificate, or `undefined` if out of range.
|
|
59
|
+
*/
|
|
60
|
+
getCert(i: number): Uint8Array | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* The `i`-th DER CRL, or `undefined` if out of range.
|
|
63
|
+
*/
|
|
64
|
+
getCrl(i: number): Uint8Array | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* The `i`-th DER OCSP response, or `undefined` if out of range.
|
|
67
|
+
*/
|
|
68
|
+
getOcsp(i: number): Uint8Array | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* Number of DER X.509 certificates in the DSS.
|
|
71
|
+
*/
|
|
72
|
+
readonly certCount: number;
|
|
73
|
+
/**
|
|
74
|
+
* Number of DER CRLs in the DSS.
|
|
75
|
+
*/
|
|
76
|
+
readonly crlCount: number;
|
|
77
|
+
/**
|
|
78
|
+
* Number of DER OCSP responses in the DSS.
|
|
79
|
+
*/
|
|
80
|
+
readonly ocspCount: number;
|
|
81
|
+
/**
|
|
82
|
+
* Per-signature VRI keys (uppercase-hex SHA-1 of `/Contents`).
|
|
83
|
+
*/
|
|
84
|
+
readonly vri: string[];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* PAdES baseline level. Frozen integer mapping (BB=0, BT=1, BLt=2,
|
|
89
|
+
* BLta=3) shared with the C ABI and every binding — never renumber.
|
|
90
|
+
*/
|
|
91
|
+
export enum PadesLevel {
|
|
92
|
+
/**
|
|
93
|
+
* B-B: signed attrs incl. the ESS signing-certificate-v2.
|
|
94
|
+
*/
|
|
95
|
+
BB = 0,
|
|
96
|
+
/**
|
|
97
|
+
* B-T: B-B + an RFC 3161 signature-time-stamp unsigned attr.
|
|
98
|
+
*/
|
|
99
|
+
BT = 1,
|
|
100
|
+
/**
|
|
101
|
+
* B-LT: B-T + a Document Security Store (DSS/VRI).
|
|
102
|
+
*/
|
|
103
|
+
BLt = 2,
|
|
104
|
+
/**
|
|
105
|
+
* B-LTA: B-LT + a document-scoped `/DocTimeStamp`.
|
|
106
|
+
*/
|
|
107
|
+
BLta = 3,
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Offline B-LT validation material (DER certs / CRLs / OCSP
|
|
112
|
+
* responses). Build with `new()` then `addCert`/`addCrl`/`addOcsp`.
|
|
113
|
+
*/
|
|
114
|
+
export class RevocationMaterial {
|
|
115
|
+
free(): void;
|
|
116
|
+
[Symbol.dispose](): void;
|
|
117
|
+
/**
|
|
118
|
+
* Add a DER X.509 certificate.
|
|
119
|
+
*/
|
|
120
|
+
addCert(der: Uint8Array): void;
|
|
121
|
+
/**
|
|
122
|
+
* Add a DER CRL.
|
|
123
|
+
*/
|
|
124
|
+
addCrl(der: Uint8Array): void;
|
|
125
|
+
/**
|
|
126
|
+
* Add a DER OCSP response.
|
|
127
|
+
*/
|
|
128
|
+
addOcsp(der: Uint8Array): void;
|
|
129
|
+
/**
|
|
130
|
+
* Create an empty revocation-material set.
|
|
131
|
+
*/
|
|
132
|
+
constructor();
|
|
133
|
+
}
|
|
134
|
+
|
|
48
135
|
/**
|
|
49
136
|
* WASM handle to a streaming-table building session. Created by
|
|
50
137
|
* `FluentPageBuilder.streamingTable()`; rows are pushed via `pushRow`,
|
|
@@ -703,6 +790,11 @@ export class WasmPdf {
|
|
|
703
790
|
export class WasmPdfDocument {
|
|
704
791
|
free(): void;
|
|
705
792
|
[Symbol.dispose](): void;
|
|
793
|
+
/**
|
|
794
|
+
* Queue an explicit destructive redaction rectangle on a page
|
|
795
|
+
* (page user space; `fill` is an optional DeviceRGB `[r,g,b]`).
|
|
796
|
+
*/
|
|
797
|
+
addRedaction(page: number, x0: number, y0: number, x1: number, y1: number, fill?: Float32Array | null): void;
|
|
706
798
|
/**
|
|
707
799
|
* Apply all redactions in the document.
|
|
708
800
|
*/
|
|
@@ -711,6 +803,11 @@ export class WasmPdfDocument {
|
|
|
711
803
|
* Apply redactions on a page (removes redacted content permanently).
|
|
712
804
|
*/
|
|
713
805
|
applyPageRedactions(page_index: number): void;
|
|
806
|
+
/**
|
|
807
|
+
* Destructively apply all queued redactions (true content removal,
|
|
808
|
+
* ISO 32000-1:2008 §12.5.6.23). Returns a `RedactionReport` object.
|
|
809
|
+
*/
|
|
810
|
+
applyRedactionsDestructive(scrub_metadata?: boolean | null): any;
|
|
714
811
|
/**
|
|
715
812
|
* Authenticate with a password to decrypt an encrypted PDF.
|
|
716
813
|
*
|
|
@@ -718,6 +815,15 @@ export class WasmPdfDocument {
|
|
|
718
815
|
* @returns true if authentication succeeded
|
|
719
816
|
*/
|
|
720
817
|
authenticate(password: string): boolean;
|
|
818
|
+
/**
|
|
819
|
+
* Cheap per-page text-vs-OCR classification → JSON
|
|
820
|
+
* `DocumentClassification`.
|
|
821
|
+
*/
|
|
822
|
+
classifyDocument(): string;
|
|
823
|
+
/**
|
|
824
|
+
* Cheap per-page classification → JSON `PageClassification`.
|
|
825
|
+
*/
|
|
826
|
+
classifyPage(page_index: number): string;
|
|
721
827
|
/**
|
|
722
828
|
* Clear all pending erase operations for a page.
|
|
723
829
|
*/
|
|
@@ -737,6 +843,11 @@ export class WasmPdfDocument {
|
|
|
737
843
|
* Delete a page by index (0-based).
|
|
738
844
|
*/
|
|
739
845
|
deletePage(index: number): void;
|
|
846
|
+
/**
|
|
847
|
+
* The document's Document Security Store (`/DSS`) as a `Dss`, or
|
|
848
|
+
* `undefined` if absent. Mirrors Rust `signatures::read_dss`.
|
|
849
|
+
*/
|
|
850
|
+
dss(): Dss | undefined;
|
|
740
851
|
/**
|
|
741
852
|
* Deprecated: Use eraseFooter instead.
|
|
742
853
|
*/
|
|
@@ -832,6 +943,12 @@ export class WasmPdfDocument {
|
|
|
832
943
|
* @returns Array of path objects
|
|
833
944
|
*/
|
|
834
945
|
extractLines(page_index: number, region?: Float32Array | null): any;
|
|
946
|
+
/**
|
|
947
|
+
* Rich per-page extraction → JSON `PageExtraction` (per-region
|
|
948
|
+
* bbox + typed reason). `optionsJson` is `{}`-tolerant
|
|
949
|
+
* `AutoExtractOptions`; undefined/empty → defaults.
|
|
950
|
+
*/
|
|
951
|
+
extractPageAuto(page_index: number, options_json?: string | null): string;
|
|
835
952
|
/**
|
|
836
953
|
* Extract complete page text data in a single call.
|
|
837
954
|
*
|
|
@@ -888,6 +1005,11 @@ export class WasmPdfDocument {
|
|
|
888
1005
|
* @param region - Optional [x, y, width, height] to filter by
|
|
889
1006
|
*/
|
|
890
1007
|
extractText(page_index: number, region: any): string;
|
|
1008
|
+
/**
|
|
1009
|
+
* One-shot auto text extraction — graceful native fallback (never
|
|
1010
|
+
* the opaque OCR error #513).
|
|
1011
|
+
*/
|
|
1012
|
+
extractTextAuto(page_index: number): string;
|
|
891
1013
|
/**
|
|
892
1014
|
* Extract text lines from a page.
|
|
893
1015
|
*
|
|
@@ -1051,6 +1173,10 @@ export class WasmPdfDocument {
|
|
|
1051
1173
|
* Get the rotation of a page in degrees (0, 90, 180, 270).
|
|
1052
1174
|
*/
|
|
1053
1175
|
pageRotation(page_index: number): number;
|
|
1176
|
+
/**
|
|
1177
|
+
* Number of redaction regions queued for `page`.
|
|
1178
|
+
*/
|
|
1179
|
+
redactionCount(page: number): number;
|
|
1054
1180
|
/**
|
|
1055
1181
|
* Identify and remove both headers and footers.
|
|
1056
1182
|
*
|
|
@@ -1104,6 +1230,12 @@ export class WasmPdfDocument {
|
|
|
1104
1230
|
* Rotate a page by the given degrees (adds to current rotation).
|
|
1105
1231
|
*/
|
|
1106
1232
|
rotatePage(page_index: number, degrees: number): void;
|
|
1233
|
+
/**
|
|
1234
|
+
* Standalone document sanitization (#231 T10): strip `/Info`,
|
|
1235
|
+
* catalog XMP `/Metadata`, document JavaScript and embedded files
|
|
1236
|
+
* without geometric redaction. Returns a `RedactionReport` object.
|
|
1237
|
+
*/
|
|
1238
|
+
sanitizeDocument(scrub_metadata?: boolean | null, remove_javascript?: boolean | null, remove_embedded_files?: boolean | null): any;
|
|
1107
1239
|
/**
|
|
1108
1240
|
* Save all edits and return the resulting PDF as bytes.
|
|
1109
1241
|
*
|
|
@@ -1374,6 +1506,12 @@ export class WasmSignature {
|
|
|
1374
1506
|
* `/Location` entry from the signature dictionary, if present.
|
|
1375
1507
|
*/
|
|
1376
1508
|
readonly location: string | undefined;
|
|
1509
|
+
/**
|
|
1510
|
+
* PAdES baseline level from this signature's CMS attributes alone
|
|
1511
|
+
* (`BB` vs `BT`). `BLt` additionally needs the document `/DSS` —
|
|
1512
|
+
* read it via `WasmPdfDocument.dss()` and re-classify there.
|
|
1513
|
+
*/
|
|
1514
|
+
readonly padesLevel: PadesLevel;
|
|
1377
1515
|
/**
|
|
1378
1516
|
* `/Reason` entry from the signature dictionary, if present.
|
|
1379
1517
|
*/
|
|
@@ -1437,6 +1575,23 @@ export class WasmTimestamp {
|
|
|
1437
1575
|
readonly tsaName: string;
|
|
1438
1576
|
}
|
|
1439
1577
|
|
|
1578
|
+
/**
|
|
1579
|
+
* A CycloneDX 1.6 Cryptographic Bill of Materials (JSON string) of the
|
|
1580
|
+
* algorithms exercised so far this process (#230 Phase F).
|
|
1581
|
+
*/
|
|
1582
|
+
export function cryptoCbom(): string;
|
|
1583
|
+
|
|
1584
|
+
/**
|
|
1585
|
+
* The cryptographic algorithm tokens exercised so far this process
|
|
1586
|
+
* (governance report), as a JSON string array.
|
|
1587
|
+
*/
|
|
1588
|
+
export function cryptoInventory(): any;
|
|
1589
|
+
|
|
1590
|
+
/**
|
|
1591
|
+
* The active crypto policy as its canonical grammar string.
|
|
1592
|
+
*/
|
|
1593
|
+
export function cryptoPolicy(): string;
|
|
1594
|
+
|
|
1440
1595
|
/**
|
|
1441
1596
|
* Disable all pdf_oxide log output — convenience wrapper for
|
|
1442
1597
|
* `setLogLevel("off")`.
|
|
@@ -1457,6 +1612,50 @@ export function generateBarcodeSvg(barcode_type: number, data: string): string;
|
|
|
1457
1612
|
*/
|
|
1458
1613
|
export function generateQrSvg(data: string, error_correction: number, size: number): string;
|
|
1459
1614
|
|
|
1615
|
+
/**
|
|
1616
|
+
* Whether `pdf_data` carries a document-scoped RFC 3161
|
|
1617
|
+
* `/DocTimeStamp` archival timestamp (PAdES-B-LTA). This is the
|
|
1618
|
+
* document-level reader signal; a `WasmSignature`'s `padesLevel`
|
|
1619
|
+
* getter is signature-scoped and tops out at B-LT by design.
|
|
1620
|
+
*/
|
|
1621
|
+
export function hasDocumentTimestamp(pdf_data: Uint8Array): boolean;
|
|
1622
|
+
|
|
1623
|
+
/**
|
|
1624
|
+
* #519: Air-gapped OCR model manifest — JSON (detector + every
|
|
1625
|
+
* supported language's cache filenames and source URLs).
|
|
1626
|
+
*
|
|
1627
|
+
* WASM provisioning is **host-side**: browser/WASM has no filesystem
|
|
1628
|
+
* or network-to-disk, so a download-to-cache prefetch cannot run
|
|
1629
|
+
* here. This manifest is informational — it lets the JS host learn
|
|
1630
|
+
* which model files/URLs to fetch and bundle (or ship out of band)
|
|
1631
|
+
* before driving OCR. There is intentionally no `prefetchModels` in
|
|
1632
|
+
* the WASM surface (see `prefetchAvailable`, which always returns
|
|
1633
|
+
* `false`).
|
|
1634
|
+
*/
|
|
1635
|
+
export function modelManifest(): string;
|
|
1636
|
+
|
|
1637
|
+
/**
|
|
1638
|
+
* Plan a bookmark split without producing PDFs. Returns a JSON array
|
|
1639
|
+
* of segment objects (`index, startPage…` shape from
|
|
1640
|
+
* `BookmarkSegment`). `level`: 0 = all depths, 1 = top-level.
|
|
1641
|
+
*/
|
|
1642
|
+
export function planSplitByBookmarks(src_bytes: Uint8Array, title_prefix: string | null | undefined, ignore_case: boolean, level: number, include_front_matter: boolean): any;
|
|
1643
|
+
|
|
1644
|
+
/**
|
|
1645
|
+
* #519: Whether this build can download OCR models to a local cache.
|
|
1646
|
+
* Always `false` in WASM — provisioning is host-side (see
|
|
1647
|
+
* `modelManifest`).
|
|
1648
|
+
*/
|
|
1649
|
+
export function prefetchAvailable(): boolean;
|
|
1650
|
+
|
|
1651
|
+
/**
|
|
1652
|
+
* Install the process-wide runtime crypto policy from its grammar
|
|
1653
|
+
* string (`"compat"|"strict"|"fips-strict"[;…]`). Fail-closed:
|
|
1654
|
+
* throws on an unparseable spec (policy NOT installed) or if a
|
|
1655
|
+
* policy is already set. Default (never set) is `compat`.
|
|
1656
|
+
*/
|
|
1657
|
+
export function setCryptoPolicy(spec: string): void;
|
|
1658
|
+
|
|
1460
1659
|
/**
|
|
1461
1660
|
* Set the maximum log level for pdf_oxide messages.
|
|
1462
1661
|
*
|
|
@@ -1483,3 +1682,22 @@ export function setLogLevel(level: string): void;
|
|
|
1483
1682
|
* `Certificate.loadPkcs12`).
|
|
1484
1683
|
*/
|
|
1485
1684
|
export function signPdfBytes(pdf_data: Uint8Array, cert: WasmCertificate, reason?: string | null, location?: string | null): Uint8Array;
|
|
1685
|
+
|
|
1686
|
+
/**
|
|
1687
|
+
* Sign raw PDF bytes at a PAdES baseline level and return the signed
|
|
1688
|
+
* PDF as a `Uint8Array`.
|
|
1689
|
+
*
|
|
1690
|
+
* `level` `BLTA` is reserved (→ error). For `BT`/`BLt` pass a
|
|
1691
|
+
* pre-fetched RFC 3161 `timestampToken` (DER): WASM intentionally
|
|
1692
|
+
* omits the online TSA client (same `ureq`-incompat carve-out as
|
|
1693
|
+
* v0.3.38) — without a token the core fail-closes with `Unsupported`.
|
|
1694
|
+
* `revocation` supplies the B-LT DSS material.
|
|
1695
|
+
*/
|
|
1696
|
+
export function signPdfBytesPades(pdf_data: Uint8Array, cert: WasmCertificate, level: PadesLevel, timestamp_token?: Uint8Array | null, revocation?: RevocationMaterial | null, reason?: string | null, location?: string | null): Uint8Array;
|
|
1697
|
+
|
|
1698
|
+
/**
|
|
1699
|
+
* Split at bookmark boundaries. Returns a JSON array of
|
|
1700
|
+
* `[segment, bytes]` pairs (bytes as a number array; source
|
|
1701
|
+
* unmodified).
|
|
1702
|
+
*/
|
|
1703
|
+
export function splitByBookmarks(src_bytes: Uint8Array, title_prefix: string | null | undefined, ignore_case: boolean, level: number, include_front_matter: boolean): any;
|
package/bundler/pdf_oxide.js
CHANGED
|
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./pdf_oxide_bg.js";
|
|
|
5
5
|
__wbg_set_wasm(wasm);
|
|
6
6
|
|
|
7
7
|
export {
|
|
8
|
-
Align, ArtifactStyle, StreamingTable, WasmArtifact, WasmCertificate, WasmDocumentBuilder, WasmEmbeddedFont, WasmFluentPageBuilder, WasmFooter, WasmHeader, WasmOcrConfig, WasmOcrEngine, WasmPageTemplate, WasmPdf, WasmPdfDocument, WasmPdfPageRegion, WasmSignature, WasmTimestamp, disableLogging, generateBarcodeSvg, generateQrSvg, setLogLevel, signPdfBytes
|
|
8
|
+
Align, ArtifactStyle, Dss, PadesLevel, RevocationMaterial, StreamingTable, WasmArtifact, WasmCertificate, WasmDocumentBuilder, WasmEmbeddedFont, WasmFluentPageBuilder, WasmFooter, WasmHeader, WasmOcrConfig, WasmOcrEngine, WasmPageTemplate, WasmPdf, WasmPdfDocument, WasmPdfPageRegion, WasmSignature, WasmTimestamp, cryptoCbom, cryptoInventory, cryptoPolicy, disableLogging, generateBarcodeSvg, generateQrSvg, hasDocumentTimestamp, modelManifest, planSplitByBookmarks, prefetchAvailable, setCryptoPolicy, setLogLevel, signPdfBytes, signPdfBytesPades, splitByBookmarks
|
|
9
9
|
} from "./pdf_oxide_bg.js";
|