@iyulab/unpdf 0.14.0 → 0.17.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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@iyulab/unpdf",
3
3
  "type": "module",
4
4
  "description": "High-performance PDF extraction to Markdown, text, and JSON (WebAssembly)",
5
- "version": "0.14.0",
5
+ "version": "0.17.0",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
package/unpdf_wasm.d.ts CHANGED
@@ -7,8 +7,21 @@ export class ParseOptions {
7
7
  lenient(): ParseOptions;
8
8
  constructor();
9
9
  textOnly(): ParseOptions;
10
+ /**
11
+ * Minimum pixel width/height for an extracted image to be kept — images
12
+ * below this on either axis are dropped as decorative (logos, rule lines,
13
+ * tracking pixels). Default 64; `0` keeps every image regardless of size.
14
+ */
15
+ withMinImageDimension(min_px: number): ParseOptions;
10
16
  withPages(from: number, to: number): ParseOptions;
11
17
  withPassword(password: string): ParseOptions;
18
+ /**
19
+ * Enable or disable resource (embedded image) extraction. Off by default —
20
+ * large PDFs loading every embedded image into memory is the largest peak-
21
+ * memory vector in this library. See `withMinImageDimension` to also tune
22
+ * which images count.
23
+ */
24
+ withResources(extract: boolean): ParseOptions;
12
25
  }
13
26
 
14
27
  export class PdfDocument {
package/unpdf_wasm_bg.js CHANGED
@@ -38,6 +38,18 @@ export class ParseOptions {
38
38
  const ret = wasm.parseoptions_textOnly(ptr);
39
39
  return ParseOptions.__wrap(ret);
40
40
  }
41
+ /**
42
+ * Minimum pixel width/height for an extracted image to be kept — images
43
+ * below this on either axis are dropped as decorative (logos, rule lines,
44
+ * tracking pixels). Default 64; `0` keeps every image regardless of size.
45
+ * @param {number} min_px
46
+ * @returns {ParseOptions}
47
+ */
48
+ withMinImageDimension(min_px) {
49
+ const ptr = this.__destroy_into_raw();
50
+ const ret = wasm.parseoptions_withMinImageDimension(ptr, min_px);
51
+ return ParseOptions.__wrap(ret);
52
+ }
41
53
  /**
42
54
  * @param {number} from
43
55
  * @param {number} to
@@ -59,6 +71,19 @@ export class ParseOptions {
59
71
  const ret = wasm.parseoptions_withPassword(ptr, ptr0, len0);
60
72
  return ParseOptions.__wrap(ret);
61
73
  }
74
+ /**
75
+ * Enable or disable resource (embedded image) extraction. Off by default —
76
+ * large PDFs loading every embedded image into memory is the largest peak-
77
+ * memory vector in this library. See `withMinImageDimension` to also tune
78
+ * which images count.
79
+ * @param {boolean} extract
80
+ * @returns {ParseOptions}
81
+ */
82
+ withResources(extract) {
83
+ const ptr = this.__destroy_into_raw();
84
+ const ret = wasm.parseoptions_withResources(ptr, extract);
85
+ return ParseOptions.__wrap(ret);
86
+ }
62
87
  }
63
88
  if (Symbol.dispose) ParseOptions.prototype[Symbol.dispose] = ParseOptions.prototype.free;
64
89
 
Binary file