unpdf 2.1.0 → 2.2.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.
Files changed (50) hide show
  1. package/README.md +12 -12
  2. package/dist/index.mjs +9 -10
  3. package/dist/pdfjs-jbig2_nowasm_fallback.mjs +1 -1
  4. package/dist/pdfjs-openjpeg.mjs +1 -1
  5. package/dist/pdfjs-openjpeg_nowasm_fallback.mjs +1 -2
  6. package/dist/pdfjs.mjs +39 -39
  7. package/dist/types/src/core/colorspace.d.ts +7 -0
  8. package/dist/types/src/core/crypto.d.ts +10 -2
  9. package/dist/types/src/core/flate_stream.d.ts +6 -1
  10. package/dist/types/src/core/image_resizer.d.ts +1 -1
  11. package/dist/types/src/core/image_utils.d.ts +10 -0
  12. package/dist/types/src/core/jpx.d.ts +0 -1
  13. package/dist/types/src/core/parser.d.ts +8 -1
  14. package/dist/types/src/core/pattern.d.ts +0 -4
  15. package/dist/types/src/core/primitives.d.ts +1 -0
  16. package/dist/types/src/core/struct_tree.d.ts +2 -0
  17. package/dist/types/src/core/wasm_image.d.ts +3 -3
  18. package/dist/types/src/display/annotation_layer.d.ts +9 -2
  19. package/dist/types/src/display/api.d.ts +38 -2
  20. package/dist/types/src/display/api_utils.d.ts +10 -0
  21. package/dist/types/src/display/canvas.d.ts +13 -3
  22. package/dist/types/src/display/canvas_dependency_tracker.d.ts +20 -10
  23. package/dist/types/src/display/canvas_factory.d.ts +1 -11
  24. package/dist/types/src/display/display_utils.d.ts +0 -71
  25. package/dist/types/src/display/dom_canvas_factory.d.ts +12 -0
  26. package/dist/types/src/display/dom_filter_factory.d.ts +23 -0
  27. package/dist/types/src/display/dom_utils.d.ts +68 -0
  28. package/dist/types/src/display/editor/draw.d.ts +2 -0
  29. package/dist/types/src/display/editor/drawers/inkdraw.d.ts +14 -17
  30. package/dist/types/src/display/editor/drawers/input_smoother.d.ts +28 -0
  31. package/dist/types/src/display/editor/drawers/outline.d.ts +2 -2
  32. package/dist/types/src/display/editor/ink.d.ts +2 -1
  33. package/dist/types/src/display/editor/tools.d.ts +2 -1
  34. package/dist/types/src/display/filter_factory.d.ts +0 -22
  35. package/dist/types/src/display/object_handler.d.ts +21 -0
  36. package/dist/types/src/display/pdf_objects.d.ts +10 -1
  37. package/dist/types/src/display/renderer_worker_proxy.d.ts +131 -0
  38. package/dist/types/src/display/text_layer.d.ts +1 -6
  39. package/dist/types/src/display/worker_options.d.ts +24 -0
  40. package/dist/types/src/pdf.d.ts +12 -12
  41. package/dist/types/src/shared/message_handler.d.ts +1 -0
  42. package/dist/types/src/shared/util.d.ts +4 -0
  43. package/dist/types/web/annotation_layer_builder.d.ts +1 -0
  44. package/dist/types/web/autolinker.d.ts +4 -4
  45. package/dist/types/web/base_download_manager.d.ts +3 -2
  46. package/dist/types/web/download_manager.d.ts +1 -0
  47. package/dist/types/web/pdf_page_view.d.ts +1 -0
  48. package/dist/types/web/pdf_scripting_manager.d.ts +1 -1
  49. package/dist/types/web/pdf_thumbnail_viewer.d.ts +7 -1
  50. package/package.json +27 -24
@@ -236,6 +236,7 @@ export class PDFPageView extends BasePDFPageView {
236
236
  isEditing: boolean;
237
237
  recordOperations: any;
238
238
  recordImages: any;
239
+ partialFrames: boolean;
239
240
  };
240
241
  draw(): Promise<void>;
241
242
  /**
@@ -39,7 +39,7 @@ export class PDFScriptingManager {
39
39
  constructor({ eventBus, externalServices, docProperties }: PDFScriptingManagerOptions);
40
40
  setViewer(pdfViewer: any): void;
41
41
  setDocument(pdfDocument: any): Promise<void>;
42
- dispatchWillSave(): Promise<any>;
42
+ dispatchWillSave(): Promise<void>;
43
43
  dispatchDidSave(): Promise<any>;
44
44
  dispatchWillPrint(): Promise<void>;
45
45
  dispatchDidPrint(): Promise<any>;
@@ -1,6 +1,7 @@
1
1
  export type PDFDocumentProxy = import("../src/display/api.js").PDFDocumentProxy;
2
2
  export type PDFPageProxy = import("../src/display/api.js").PDFPageProxy;
3
3
  export type EventBus = import("./event_utils.js").EventBus;
4
+ export type L10n = import("./l10n.js").L10n;
4
5
  export type PDFRenderingQueue = import("./pdf_rendering_queue.js").PDFRenderingQueue;
5
6
  export type PDFLinkService = import("./pdf_link_service.js").PDFLinkService;
6
7
  export type PDFThumbnailViewerOptions = {
@@ -21,6 +22,10 @@ export type PDFThumbnailViewerOptions = {
21
22
  * - The rendering queue object.
22
23
  */
23
24
  renderingQueue: PDFRenderingQueue;
