@yudaocode/univer-pdfs 1.6.215 → 1.6.217
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/PDF_BROWSER_RENDERING_CONTRACT.md +288 -22
- package/fixtures/pdf-s1-s7-fidelity-v1.json +2010 -0
- package/lib/cjs/facade/index.js +18 -10
- package/lib/cjs/facade/index.js.map +1 -1
- package/lib/cjs/index.js +557 -100
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/jsx/index.js +143 -68
- package/lib/cjs/jsx/index.js.map +1 -1
- package/lib/es/{chunk-DYTQBEM7.js → chunk-EMSHTYYU.js} +148 -70
- package/lib/es/chunk-EMSHTYYU.js.map +1 -0
- package/lib/es/facade/index.js +19 -10
- package/lib/es/facade/index.js.map +1 -1
- package/lib/es/index.js +408 -32
- package/lib/es/index.js.map +1 -1
- package/lib/es/jsx/index.js +1 -1
- package/lib/types/facade/index.d.ts +3 -0
- package/lib/types/index.d.ts +74 -4
- package/lib/types/jsx/index.d.ts +2 -2
- package/lib/types/jsx/jsx-dev-runtime.d.ts +1 -1
- package/lib/types/jsx/jsx-runtime.d.ts +1 -1
- package/lib/types/{jsx-dev-runtime-BFeiWVJj.d.ts → jsx-dev-runtime-Dm72R_Vm.d.ts} +15 -1
- package/package.json +3 -1
- package/lib/es/chunk-DYTQBEM7.js.map +0 -1
package/lib/es/facade/index.js
CHANGED
|
@@ -115,6 +115,7 @@ import {
|
|
|
115
115
|
comparePdfUnits,
|
|
116
116
|
convertPdfBytesToDocxBytes,
|
|
117
117
|
convertPdfUnitToCsv,
|
|
118
|
+
createPdfAbortError,
|
|
118
119
|
DeleteSelectedPdfElementsCommand as DeleteSelectedPdfElementsCommand2,
|
|
119
120
|
detectFormFieldsFromPageSpans,
|
|
120
121
|
DistributeSelectedPdfElementsCommand,
|
|
@@ -2581,20 +2582,27 @@ var FPdf = class {
|
|
|
2581
2582
|
return this._injector.get(IPdfIoService).getIoCapabilities();
|
|
2582
2583
|
}
|
|
2583
2584
|
async importPdfFile(file, options) {
|
|
2585
|
+
if (options?.signal?.aborted) {
|
|
2586
|
+
throw createPdfAbortError(options.signal);
|
|
2587
|
+
}
|
|
2584
2588
|
const ioService = this._injector.get(IPdfIoService);
|
|
2585
2589
|
const outcome = await ioService.importPdf(file, {
|
|
2586
2590
|
unitId: this.getId(),
|
|
2587
2591
|
snapshot: this.save(),
|
|
2588
|
-
target: options?.target
|
|
2592
|
+
target: options?.target,
|
|
2593
|
+
password: options?.password,
|
|
2594
|
+
signal: options?.signal
|
|
2589
2595
|
});
|
|
2590
|
-
if (
|
|
2591
|
-
|
|
2592
|
-
}
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2596
|
+
if (options?.signal?.aborted) {
|
|
2597
|
+
throw createPdfAbortError(options.signal);
|
|
2598
|
+
}
|
|
2599
|
+
const applied = outcome.mode === "snapshot" ? this.loadSnapshot(outcome.snapshot) : this._commandService.syncExecuteCommand(ImportPdfSourceCommand.id, {
|
|
2600
|
+
unitId: this.getId(),
|
|
2601
|
+
sourceDocumentRef: outcome.sourceDocumentRef,
|
|
2602
|
+
pageSizes: outcome.pageSizes
|
|
2603
|
+
});
|
|
2604
|
+
if (!applied) {
|
|
2605
|
+
throw new Error(`[UniverPdfs] Failed to apply imported PDF outcome onto unit "${this.getId()}".`);
|
|
2598
2606
|
}
|
|
2599
2607
|
return outcome;
|
|
2600
2608
|
}
|
|
@@ -2608,7 +2616,8 @@ var FPdf = class {
|
|
|
2608
2616
|
snapshot: this.save(),
|
|
2609
2617
|
data,
|
|
2610
2618
|
options,
|
|
2611
|
-
target: options?.target
|
|
2619
|
+
target: options?.target,
|
|
2620
|
+
signal: options?.signal
|
|
2612
2621
|
});
|
|
2613
2622
|
}
|
|
2614
2623
|
/**
|