@yudaocode/univer-pdfs 1.6.214 → 1.6.216

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.
@@ -2526,20 +2526,27 @@ var FPdf = class {
2526
2526
  return this._injector.get(import_univer_pdfs4.IPdfIoService).getIoCapabilities();
2527
2527
  }
2528
2528
  async importPdfFile(file, options) {
2529
+ if (options?.signal?.aborted) {
2530
+ throw (0, import_univer_pdfs4.createPdfAbortError)(options.signal);
2531
+ }
2529
2532
  const ioService = this._injector.get(import_univer_pdfs4.IPdfIoService);
2530
2533
  const outcome = await ioService.importPdf(file, {
2531
2534
  unitId: this.getId(),
2532
2535
  snapshot: this.save(),
2533
- target: options?.target
2536
+ target: options?.target,
2537
+ password: options?.password,
2538
+ signal: options?.signal
2534
2539
  });
2535
- if (outcome.mode === "snapshot") {
2536
- this.loadSnapshot(outcome.snapshot);
2537
- } else {
2538
- this._commandService.syncExecuteCommand(import_univer_pdfs4.ImportPdfSourceCommand.id, {
2539
- unitId: this.getId(),
2540
- sourceDocumentRef: outcome.sourceDocumentRef,
2541
- pageSizes: outcome.pageSizes
2542
- });
2540
+ if (options?.signal?.aborted) {
2541
+ throw (0, import_univer_pdfs4.createPdfAbortError)(options.signal);
2542
+ }
2543
+ const applied = outcome.mode === "snapshot" ? this.loadSnapshot(outcome.snapshot) : this._commandService.syncExecuteCommand(import_univer_pdfs4.ImportPdfSourceCommand.id, {
2544
+ unitId: this.getId(),
2545
+ sourceDocumentRef: outcome.sourceDocumentRef,
2546
+ pageSizes: outcome.pageSizes
2547
+ });
2548
+ if (!applied) {
2549
+ throw new Error(`[UniverPdfs] Failed to apply imported PDF outcome onto unit "${this.getId()}".`);
2543
2550
  }
2544
2551
  return outcome;
2545
2552
  }
@@ -2553,7 +2560,8 @@ var FPdf = class {
2553
2560
  snapshot: this.save(),
2554
2561
  data,
2555
2562
  options,
2556
- target: options?.target
2563
+ target: options?.target,
2564
+ signal: options?.signal
2557
2565
  });
2558
2566
  }
2559
2567
  /**