pdf-oxide-wasm 0.3.39 → 0.3.40

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.
@@ -60,6 +60,10 @@ export class StreamingTable {
60
60
  private constructor();
61
61
  free(): void;
62
62
  [Symbol.dispose](): void;
63
+ /**
64
+ * Number of fully-completed batches waiting for finish().
65
+ */
66
+ batchCount(): number;
63
67
  /**
64
68
  * Number of columns configured on this streaming table.
65
69
  */
@@ -71,15 +75,25 @@ export class StreamingTable {
71
75
  * throws.
72
76
  */
73
77
  finish(): void;
78
+ /**
79
+ * Explicitly flush the current batch to `completed_batches`.
80
+ * Called automatically when `batch_size` rows accumulate.
81
+ */
82
+ flush(): void;
83
+ /**
84
+ * Number of rows in the current (not-yet-flushed) batch.
85
+ */
86
+ pendingRowCount(): number;
74
87
  /**
75
88
  * Push one row as an array of cell strings (all rowspan=1). Returns an
76
89
  * error if the table has already been finished or if the row's cell count
77
- * does not match the column count.
90
+ * does not match the column count. Auto-flushes the batch when full.
78
91
  */
79
92
  pushRow(cells: string[]): void;
80
93
  /**
81
94
  * Push one row with per-cell rowspan values. `cells` is a JS array of
82
95
  * `[text, rowspan]` two-element arrays. `rowspan == 1` is a normal cell.
96
+ * Auto-flushes the batch when full.
83
97
  */
84
98
  pushRowSpan(cells: any): void;
85
99
  }
@@ -450,10 +464,18 @@ export class WasmFluentPageBuilder {
450
464
  * Draw a straight line with explicit stroke width and RGB colour.
451
465
  */
452
466
  strokeLine(x1: number, y1: number, x2: number, y2: number, width: number, r: number, g: number, b: number): void;
467
+ /**
468
+ * Draw a dashed line. `dash` is alternating on/off lengths in points; `phase` is the starting offset.
469
+ */
470
+ strokeLineDashed(x1: number, y1: number, x2: number, y2: number, width: number, r: number, g: number, b: number, dash: Float32Array, phase: number): void;
453
471
  /**
454
472
  * Draw a stroked rectangle with explicit stroke width and RGB colour.
455
473
  */
456
474
  strokeRect(x: number, y: number, w: number, h: number, width: number, r: number, g: number, b: number): void;
475
+ /**
476
+ * Draw a dashed rectangle border. `dash` is alternating on/off lengths in points; `phase` is the starting offset.
477
+ */
478
+ strokeRectDashed(x: number, y: number, w: number, h: number, width: number, r: number, g: number, b: number, dash: Float32Array, phase: number): void;
457
479
  /**
458
480
  * Render a buffered table from a JS object:
459
481
  *
@@ -899,6 +921,12 @@ export class WasmPdfDocument {
899
921
  * Flatten annotations on a page into the page content.
900
922
  */
901
923
  flattenPageAnnotations(page_index: number): void;
924
+ /**
925
+ * Create a flattened PDF where each page is rendered as an image.
926
+ * Burns in all annotations, form fields, and overlays.
927
+ * Returns the flattened PDF as bytes.
928
+ */
929
+ flattenToImages(dpi?: number | null): Uint8Array;
902
930
  /**
903
931
  * Return warnings collected during the last form-flattening save.
904
932
  *
@@ -1031,6 +1059,16 @@ export class WasmPdfDocument {
1031
1059
  * @param threshold - Fraction of pages (0.0-1.0) where text must repeat (heuristic mode)
1032
1060
  */
1033
1061
  removeHeaders(threshold: number): number;
1062
+ /**
1063
+ * Render a page to an image (PNG).
1064
+ *
1065
+ * Requires the `rendering` feature.
1066
+ *
1067
+ * @param page_index - Zero-based page number
1068
+ * @param dpi - Dots per inch (default: 150)
1069
+ * @returns Uint8Array containing the PNG image data
1070
+ */
1071
+ renderPage(page_index: number, dpi?: number | null): Uint8Array;
1034
1072
  /**
1035
1073
  * Reposition an image on a page.
1036
1074
  */
@@ -1254,10 +1292,9 @@ export class WasmPdfPageRegion {
1254
1292
 
1255
1293
  /**
1256
1294
  * A single existing PDF signature surfaced by
1257
- * `WasmPdfDocument.signatures()`. `verify()` runs the RSA-PKCS#1 v1.5
1258
- * signer-attributes check; `verifyDetached()` adds the
1259
- * `messageDigest` content-hash check. RSA-PSS / ECDSA signers still
1260
- * throw an `UnsupportedFeature`-mapped JS error.
1295
+ * `WasmPdfDocument.signatures()`. `verify()` runs the signer-attributes
1296
+ * check; `verifyDetached()` adds the `messageDigest` content-hash check.
1297
+ * Supported: RSA-PKCS#1 v1.5, RSA-PSS, ECDSA P-256/P-384.
1261
1298
  */
1262
1299
  export class WasmSignature {
1263
1300
  private constructor();
@@ -1335,7 +1372,11 @@ export class WasmTimestamp {
1335
1372
  */
1336
1373
  static parse(data: Uint8Array): WasmTimestamp;
1337
1374
  /**
1338
- * Cryptographic verify not yet implemented.
1375
+ * Cryptographically verify this TimeStampToken.
1376
+ *
1377
+ * Returns `true` when the TSA's signature and `messageDigest` both pass.
1378
+ * Returns `false` when a crypto check fails (tampered token or wrong key).
1379
+ * Throws when the token is not CMS-wrapped or uses an unsupported algorithm.
1339
1380
  */
1340
1381
  verify(): boolean;
1341
1382
  /**
@@ -115,6 +115,14 @@ export class StreamingTable {
115
115
  const ptr = this.__destroy_into_raw();
116
116
  wasm.__wbg_streamingtable_free(ptr, 0);
117
117
  }
118
+ /**
119
+ * Number of fully-completed batches waiting for finish().
120
+ * @returns {number}
121
+ */
122
+ batchCount() {
123
+ const ret = wasm.streamingtable_batchCount(this.__wbg_ptr);
124
+ return ret >>> 0;
125
+ }
118
126
  /**
119
127
  * Number of columns configured on this streaming table.
120
128
  * @returns {number}
@@ -142,10 +150,25 @@ export class StreamingTable {
142
150
  wasm.__wbindgen_add_to_stack_pointer(16);
143
151
  }
144
152
  }
153
+ /**
154
+ * Explicitly flush the current batch to `completed_batches`.
155
+ * Called automatically when `batch_size` rows accumulate.
156
+ */
157
+ flush() {
158
+ wasm.streamingtable_flush(this.__wbg_ptr);
159
+ }
160
+ /**
161
+ * Number of rows in the current (not-yet-flushed) batch.
162
+ * @returns {number}
163
+ */
164
+ pendingRowCount() {
165
+ const ret = wasm.streamingtable_pendingRowCount(this.__wbg_ptr);
166
+ return ret >>> 0;
167
+ }
145
168
  /**
146
169
  * Push one row as an array of cell strings (all rowspan=1). Returns an
147
170
  * error if the table has already been finished or if the row's cell count
148
- * does not match the column count.
171
+ * does not match the column count. Auto-flushes the batch when full.
149
172
  * @param {string[]} cells
150
173
  */
151
174
  pushRow(cells) {
@@ -166,6 +189,7 @@ export class StreamingTable {
166
189
  /**
167
190
  * Push one row with per-cell rowspan values. `cells` is a JS array of
168
191
  * `[text, rowspan]` two-element arrays. `rowspan == 1` is a normal cell.
192
+ * Auto-flushes the batch when full.
169
193
  * @param {any} cells
170
194
  */
171
195
  pushRowSpan(cells) {
@@ -1943,6 +1967,34 @@ export class WasmFluentPageBuilder {
1943
1967
  wasm.__wbindgen_add_to_stack_pointer(16);
1944
1968
  }
1945
1969
  }
1970
+ /**
1971
+ * Draw a dashed line. `dash` is alternating on/off lengths in points; `phase` is the starting offset.
1972
+ * @param {number} x1
1973
+ * @param {number} y1
1974
+ * @param {number} x2
1975
+ * @param {number} y2
1976
+ * @param {number} width
1977
+ * @param {number} r
1978
+ * @param {number} g
1979
+ * @param {number} b
1980
+ * @param {Float32Array} dash
1981
+ * @param {number} phase
1982
+ */
1983
+ strokeLineDashed(x1, y1, x2, y2, width, r, g, b, dash, phase) {
1984
+ try {
1985
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1986
+ const ptr0 = passArrayF32ToWasm0(dash, wasm.__wbindgen_export);
1987
+ const len0 = WASM_VECTOR_LEN;
1988
+ wasm.wasmfluentpagebuilder_strokeLineDashed(retptr, this.__wbg_ptr, x1, y1, x2, y2, width, r, g, b, ptr0, len0, phase);
1989
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1990
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1991
+ if (r1) {
1992
+ throw takeObject(r0);
1993
+ }
1994
+ } finally {
1995
+ wasm.__wbindgen_add_to_stack_pointer(16);
1996
+ }
1997
+ }
1946
1998
  /**
1947
1999
  * Draw a stroked rectangle with explicit stroke width and RGB colour.
1948
2000
  * @param {number} x
@@ -1967,6 +2019,34 @@ export class WasmFluentPageBuilder {
1967
2019
  wasm.__wbindgen_add_to_stack_pointer(16);
1968
2020
  }
1969
2021
  }
2022
+ /**
2023
+ * Draw a dashed rectangle border. `dash` is alternating on/off lengths in points; `phase` is the starting offset.
2024
+ * @param {number} x
2025
+ * @param {number} y
2026
+ * @param {number} w
2027
+ * @param {number} h
2028
+ * @param {number} width
2029
+ * @param {number} r
2030
+ * @param {number} g
2031
+ * @param {number} b
2032
+ * @param {Float32Array} dash
2033
+ * @param {number} phase
2034
+ */
2035
+ strokeRectDashed(x, y, w, h, width, r, g, b, dash, phase) {
2036
+ try {
2037
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2038
+ const ptr0 = passArrayF32ToWasm0(dash, wasm.__wbindgen_export);
2039
+ const len0 = WASM_VECTOR_LEN;
2040
+ wasm.wasmfluentpagebuilder_strokeRectDashed(retptr, this.__wbg_ptr, x, y, w, h, width, r, g, b, ptr0, len0, phase);
2041
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2042
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2043
+ if (r1) {
2044
+ throw takeObject(r0);
2045
+ }
2046
+ } finally {
2047
+ wasm.__wbindgen_add_to_stack_pointer(16);
2048
+ }
2049
+ }
1970
2050
  /**
1971
2051
  * Render a buffered table from a JS object:
1972
2052
  *
@@ -3539,6 +3619,31 @@ export class WasmPdfDocument {
3539
3619
  wasm.__wbindgen_add_to_stack_pointer(16);
3540
3620
  }
3541
3621
  }
3622
+ /**
3623
+ * Create a flattened PDF where each page is rendered as an image.
3624
+ * Burns in all annotations, form fields, and overlays.
3625
+ * Returns the flattened PDF as bytes.
3626
+ * @param {number | null} [dpi]
3627
+ * @returns {Uint8Array}
3628
+ */
3629
+ flattenToImages(dpi) {
3630
+ try {
3631
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3632
+ wasm.wasmpdfdocument_flattenToImages(retptr, this.__wbg_ptr, isLikeNone(dpi) ? 0x100000001 : (dpi) >>> 0);
3633
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3634
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3635
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3636
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3637
+ if (r3) {
3638
+ throw takeObject(r2);
3639
+ }
3640
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
3641
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
3642
+ return v1;
3643
+ } finally {
3644
+ wasm.__wbindgen_add_to_stack_pointer(16);
3645
+ }
3646
+ }
3542
3647
  /**
3543
3648
  * Return warnings collected during the last form-flattening save.
3544
3649
  *
@@ -3977,6 +4082,36 @@ export class WasmPdfDocument {
3977
4082
  wasm.__wbindgen_add_to_stack_pointer(16);
3978
4083
  }
3979
4084
  }
4085
+ /**
4086
+ * Render a page to an image (PNG).
4087
+ *
4088
+ * Requires the `rendering` feature.
4089
+ *
4090
+ * @param page_index - Zero-based page number
4091
+ * @param dpi - Dots per inch (default: 150)
4092
+ * @returns Uint8Array containing the PNG image data
4093
+ * @param {number} page_index
4094
+ * @param {number | null} [dpi]
4095
+ * @returns {Uint8Array}
4096
+ */
4097
+ renderPage(page_index, dpi) {
4098
+ try {
4099
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4100
+ wasm.wasmpdfdocument_renderPage(retptr, this.__wbg_ptr, page_index, isLikeNone(dpi) ? 0x100000001 : (dpi) >>> 0);
4101
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4102
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4103
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
4104
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
4105
+ if (r3) {
4106
+ throw takeObject(r2);
4107
+ }
4108
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
4109
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
4110
+ return v1;
4111
+ } finally {
4112
+ wasm.__wbindgen_add_to_stack_pointer(16);
4113
+ }
4114
+ }
3980
4115
  /**
3981
4116
  * Reposition an image on a page.
3982
4117
  * @param {number} page_index
@@ -5025,10 +5160,9 @@ if (Symbol.dispose) WasmPdfPageRegion.prototype[Symbol.dispose] = WasmPdfPageReg
5025
5160
 
5026
5161
  /**
5027
5162
  * A single existing PDF signature surfaced by
5028
- * `WasmPdfDocument.signatures()`. `verify()` runs the RSA-PKCS#1 v1.5
5029
- * signer-attributes check; `verifyDetached()` adds the
5030
- * `messageDigest` content-hash check. RSA-PSS / ECDSA signers still
5031
- * throw an `UnsupportedFeature`-mapped JS error.
5163
+ * `WasmPdfDocument.signatures()`. `verify()` runs the signer-attributes
5164
+ * check; `verifyDetached()` adds the `messageDigest` content-hash check.
5165
+ * Supported: RSA-PKCS#1 v1.5, RSA-PSS, ECDSA P-256/P-384.
5032
5166
  */
5033
5167
  export class WasmSignature {
5034
5168
  static __wrap(ptr) {
@@ -5359,7 +5493,11 @@ export class WasmTimestamp {
5359
5493
  }
5360
5494
  }
5361
5495
  /**
5362
- * Cryptographic verify not yet implemented.
5496
+ * Cryptographically verify this TimeStampToken.
5497
+ *
5498
+ * Returns `true` when the TSA's signature and `messageDigest` both pass.
5499
+ * Returns `false` when a crypto check fails (tampered token or wrong key).
5500
+ * Throws when the token is not CMS-wrapped or uses an unsupported algorithm.
5363
5501
  * @returns {boolean}
5364
5502
  */
5365
5503
  verify() {
Binary file
@@ -17,8 +17,11 @@ export const __wbg_wasmsignature_free: (a: number, b: number) => void;
17
17
  export const __wbg_wasmtimestamp_free: (a: number, b: number) => void;
18
18
  export const setLogLevel: (a: number, b: number, c: number) => void;
19
19
  export const signPdfBytes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
20
+ export const streamingtable_batchCount: (a: number) => number;
20
21
  export const streamingtable_columnCount: (a: number) => number;
21
22
  export const streamingtable_finish: (a: number, b: number) => void;
23
+ export const streamingtable_flush: (a: number) => void;
24
+ export const streamingtable_pendingRowCount: (a: number) => number;
22
25
  export const streamingtable_pushRow: (a: number, b: number, c: number, d: number) => void;
23
26
  export const streamingtable_pushRowSpan: (a: number, b: number, c: number) => void;
24
27
  export const wasmartifact_center: (a: number, b: number) => number;
@@ -106,7 +109,9 @@ export const wasmfluentpagebuilder_stickyNoteAt: (a: number, b: number, c: numbe
106
109
  export const wasmfluentpagebuilder_streamingTable: (a: number, b: number, c: number) => void;
107
110
  export const wasmfluentpagebuilder_strikeout: (a: number, b: number, c: number, d: number, e: number) => void;
108
111
  export const wasmfluentpagebuilder_strokeLine: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
112
+ export const wasmfluentpagebuilder_strokeLineDashed: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
109
113
  export const wasmfluentpagebuilder_strokeRect: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
114
+ export const wasmfluentpagebuilder_strokeRectDashed: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
110
115
  export const wasmfluentpagebuilder_table: (a: number, b: number, c: number) => void;
111
116
  export const wasmfluentpagebuilder_text: (a: number, b: number, c: number, d: number) => void;
112
117
  export const wasmfluentpagebuilder_textField: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
@@ -165,6 +170,7 @@ export const wasmpdfdocument_flattenAllAnnotations: (a: number, b: number) => vo
165
170
  export const wasmpdfdocument_flattenForms: (a: number, b: number) => void;
166
171
  export const wasmpdfdocument_flattenFormsOnPage: (a: number, b: number, c: number) => void;
167
172
  export const wasmpdfdocument_flattenPageAnnotations: (a: number, b: number, c: number) => void;
173
+ export const wasmpdfdocument_flattenToImages: (a: number, b: number, c: number) => void;
168
174
  export const wasmpdfdocument_flattenWarnings: (a: number, b: number) => void;
169
175
  export const wasmpdfdocument_getAnnotations: (a: number, b: number, c: number) => void;
170
176
  export const wasmpdfdocument_getFormFieldValue: (a: number, b: number, c: number, d: number) => void;
@@ -184,6 +190,7 @@ export const wasmpdfdocument_pageRotation: (a: number, b: number, c: number) =>
184
190
  export const wasmpdfdocument_removeArtifacts: (a: number, b: number, c: number) => void;
185
191
  export const wasmpdfdocument_removeFooters: (a: number, b: number, c: number) => void;
186
192
  export const wasmpdfdocument_removeHeaders: (a: number, b: number, c: number) => void;
193
+ export const wasmpdfdocument_renderPage: (a: number, b: number, c: number, d: number) => void;
187
194
  export const wasmpdfdocument_repositionImage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
188
195
  export const wasmpdfdocument_resizeImage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
189
196
  export const wasmpdfdocument_rotateAllPages: (a: number, b: number, c: number) => void;
@@ -60,6 +60,10 @@ export class StreamingTable {
60
60
  private constructor();
61
61
  free(): void;
62
62
  [Symbol.dispose](): void;
63
+ /**
64
+ * Number of fully-completed batches waiting for finish().
65
+ */
66
+ batchCount(): number;
63
67
  /**
64
68
  * Number of columns configured on this streaming table.
65
69
  */
@@ -71,15 +75,25 @@ export class StreamingTable {
71
75
  * throws.
72
76
  */
73
77
  finish(): void;
78
+ /**
79
+ * Explicitly flush the current batch to `completed_batches`.
80
+ * Called automatically when `batch_size` rows accumulate.
81
+ */
82
+ flush(): void;
83
+ /**
84
+ * Number of rows in the current (not-yet-flushed) batch.
85
+ */
86
+ pendingRowCount(): number;
74
87
  /**
75
88
  * Push one row as an array of cell strings (all rowspan=1). Returns an
76
89
  * error if the table has already been finished or if the row's cell count
77
- * does not match the column count.
90
+ * does not match the column count. Auto-flushes the batch when full.
78
91
  */
79
92
  pushRow(cells: string[]): void;
80
93
  /**
81
94
  * Push one row with per-cell rowspan values. `cells` is a JS array of
82
95
  * `[text, rowspan]` two-element arrays. `rowspan == 1` is a normal cell.
96
+ * Auto-flushes the batch when full.
83
97
  */
84
98
  pushRowSpan(cells: any): void;
85
99
  }
@@ -450,10 +464,18 @@ export class WasmFluentPageBuilder {
450
464
  * Draw a straight line with explicit stroke width and RGB colour.
451
465
  */
452
466
  strokeLine(x1: number, y1: number, x2: number, y2: number, width: number, r: number, g: number, b: number): void;
467
+ /**
468
+ * Draw a dashed line. `dash` is alternating on/off lengths in points; `phase` is the starting offset.
469
+ */
470
+ strokeLineDashed(x1: number, y1: number, x2: number, y2: number, width: number, r: number, g: number, b: number, dash: Float32Array, phase: number): void;
453
471
  /**
454
472
  * Draw a stroked rectangle with explicit stroke width and RGB colour.
455
473
  */
456
474
  strokeRect(x: number, y: number, w: number, h: number, width: number, r: number, g: number, b: number): void;
475
+ /**
476
+ * Draw a dashed rectangle border. `dash` is alternating on/off lengths in points; `phase` is the starting offset.
477
+ */
478
+ strokeRectDashed(x: number, y: number, w: number, h: number, width: number, r: number, g: number, b: number, dash: Float32Array, phase: number): void;
457
479
  /**
458
480
  * Render a buffered table from a JS object:
459
481
  *
@@ -899,6 +921,12 @@ export class WasmPdfDocument {
899
921
  * Flatten annotations on a page into the page content.
900
922
  */
901
923
  flattenPageAnnotations(page_index: number): void;
924
+ /**
925
+ * Create a flattened PDF where each page is rendered as an image.
926
+ * Burns in all annotations, form fields, and overlays.
927
+ * Returns the flattened PDF as bytes.
928
+ */
929
+ flattenToImages(dpi?: number | null): Uint8Array;
902
930
  /**
903
931
  * Return warnings collected during the last form-flattening save.
904
932
  *
@@ -1031,6 +1059,16 @@ export class WasmPdfDocument {
1031
1059
  * @param threshold - Fraction of pages (0.0-1.0) where text must repeat (heuristic mode)
1032
1060
  */
1033
1061
  removeHeaders(threshold: number): number;
1062
+ /**
1063
+ * Render a page to an image (PNG).
1064
+ *
1065
+ * Requires the `rendering` feature.
1066
+ *
1067
+ * @param page_index - Zero-based page number
1068
+ * @param dpi - Dots per inch (default: 150)
1069
+ * @returns Uint8Array containing the PNG image data
1070
+ */
1071
+ renderPage(page_index: number, dpi?: number | null): Uint8Array;
1034
1072
  /**
1035
1073
  * Reposition an image on a page.
1036
1074
  */
@@ -1254,10 +1292,9 @@ export class WasmPdfPageRegion {
1254
1292
 
1255
1293
  /**
1256
1294
  * A single existing PDF signature surfaced by
1257
- * `WasmPdfDocument.signatures()`. `verify()` runs the RSA-PKCS#1 v1.5
1258
- * signer-attributes check; `verifyDetached()` adds the
1259
- * `messageDigest` content-hash check. RSA-PSS / ECDSA signers still
1260
- * throw an `UnsupportedFeature`-mapped JS error.
1295
+ * `WasmPdfDocument.signatures()`. `verify()` runs the signer-attributes
1296
+ * check; `verifyDetached()` adds the `messageDigest` content-hash check.
1297
+ * Supported: RSA-PKCS#1 v1.5, RSA-PSS, ECDSA P-256/P-384.
1261
1298
  */
1262
1299
  export class WasmSignature {
1263
1300
  private constructor();
@@ -1335,7 +1372,11 @@ export class WasmTimestamp {
1335
1372
  */
1336
1373
  static parse(data: Uint8Array): WasmTimestamp;
1337
1374
  /**
1338
- * Cryptographic verify not yet implemented.
1375
+ * Cryptographically verify this TimeStampToken.
1376
+ *
1377
+ * Returns `true` when the TSA's signature and `messageDigest` both pass.
1378
+ * Returns `false` when a crypto check fails (tampered token or wrong key).
1379
+ * Throws when the token is not CMS-wrapped or uses an unsupported algorithm.
1339
1380
  */
1340
1381
  verify(): boolean;
1341
1382
  /**
@@ -119,6 +119,14 @@ class StreamingTable {
119
119
  const ptr = this.__destroy_into_raw();
120
120
  wasm.__wbg_streamingtable_free(ptr, 0);
121
121
  }
122
+ /**
123
+ * Number of fully-completed batches waiting for finish().
124
+ * @returns {number}
125
+ */
126
+ batchCount() {
127
+ const ret = wasm.streamingtable_batchCount(this.__wbg_ptr);
128
+ return ret >>> 0;
129
+ }
122
130
  /**
123
131
  * Number of columns configured on this streaming table.
124
132
  * @returns {number}
@@ -146,10 +154,25 @@ class StreamingTable {
146
154
  wasm.__wbindgen_add_to_stack_pointer(16);
147
155
  }
148
156
  }
157
+ /**
158
+ * Explicitly flush the current batch to `completed_batches`.
159
+ * Called automatically when `batch_size` rows accumulate.
160
+ */
161
+ flush() {
162
+ wasm.streamingtable_flush(this.__wbg_ptr);
163
+ }
164
+ /**
165
+ * Number of rows in the current (not-yet-flushed) batch.
166
+ * @returns {number}
167
+ */
168
+ pendingRowCount() {
169
+ const ret = wasm.streamingtable_pendingRowCount(this.__wbg_ptr);
170
+ return ret >>> 0;
171
+ }
149
172
  /**
150
173
  * Push one row as an array of cell strings (all rowspan=1). Returns an
151
174
  * error if the table has already been finished or if the row's cell count
152
- * does not match the column count.
175
+ * does not match the column count. Auto-flushes the batch when full.
153
176
  * @param {string[]} cells
154
177
  */
155
178
  pushRow(cells) {
@@ -170,6 +193,7 @@ class StreamingTable {
170
193
  /**
171
194
  * Push one row with per-cell rowspan values. `cells` is a JS array of
172
195
  * `[text, rowspan]` two-element arrays. `rowspan == 1` is a normal cell.
196
+ * Auto-flushes the batch when full.
173
197
  * @param {any} cells
174
198
  */
175
199
  pushRowSpan(cells) {
@@ -1952,6 +1976,34 @@ class WasmFluentPageBuilder {
1952
1976
  wasm.__wbindgen_add_to_stack_pointer(16);
1953
1977
  }
1954
1978
  }
1979
+ /**
1980
+ * Draw a dashed line. `dash` is alternating on/off lengths in points; `phase` is the starting offset.
1981
+ * @param {number} x1
1982
+ * @param {number} y1
1983
+ * @param {number} x2
1984
+ * @param {number} y2
1985
+ * @param {number} width
1986
+ * @param {number} r
1987
+ * @param {number} g
1988
+ * @param {number} b
1989
+ * @param {Float32Array} dash
1990
+ * @param {number} phase
1991
+ */
1992
+ strokeLineDashed(x1, y1, x2, y2, width, r, g, b, dash, phase) {
1993
+ try {
1994
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1995
+ const ptr0 = passArrayF32ToWasm0(dash, wasm.__wbindgen_export);
1996
+ const len0 = WASM_VECTOR_LEN;
1997
+ wasm.wasmfluentpagebuilder_strokeLineDashed(retptr, this.__wbg_ptr, x1, y1, x2, y2, width, r, g, b, ptr0, len0, phase);
1998
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1999
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2000
+ if (r1) {
2001
+ throw takeObject(r0);
2002
+ }
2003
+ } finally {
2004
+ wasm.__wbindgen_add_to_stack_pointer(16);
2005
+ }
2006
+ }
1955
2007
  /**
1956
2008
  * Draw a stroked rectangle with explicit stroke width and RGB colour.
1957
2009
  * @param {number} x
@@ -1976,6 +2028,34 @@ class WasmFluentPageBuilder {
1976
2028
  wasm.__wbindgen_add_to_stack_pointer(16);
1977
2029
  }
1978
2030
  }
2031
+ /**
2032
+ * Draw a dashed rectangle border. `dash` is alternating on/off lengths in points; `phase` is the starting offset.
2033
+ * @param {number} x
2034
+ * @param {number} y
2035
+ * @param {number} w
2036
+ * @param {number} h
2037
+ * @param {number} width
2038
+ * @param {number} r
2039
+ * @param {number} g
2040
+ * @param {number} b
2041
+ * @param {Float32Array} dash
2042
+ * @param {number} phase
2043
+ */
2044
+ strokeRectDashed(x, y, w, h, width, r, g, b, dash, phase) {
2045
+ try {
2046
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2047
+ const ptr0 = passArrayF32ToWasm0(dash, wasm.__wbindgen_export);
2048
+ const len0 = WASM_VECTOR_LEN;
2049
+ wasm.wasmfluentpagebuilder_strokeRectDashed(retptr, this.__wbg_ptr, x, y, w, h, width, r, g, b, ptr0, len0, phase);
2050
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2051
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2052
+ if (r1) {
2053
+ throw takeObject(r0);
2054
+ }
2055
+ } finally {
2056
+ wasm.__wbindgen_add_to_stack_pointer(16);
2057
+ }
2058
+ }
1979
2059
  /**
1980
2060
  * Render a buffered table from a JS object:
1981
2061
  *
@@ -3555,6 +3635,31 @@ class WasmPdfDocument {
3555
3635
  wasm.__wbindgen_add_to_stack_pointer(16);
3556
3636
  }
3557
3637
  }
3638
+ /**
3639
+ * Create a flattened PDF where each page is rendered as an image.
3640
+ * Burns in all annotations, form fields, and overlays.
3641
+ * Returns the flattened PDF as bytes.
3642
+ * @param {number | null} [dpi]
3643
+ * @returns {Uint8Array}
3644
+ */
3645
+ flattenToImages(dpi) {
3646
+ try {
3647
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3648
+ wasm.wasmpdfdocument_flattenToImages(retptr, this.__wbg_ptr, isLikeNone(dpi) ? 0x100000001 : (dpi) >>> 0);
3649
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3650
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3651
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3652
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3653
+ if (r3) {
3654
+ throw takeObject(r2);
3655
+ }
3656
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
3657
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
3658
+ return v1;
3659
+ } finally {
3660
+ wasm.__wbindgen_add_to_stack_pointer(16);
3661
+ }
3662
+ }
3558
3663
  /**
3559
3664
  * Return warnings collected during the last form-flattening save.
3560
3665
  *
@@ -3993,6 +4098,36 @@ class WasmPdfDocument {
3993
4098
  wasm.__wbindgen_add_to_stack_pointer(16);
3994
4099
  }
3995
4100
  }
4101
+ /**
4102
+ * Render a page to an image (PNG).
4103
+ *
4104
+ * Requires the `rendering` feature.
4105
+ *
4106
+ * @param page_index - Zero-based page number
4107
+ * @param dpi - Dots per inch (default: 150)
4108
+ * @returns Uint8Array containing the PNG image data
4109
+ * @param {number} page_index
4110
+ * @param {number | null} [dpi]
4111
+ * @returns {Uint8Array}
4112
+ */
4113
+ renderPage(page_index, dpi) {
4114
+ try {
4115
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4116
+ wasm.wasmpdfdocument_renderPage(retptr, this.__wbg_ptr, page_index, isLikeNone(dpi) ? 0x100000001 : (dpi) >>> 0);
4117
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4118
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4119
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
4120
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
4121
+ if (r3) {
4122
+ throw takeObject(r2);
4123
+ }
4124
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
4125
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
4126
+ return v1;
4127
+ } finally {
4128
+ wasm.__wbindgen_add_to_stack_pointer(16);
4129
+ }
4130
+ }
3996
4131
  /**
3997
4132
  * Reposition an image on a page.
3998
4133
  * @param {number} page_index
@@ -5043,10 +5178,9 @@ exports.WasmPdfPageRegion = WasmPdfPageRegion;
5043
5178
 
5044
5179
  /**
5045
5180
  * A single existing PDF signature surfaced by
5046
- * `WasmPdfDocument.signatures()`. `verify()` runs the RSA-PKCS#1 v1.5
5047
- * signer-attributes check; `verifyDetached()` adds the
5048
- * `messageDigest` content-hash check. RSA-PSS / ECDSA signers still
5049
- * throw an `UnsupportedFeature`-mapped JS error.
5181
+ * `WasmPdfDocument.signatures()`. `verify()` runs the signer-attributes
5182
+ * check; `verifyDetached()` adds the `messageDigest` content-hash check.
5183
+ * Supported: RSA-PKCS#1 v1.5, RSA-PSS, ECDSA P-256/P-384.
5050
5184
  */
5051
5185
  class WasmSignature {
5052
5186
  static __wrap(ptr) {
@@ -5378,7 +5512,11 @@ class WasmTimestamp {
5378
5512
  }
5379
5513
  }
5380
5514
  /**
5381
- * Cryptographic verify not yet implemented.
5515
+ * Cryptographically verify this TimeStampToken.
5516
+ *
5517
+ * Returns `true` when the TSA's signature and `messageDigest` both pass.
5518
+ * Returns `false` when a crypto check fails (tampered token or wrong key).
5519
+ * Throws when the token is not CMS-wrapped or uses an unsupported algorithm.
5382
5520
  * @returns {boolean}
5383
5521
  */
5384
5522
  verify() {
Binary file
@@ -17,8 +17,11 @@ export const __wbg_wasmsignature_free: (a: number, b: number) => void;
17
17
  export const __wbg_wasmtimestamp_free: (a: number, b: number) => void;
18
18
  export const setLogLevel: (a: number, b: number, c: number) => void;
19
19
  export const signPdfBytes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
20
+ export const streamingtable_batchCount: (a: number) => number;
20
21
  export const streamingtable_columnCount: (a: number) => number;
21
22
  export const streamingtable_finish: (a: number, b: number) => void;
23
+ export const streamingtable_flush: (a: number) => void;
24
+ export const streamingtable_pendingRowCount: (a: number) => number;
22
25
  export const streamingtable_pushRow: (a: number, b: number, c: number, d: number) => void;
23
26
  export const streamingtable_pushRowSpan: (a: number, b: number, c: number) => void;
24
27
  export const wasmartifact_center: (a: number, b: number) => number;
@@ -106,7 +109,9 @@ export const wasmfluentpagebuilder_stickyNoteAt: (a: number, b: number, c: numbe
106
109
  export const wasmfluentpagebuilder_streamingTable: (a: number, b: number, c: number) => void;
107
110
  export const wasmfluentpagebuilder_strikeout: (a: number, b: number, c: number, d: number, e: number) => void;
108
111
  export const wasmfluentpagebuilder_strokeLine: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
112
+ export const wasmfluentpagebuilder_strokeLineDashed: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
109
113
  export const wasmfluentpagebuilder_strokeRect: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
114
+ export const wasmfluentpagebuilder_strokeRectDashed: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
110
115
  export const wasmfluentpagebuilder_table: (a: number, b: number, c: number) => void;
111
116
  export const wasmfluentpagebuilder_text: (a: number, b: number, c: number, d: number) => void;
112
117
  export const wasmfluentpagebuilder_textField: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
@@ -165,6 +170,7 @@ export const wasmpdfdocument_flattenAllAnnotations: (a: number, b: number) => vo
165
170
  export const wasmpdfdocument_flattenForms: (a: number, b: number) => void;
166
171
  export const wasmpdfdocument_flattenFormsOnPage: (a: number, b: number, c: number) => void;
167
172
  export const wasmpdfdocument_flattenPageAnnotations: (a: number, b: number, c: number) => void;
173
+ export const wasmpdfdocument_flattenToImages: (a: number, b: number, c: number) => void;
168
174
  export const wasmpdfdocument_flattenWarnings: (a: number, b: number) => void;
169
175
  export const wasmpdfdocument_getAnnotations: (a: number, b: number, c: number) => void;
170
176
  export const wasmpdfdocument_getFormFieldValue: (a: number, b: number, c: number, d: number) => void;
@@ -184,6 +190,7 @@ export const wasmpdfdocument_pageRotation: (a: number, b: number, c: number) =>
184
190
  export const wasmpdfdocument_removeArtifacts: (a: number, b: number, c: number) => void;
185
191
  export const wasmpdfdocument_removeFooters: (a: number, b: number, c: number) => void;
186
192
  export const wasmpdfdocument_removeHeaders: (a: number, b: number, c: number) => void;
193
+ export const wasmpdfdocument_renderPage: (a: number, b: number, c: number, d: number) => void;
187
194
  export const wasmpdfdocument_repositionImage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
188
195
  export const wasmpdfdocument_resizeImage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
189
196
  export const wasmpdfdocument_rotateAllPages: (a: number, b: number, c: number) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pdf-oxide-wasm",
3
- "version": "0.3.39",
3
+ "version": "0.3.40",
4
4
  "description": "Fast, zero-dependency PDF toolkit for Node.js, browsers, and edge runtimes — text extraction, markdown/HTML conversion, search, form filling, creation, and editing. Rust core compiled to WebAssembly.",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "repository": {
@@ -60,6 +60,10 @@ export class StreamingTable {
60
60
  private constructor();
61
61
  free(): void;
62
62
  [Symbol.dispose](): void;
63
+ /**
64
+ * Number of fully-completed batches waiting for finish().
65
+ */
66
+ batchCount(): number;
63
67
  /**
64
68
  * Number of columns configured on this streaming table.
65
69
  */
@@ -71,15 +75,25 @@ export class StreamingTable {
71
75
  * throws.
72
76
  */
73
77
  finish(): void;
78
+ /**
79
+ * Explicitly flush the current batch to `completed_batches`.
80
+ * Called automatically when `batch_size` rows accumulate.
81
+ */
82
+ flush(): void;
83
+ /**
84
+ * Number of rows in the current (not-yet-flushed) batch.
85
+ */
86
+ pendingRowCount(): number;
74
87
  /**
75
88
  * Push one row as an array of cell strings (all rowspan=1). Returns an
76
89
  * error if the table has already been finished or if the row's cell count
77
- * does not match the column count.
90
+ * does not match the column count. Auto-flushes the batch when full.
78
91
  */
79
92
  pushRow(cells: string[]): void;
80
93
  /**
81
94
  * Push one row with per-cell rowspan values. `cells` is a JS array of
82
95
  * `[text, rowspan]` two-element arrays. `rowspan == 1` is a normal cell.
96
+ * Auto-flushes the batch when full.
83
97
  */
84
98
  pushRowSpan(cells: any): void;
85
99
  }
@@ -450,10 +464,18 @@ export class WasmFluentPageBuilder {
450
464
  * Draw a straight line with explicit stroke width and RGB colour.
451
465
  */
452
466
  strokeLine(x1: number, y1: number, x2: number, y2: number, width: number, r: number, g: number, b: number): void;
467
+ /**
468
+ * Draw a dashed line. `dash` is alternating on/off lengths in points; `phase` is the starting offset.
469
+ */
470
+ strokeLineDashed(x1: number, y1: number, x2: number, y2: number, width: number, r: number, g: number, b: number, dash: Float32Array, phase: number): void;
453
471
  /**
454
472
  * Draw a stroked rectangle with explicit stroke width and RGB colour.
455
473
  */
456
474
  strokeRect(x: number, y: number, w: number, h: number, width: number, r: number, g: number, b: number): void;
475
+ /**
476
+ * Draw a dashed rectangle border. `dash` is alternating on/off lengths in points; `phase` is the starting offset.
477
+ */
478
+ strokeRectDashed(x: number, y: number, w: number, h: number, width: number, r: number, g: number, b: number, dash: Float32Array, phase: number): void;
457
479
  /**
458
480
  * Render a buffered table from a JS object:
459
481
  *
@@ -899,6 +921,12 @@ export class WasmPdfDocument {
899
921
  * Flatten annotations on a page into the page content.
900
922
  */
901
923
  flattenPageAnnotations(page_index: number): void;
924
+ /**
925
+ * Create a flattened PDF where each page is rendered as an image.
926
+ * Burns in all annotations, form fields, and overlays.
927
+ * Returns the flattened PDF as bytes.
928
+ */
929
+ flattenToImages(dpi?: number | null): Uint8Array;
902
930
  /**
903
931
  * Return warnings collected during the last form-flattening save.
904
932
  *
@@ -1031,6 +1059,16 @@ export class WasmPdfDocument {
1031
1059
  * @param threshold - Fraction of pages (0.0-1.0) where text must repeat (heuristic mode)
1032
1060
  */
1033
1061
  removeHeaders(threshold: number): number;
1062
+ /**
1063
+ * Render a page to an image (PNG).
1064
+ *
1065
+ * Requires the `rendering` feature.
1066
+ *
1067
+ * @param page_index - Zero-based page number
1068
+ * @param dpi - Dots per inch (default: 150)
1069
+ * @returns Uint8Array containing the PNG image data
1070
+ */
1071
+ renderPage(page_index: number, dpi?: number | null): Uint8Array;
1034
1072
  /**
1035
1073
  * Reposition an image on a page.
1036
1074
  */
@@ -1254,10 +1292,9 @@ export class WasmPdfPageRegion {
1254
1292
 
1255
1293
  /**
1256
1294
  * A single existing PDF signature surfaced by
1257
- * `WasmPdfDocument.signatures()`. `verify()` runs the RSA-PKCS#1 v1.5
1258
- * signer-attributes check; `verifyDetached()` adds the
1259
- * `messageDigest` content-hash check. RSA-PSS / ECDSA signers still
1260
- * throw an `UnsupportedFeature`-mapped JS error.
1295
+ * `WasmPdfDocument.signatures()`. `verify()` runs the signer-attributes
1296
+ * check; `verifyDetached()` adds the `messageDigest` content-hash check.
1297
+ * Supported: RSA-PKCS#1 v1.5, RSA-PSS, ECDSA P-256/P-384.
1261
1298
  */
1262
1299
  export class WasmSignature {
1263
1300
  private constructor();
@@ -1335,7 +1372,11 @@ export class WasmTimestamp {
1335
1372
  */
1336
1373
  static parse(data: Uint8Array): WasmTimestamp;
1337
1374
  /**
1338
- * Cryptographic verify not yet implemented.
1375
+ * Cryptographically verify this TimeStampToken.
1376
+ *
1377
+ * Returns `true` when the TSA's signature and `messageDigest` both pass.
1378
+ * Returns `false` when a crypto check fails (tampered token or wrong key).
1379
+ * Throws when the token is not CMS-wrapped or uses an unsupported algorithm.
1339
1380
  */
1340
1381
  verify(): boolean;
1341
1382
  /**
@@ -1418,8 +1459,11 @@ export interface InitOutput {
1418
1459
  readonly __wbg_wasmtimestamp_free: (a: number, b: number) => void;
1419
1460
  readonly setLogLevel: (a: number, b: number, c: number) => void;
1420
1461
  readonly signPdfBytes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
1462
+ readonly streamingtable_batchCount: (a: number) => number;
1421
1463
  readonly streamingtable_columnCount: (a: number) => number;
1422
1464
  readonly streamingtable_finish: (a: number, b: number) => void;
1465
+ readonly streamingtable_flush: (a: number) => void;
1466
+ readonly streamingtable_pendingRowCount: (a: number) => number;
1423
1467
  readonly streamingtable_pushRow: (a: number, b: number, c: number, d: number) => void;
1424
1468
  readonly streamingtable_pushRowSpan: (a: number, b: number, c: number) => void;
1425
1469
  readonly wasmartifact_center: (a: number, b: number) => number;
@@ -1507,7 +1551,9 @@ export interface InitOutput {
1507
1551
  readonly wasmfluentpagebuilder_streamingTable: (a: number, b: number, c: number) => void;
1508
1552
  readonly wasmfluentpagebuilder_strikeout: (a: number, b: number, c: number, d: number, e: number) => void;
1509
1553
  readonly wasmfluentpagebuilder_strokeLine: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
1554
+ readonly wasmfluentpagebuilder_strokeLineDashed: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
1510
1555
  readonly wasmfluentpagebuilder_strokeRect: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
1556
+ readonly wasmfluentpagebuilder_strokeRectDashed: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
1511
1557
  readonly wasmfluentpagebuilder_table: (a: number, b: number, c: number) => void;
1512
1558
  readonly wasmfluentpagebuilder_text: (a: number, b: number, c: number, d: number) => void;
1513
1559
  readonly wasmfluentpagebuilder_textField: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
@@ -1566,6 +1612,7 @@ export interface InitOutput {
1566
1612
  readonly wasmpdfdocument_flattenForms: (a: number, b: number) => void;
1567
1613
  readonly wasmpdfdocument_flattenFormsOnPage: (a: number, b: number, c: number) => void;
1568
1614
  readonly wasmpdfdocument_flattenPageAnnotations: (a: number, b: number, c: number) => void;
1615
+ readonly wasmpdfdocument_flattenToImages: (a: number, b: number, c: number) => void;
1569
1616
  readonly wasmpdfdocument_flattenWarnings: (a: number, b: number) => void;
1570
1617
  readonly wasmpdfdocument_getAnnotations: (a: number, b: number, c: number) => void;
1571
1618
  readonly wasmpdfdocument_getFormFieldValue: (a: number, b: number, c: number, d: number) => void;
@@ -1585,6 +1632,7 @@ export interface InitOutput {
1585
1632
  readonly wasmpdfdocument_removeArtifacts: (a: number, b: number, c: number) => void;
1586
1633
  readonly wasmpdfdocument_removeFooters: (a: number, b: number, c: number) => void;
1587
1634
  readonly wasmpdfdocument_removeHeaders: (a: number, b: number, c: number) => void;
1635
+ readonly wasmpdfdocument_renderPage: (a: number, b: number, c: number, d: number) => void;
1588
1636
  readonly wasmpdfdocument_repositionImage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
1589
1637
  readonly wasmpdfdocument_resizeImage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
1590
1638
  readonly wasmpdfdocument_rotateAllPages: (a: number, b: number, c: number) => void;
package/web/pdf_oxide.js CHANGED
@@ -117,6 +117,14 @@ export class StreamingTable {
117
117
  const ptr = this.__destroy_into_raw();
118
118
  wasm.__wbg_streamingtable_free(ptr, 0);
119
119
  }
120
+ /**
121
+ * Number of fully-completed batches waiting for finish().
122
+ * @returns {number}
123
+ */
124
+ batchCount() {
125
+ const ret = wasm.streamingtable_batchCount(this.__wbg_ptr);
126
+ return ret >>> 0;
127
+ }
120
128
  /**
121
129
  * Number of columns configured on this streaming table.
122
130
  * @returns {number}
@@ -144,10 +152,25 @@ export class StreamingTable {
144
152
  wasm.__wbindgen_add_to_stack_pointer(16);
145
153
  }
146
154
  }
155
+ /**
156
+ * Explicitly flush the current batch to `completed_batches`.
157
+ * Called automatically when `batch_size` rows accumulate.
158
+ */
159
+ flush() {
160
+ wasm.streamingtable_flush(this.__wbg_ptr);
161
+ }
162
+ /**
163
+ * Number of rows in the current (not-yet-flushed) batch.
164
+ * @returns {number}
165
+ */
166
+ pendingRowCount() {
167
+ const ret = wasm.streamingtable_pendingRowCount(this.__wbg_ptr);
168
+ return ret >>> 0;
169
+ }
147
170
  /**
148
171
  * Push one row as an array of cell strings (all rowspan=1). Returns an
149
172
  * error if the table has already been finished or if the row's cell count
150
- * does not match the column count.
173
+ * does not match the column count. Auto-flushes the batch when full.
151
174
  * @param {string[]} cells
152
175
  */
153
176
  pushRow(cells) {
@@ -168,6 +191,7 @@ export class StreamingTable {
168
191
  /**
169
192
  * Push one row with per-cell rowspan values. `cells` is a JS array of
170
193
  * `[text, rowspan]` two-element arrays. `rowspan == 1` is a normal cell.
194
+ * Auto-flushes the batch when full.
171
195
  * @param {any} cells
172
196
  */
173
197
  pushRowSpan(cells) {
@@ -1945,6 +1969,34 @@ export class WasmFluentPageBuilder {
1945
1969
  wasm.__wbindgen_add_to_stack_pointer(16);
1946
1970
  }
1947
1971
  }
1972
+ /**
1973
+ * Draw a dashed line. `dash` is alternating on/off lengths in points; `phase` is the starting offset.
1974
+ * @param {number} x1
1975
+ * @param {number} y1
1976
+ * @param {number} x2
1977
+ * @param {number} y2
1978
+ * @param {number} width
1979
+ * @param {number} r
1980
+ * @param {number} g
1981
+ * @param {number} b
1982
+ * @param {Float32Array} dash
1983
+ * @param {number} phase
1984
+ */
1985
+ strokeLineDashed(x1, y1, x2, y2, width, r, g, b, dash, phase) {
1986
+ try {
1987
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1988
+ const ptr0 = passArrayF32ToWasm0(dash, wasm.__wbindgen_export);
1989
+ const len0 = WASM_VECTOR_LEN;
1990
+ wasm.wasmfluentpagebuilder_strokeLineDashed(retptr, this.__wbg_ptr, x1, y1, x2, y2, width, r, g, b, ptr0, len0, phase);
1991
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1992
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1993
+ if (r1) {
1994
+ throw takeObject(r0);
1995
+ }
1996
+ } finally {
1997
+ wasm.__wbindgen_add_to_stack_pointer(16);
1998
+ }
1999
+ }
1948
2000
  /**
1949
2001
  * Draw a stroked rectangle with explicit stroke width and RGB colour.
1950
2002
  * @param {number} x
@@ -1969,6 +2021,34 @@ export class WasmFluentPageBuilder {
1969
2021
  wasm.__wbindgen_add_to_stack_pointer(16);
1970
2022
  }
1971
2023
  }
2024
+ /**
2025
+ * Draw a dashed rectangle border. `dash` is alternating on/off lengths in points; `phase` is the starting offset.
2026
+ * @param {number} x
2027
+ * @param {number} y
2028
+ * @param {number} w
2029
+ * @param {number} h
2030
+ * @param {number} width
2031
+ * @param {number} r
2032
+ * @param {number} g
2033
+ * @param {number} b
2034
+ * @param {Float32Array} dash
2035
+ * @param {number} phase
2036
+ */
2037
+ strokeRectDashed(x, y, w, h, width, r, g, b, dash, phase) {
2038
+ try {
2039
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2040
+ const ptr0 = passArrayF32ToWasm0(dash, wasm.__wbindgen_export);
2041
+ const len0 = WASM_VECTOR_LEN;
2042
+ wasm.wasmfluentpagebuilder_strokeRectDashed(retptr, this.__wbg_ptr, x, y, w, h, width, r, g, b, ptr0, len0, phase);
2043
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2044
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2045
+ if (r1) {
2046
+ throw takeObject(r0);
2047
+ }
2048
+ } finally {
2049
+ wasm.__wbindgen_add_to_stack_pointer(16);
2050
+ }
2051
+ }
1972
2052
  /**
1973
2053
  * Render a buffered table from a JS object:
1974
2054
  *
@@ -3541,6 +3621,31 @@ export class WasmPdfDocument {
3541
3621
  wasm.__wbindgen_add_to_stack_pointer(16);
3542
3622
  }
3543
3623
  }
3624
+ /**
3625
+ * Create a flattened PDF where each page is rendered as an image.
3626
+ * Burns in all annotations, form fields, and overlays.
3627
+ * Returns the flattened PDF as bytes.
3628
+ * @param {number | null} [dpi]
3629
+ * @returns {Uint8Array}
3630
+ */
3631
+ flattenToImages(dpi) {
3632
+ try {
3633
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3634
+ wasm.wasmpdfdocument_flattenToImages(retptr, this.__wbg_ptr, isLikeNone(dpi) ? 0x100000001 : (dpi) >>> 0);
3635
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3636
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3637
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3638
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3639
+ if (r3) {
3640
+ throw takeObject(r2);
3641
+ }
3642
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
3643
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
3644
+ return v1;
3645
+ } finally {
3646
+ wasm.__wbindgen_add_to_stack_pointer(16);
3647
+ }
3648
+ }
3544
3649
  /**
3545
3650
  * Return warnings collected during the last form-flattening save.
3546
3651
  *
@@ -3979,6 +4084,36 @@ export class WasmPdfDocument {
3979
4084
  wasm.__wbindgen_add_to_stack_pointer(16);
3980
4085
  }
3981
4086
  }
4087
+ /**
4088
+ * Render a page to an image (PNG).
4089
+ *
4090
+ * Requires the `rendering` feature.
4091
+ *
4092
+ * @param page_index - Zero-based page number
4093
+ * @param dpi - Dots per inch (default: 150)
4094
+ * @returns Uint8Array containing the PNG image data
4095
+ * @param {number} page_index
4096
+ * @param {number | null} [dpi]
4097
+ * @returns {Uint8Array}
4098
+ */
4099
+ renderPage(page_index, dpi) {
4100
+ try {
4101
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4102
+ wasm.wasmpdfdocument_renderPage(retptr, this.__wbg_ptr, page_index, isLikeNone(dpi) ? 0x100000001 : (dpi) >>> 0);
4103
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4104
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4105
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
4106
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
4107
+ if (r3) {
4108
+ throw takeObject(r2);
4109
+ }
4110
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
4111
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
4112
+ return v1;
4113
+ } finally {
4114
+ wasm.__wbindgen_add_to_stack_pointer(16);
4115
+ }
4116
+ }
3982
4117
  /**
3983
4118
  * Reposition an image on a page.
3984
4119
  * @param {number} page_index
@@ -5027,10 +5162,9 @@ if (Symbol.dispose) WasmPdfPageRegion.prototype[Symbol.dispose] = WasmPdfPageReg
5027
5162
 
5028
5163
  /**
5029
5164
  * A single existing PDF signature surfaced by
5030
- * `WasmPdfDocument.signatures()`. `verify()` runs the RSA-PKCS#1 v1.5
5031
- * signer-attributes check; `verifyDetached()` adds the
5032
- * `messageDigest` content-hash check. RSA-PSS / ECDSA signers still
5033
- * throw an `UnsupportedFeature`-mapped JS error.
5165
+ * `WasmPdfDocument.signatures()`. `verify()` runs the signer-attributes
5166
+ * check; `verifyDetached()` adds the `messageDigest` content-hash check.
5167
+ * Supported: RSA-PKCS#1 v1.5, RSA-PSS, ECDSA P-256/P-384.
5034
5168
  */
5035
5169
  export class WasmSignature {
5036
5170
  static __wrap(ptr) {
@@ -5361,7 +5495,11 @@ export class WasmTimestamp {
5361
5495
  }
5362
5496
  }
5363
5497
  /**
5364
- * Cryptographic verify not yet implemented.
5498
+ * Cryptographically verify this TimeStampToken.
5499
+ *
5500
+ * Returns `true` when the TSA's signature and `messageDigest` both pass.
5501
+ * Returns `false` when a crypto check fails (tampered token or wrong key).
5502
+ * Throws when the token is not CMS-wrapped or uses an unsupported algorithm.
5365
5503
  * @returns {boolean}
5366
5504
  */
5367
5505
  verify() {
Binary file
@@ -17,8 +17,11 @@ export const __wbg_wasmsignature_free: (a: number, b: number) => void;
17
17
  export const __wbg_wasmtimestamp_free: (a: number, b: number) => void;
18
18
  export const setLogLevel: (a: number, b: number, c: number) => void;
19
19
  export const signPdfBytes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
20
+ export const streamingtable_batchCount: (a: number) => number;
20
21
  export const streamingtable_columnCount: (a: number) => number;
21
22
  export const streamingtable_finish: (a: number, b: number) => void;
23
+ export const streamingtable_flush: (a: number) => void;
24
+ export const streamingtable_pendingRowCount: (a: number) => number;
22
25
  export const streamingtable_pushRow: (a: number, b: number, c: number, d: number) => void;
23
26
  export const streamingtable_pushRowSpan: (a: number, b: number, c: number) => void;
24
27
  export const wasmartifact_center: (a: number, b: number) => number;
@@ -106,7 +109,9 @@ export const wasmfluentpagebuilder_stickyNoteAt: (a: number, b: number, c: numbe
106
109
  export const wasmfluentpagebuilder_streamingTable: (a: number, b: number, c: number) => void;
107
110
  export const wasmfluentpagebuilder_strikeout: (a: number, b: number, c: number, d: number, e: number) => void;
108
111
  export const wasmfluentpagebuilder_strokeLine: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
112
+ export const wasmfluentpagebuilder_strokeLineDashed: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
109
113
  export const wasmfluentpagebuilder_strokeRect: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
114
+ export const wasmfluentpagebuilder_strokeRectDashed: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
110
115
  export const wasmfluentpagebuilder_table: (a: number, b: number, c: number) => void;
111
116
  export const wasmfluentpagebuilder_text: (a: number, b: number, c: number, d: number) => void;
112
117
  export const wasmfluentpagebuilder_textField: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
@@ -165,6 +170,7 @@ export const wasmpdfdocument_flattenAllAnnotations: (a: number, b: number) => vo
165
170
  export const wasmpdfdocument_flattenForms: (a: number, b: number) => void;
166
171
  export const wasmpdfdocument_flattenFormsOnPage: (a: number, b: number, c: number) => void;
167
172
  export const wasmpdfdocument_flattenPageAnnotations: (a: number, b: number, c: number) => void;
173
+ export const wasmpdfdocument_flattenToImages: (a: number, b: number, c: number) => void;
168
174
  export const wasmpdfdocument_flattenWarnings: (a: number, b: number) => void;
169
175
  export const wasmpdfdocument_getAnnotations: (a: number, b: number, c: number) => void;
170
176
  export const wasmpdfdocument_getFormFieldValue: (a: number, b: number, c: number, d: number) => void;
@@ -184,6 +190,7 @@ export const wasmpdfdocument_pageRotation: (a: number, b: number, c: number) =>
184
190
  export const wasmpdfdocument_removeArtifacts: (a: number, b: number, c: number) => void;
185
191
  export const wasmpdfdocument_removeFooters: (a: number, b: number, c: number) => void;
186
192
  export const wasmpdfdocument_removeHeaders: (a: number, b: number, c: number) => void;
193
+ export const wasmpdfdocument_renderPage: (a: number, b: number, c: number, d: number) => void;
187
194
  export const wasmpdfdocument_repositionImage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
188
195
  export const wasmpdfdocument_resizeImage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
189
196
  export const wasmpdfdocument_rotateAllPages: (a: number, b: number, c: number) => void;