25
+ /**
26
+ * - The localization service.
27
+ */
28
+ l10n: L10n;
24
29
  /**
25
30
  * - The maximum supported canvas size in
26
31
  * total pixels, i.e. width * height. Use `-1` for no limit, or `0` for
@@ -92,6 +97,7 @@ export type PDFThumbnailViewerOptions = {
92
97
  * @property {EventBus} eventBus - The application event bus.
93
98
  * @property {PDFLinkService} linkService - The navigation/linking service.
94
99
  * @property {PDFRenderingQueue} renderingQueue - The rendering queue object.
100
+ * @property {L10n} l10n - The localization service.
95
101
  * @property {number} [maxCanvasPixels] - The maximum supported canvas size in
96
102
  * total pixels, i.e. width * height. Use `-1` for no limit, or `0` for
97
103
  * CSS-only zooming. The default value is 4096 * 8192 (32 mega-pixels).
@@ -137,7 +143,7 @@ export class PDFThumbnailViewer {
137
143
  /**
138
144
  * @param {PDFThumbnailViewerOptions} options
139
145
  */
140
- constructor({ container, eventBus, linkService, renderingQueue, maxCanvasPixels, maxCanvasDim, pageColors, abortSignal, enableMerge, enableSplitMerge, enableNewBadge, statusBar, undoBar, waitingBar, manageMenu, addFileComponent, }: PDFThumbnailViewerOptions);
146
+ constructor({ container, eventBus, linkService, renderingQueue, l10n, maxCanvasPixels, maxCanvasDim, pageColors, abortSignal, enableMerge, enableSplitMerge, enableNewBadge, statusBar, undoBar, waitingBar, manageMenu, addFileComponent, }: PDFThumbnailViewerOptions);
141
147
  scrollableContainer: HTMLElement | null;
142
148
  container: HTMLDivElement;
143
149
  eventBus: import("./event_utils.js").EventBus;
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "unpdf",
3
3
  "type": "module",
4
- "version": "2.1.0",
5
- "packageManager": "pnpm@12.16.1",
4
+ "version": "2.2.0",
6
5
  "description": "PDF extraction and rendering across all JavaScript runtimes",
7
6
  "author": "Johann Schopplich <hello@johannschopplich.com>",
8
7
  "license": "MIT",
@@ -50,39 +49,43 @@
50
49
  "engines": {
51
50
  "node": ">=24"
52
51
  },
53
- "scripts": {
54
- "build": "tsdown && node scripts/post-build.mjs",
55
- "build:pdfjs": "rolldown --config pdfjs.rolldown.config.ts && cp -R node_modules/pdfjs-dist/types dist && mkdir -p dist/licenses && cp node_modules/pdfjs-dist/LICENSE dist/licenses/LICENSE_PDFJS && cp node_modules/pdfjs-dist/wasm/LICENSE_*JBIG2 node_modules/pdfjs-dist/wasm/LICENSE_*OPENJPEG dist/licenses",
56
- "dev": "tsdown --watch",
57
- "lint": "eslint .",
58
- "lint:fix": "eslint . --fix",
59
- "release": "bumpp",
60
- "test": "vitest",
61
- "test:attw": "attw --pack --profile esm-only",
62
- "test:types": "tsc --noEmit",
63
- "test:types:dist": "tsc -p test/types/tsconfig.json"
64
- },
65
52
  "peerDependencies": {
66
- "@napi-rs/canvas": "^0.1.69 || ^1.0.0"
53
+ "@napi-rs/canvas": "^0.1.69 || ^1.0.0",
54
+ "pdfjs-dist": "*"
67
55
  },
68
56
  "peerDependenciesMeta": {
69
57
  "@napi-rs/canvas": {
70
58
  "optional": true
59
+ },
60
+ "pdfjs-dist": {
61
+ "optional": true
71
62
  }
72
63
  },
73
64
  "devDependencies": {
74
65
  "@antfu/eslint-config": "^10.0.0",
75
66
  "@arethetypeswrong/cli": "^0.18.5",
76
- "@cloudflare/vitest-plugin": "^1.4.9",
77
- "@napi-rs/canvas": "^1.0.13",
78
- "@types/node": "^26.6.5",
67
+ "@cloudflare/vitest-plugin": "^1.8.1",
68
+ "@napi-rs/canvas": "^1.1.1",
69
+ "@types/node": "^26.6.6",
79
70
  "bumpp": "^12.3.0",
80
- "eslint": "^10.13.0",
81
- "pdfjs-dist": "~6.4.299",
82
- "rolldown": "^1.2.15",
71
+ "eslint": "^10.14.0",
72
+ "pdfjs-dist": "~6.5.438",
73
+ "rolldown": "^1.3.2",
83
74
  "tinyglobby": "^0.2.17",
84
- "tsdown": "^0.23.2",
75
+ "tsdown": "^0.23.7",
85
76
  "typescript": "^6.0.3",
86
- "vitest": "^5.0.5"
77
+ "vitest": "^5.1.0"
78
+ },
79
+ "scripts": {
80
+ "build": "tsdown && node scripts/post-build.mjs",
81
+ "build:pdfjs": "rolldown --config pdfjs.rolldown.config.ts && cp -R node_modules/pdfjs-dist/types dist && mkdir -p dist/licenses && cp node_modules/pdfjs-dist/LICENSE dist/licenses/LICENSE_PDFJS && cp node_modules/pdfjs-dist/wasm/LICENSE_*JBIG2 node_modules/pdfjs-dist/wasm/LICENSE_*OPENJPEG dist/licenses",
82
+ "dev": "tsdown --watch",
83
+ "lint": "eslint .",
84
+ "lint:fix": "eslint . --fix",
85
+ "release": "bumpp",
86
+ "test": "vitest",
87
+ "test:attw": "attw --pack --profile esm-only",
88
+ "test:types": "tsc --noEmit",
89
+ "test:types:dist": "tsc -p test/types/tsconfig.json"
87
90
  }
88
- }
91
+ }