@yudaocode/univer-pdfs 0.0.0-stage → 1.6.205
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/LICENSE +190 -0
- package/README.md +26 -2
- package/lib/cjs/facade/index.js +3607 -0
- package/lib/cjs/facade/index.js.map +1 -0
- package/lib/cjs/index.js +23106 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/jsx/index.js +12234 -0
- package/lib/cjs/jsx/index.js.map +1 -0
- package/lib/cjs/jsx/jsx-dev-runtime.js +82 -0
- package/lib/cjs/jsx/jsx-dev-runtime.js.map +1 -0
- package/lib/cjs/jsx/jsx-runtime.js +82 -0
- package/lib/cjs/jsx/jsx-runtime.js.map +1 -0
- package/lib/es/chunk-72OJSR4Z.js +15335 -0
- package/lib/es/chunk-72OJSR4Z.js.map +1 -0
- package/lib/es/chunk-CGOQSYGL.js +160 -0
- package/lib/es/chunk-CGOQSYGL.js.map +1 -0
- package/lib/es/facade/index.js +3681 -0
- package/lib/es/facade/index.js.map +1 -0
- package/lib/es/index.js +7809 -0
- package/lib/es/index.js.map +1 -0
- package/lib/es/jsx/index.js +81 -0
- package/lib/es/jsx/index.js.map +1 -0
- package/lib/es/jsx/jsx-dev-runtime.js +13 -0
- package/lib/es/jsx/jsx-dev-runtime.js.map +1 -0
- package/lib/es/jsx/jsx-runtime.js +13 -0
- package/lib/es/jsx/jsx-runtime.js.map +1 -0
- package/lib/types/facade/index.d.ts +1155 -0
- package/lib/types/index.d.ts +2025 -0
- package/lib/types/jsx/index.d.ts +45 -0
- package/lib/types/jsx/jsx-dev-runtime.d.ts +2 -0
- package/lib/types/jsx/jsx-runtime.d.ts +2 -0
- package/lib/types/jsx-dev-runtime-5tXCUq4v.d.ts +1484 -0
- package/package.json +94 -3
|
@@ -0,0 +1,1155 @@
|
|
|
1
|
+
import { PdfElementType, PdfAnnotationType, PdfListKind, PdfListPresetId, PdfTextAnchor, PdfTableCellVerticalAlign, PdfTableBorderStyle, PdfImageSourceType, PdfUnitModel, IPdfPageElement, IPdfElementTransform, IPdfTextStyle, IPdfRichTextSpan, IPdfDynamicFontSizeConfig, PdfTextFormatMode, IPdfParagraphBlock, IPdfNativeTextSpan, IPdfTableColumn, IPdfTableCellStyle, IPdfTableThemePreset, IPdfTableBorderWidths, IPdfTableMerge, IPdfImageCrop, IPdfImageElement, PdfAnnotationStatus, IPdfAnnotationReply, IPdfPage, IPdfPageSize, PdfPageRotation, IPdfDocument, IPdfUnitData, IValidatePdfTemplateSchemaOptions, IPdfTemplateSchemaValidationResult, IDiagnosePdfFontsOptions, IPdfFontDiagnosisReport, IPdfVariableValidationResult, ITemplateCjkReport, IPdfFieldContractHint, PdfDistributeDirection, IPdfAuditSealOptions, IPdfSignedAuditResult, IPdfAuditVerificationResult, IPdfIoCapabilities, PdfIoTarget, IPdfImportOutcome, IPdfExportOptions, ISilentPrintOptions, ISilentPrintResult, IPdfmeTemplate, PdfInteractionMode, IPdfVersionSnapshot, IPdfAnnotationElement, IPdfCropBox, IPdfBookmarkItem, IPdfBatesConfig, IPdfLayer, IPdfHeaderFooterConfig, IPdfWatermarkConfig, IPdfDocumentData, IPdfComparisonResult, IPdfFormValidationResult, IPdfOcrAdapter, IPdfOcrRecognizedBlock, IPdfDocxDocumentSnapshot, IPdfWorkbookSnapshot, IPdfSanitizeOptions, IPdfOptimizeUnitOptions, IPdfAttachment, IPdfSignerInfo, IPdfUnitSignatureVerificationResult, IPdfSecurityPermissions, IPdfIoAdapter, IPdfAiCopilotAdapter, IPdfImportSourceOptions } from '@yudaocode/univer-pdfs';
|
|
2
|
+
import { IEventBase, FUniver } from '@univerjs/core/facade';
|
|
3
|
+
import { ICommandService, Injector, ICreateUnitOptions } from '@univerjs/core';
|
|
4
|
+
|
|
5
|
+
interface IFEnumPdfsMixin {
|
|
6
|
+
PdfElementType: typeof PdfElementType;
|
|
7
|
+
PdfAnnotationType: typeof PdfAnnotationType;
|
|
8
|
+
PdfListKind: typeof PdfListKind;
|
|
9
|
+
PdfListPresetId: typeof PdfListPresetId;
|
|
10
|
+
PdfTextAnchor: typeof PdfTextAnchor;
|
|
11
|
+
PdfTableCellVerticalAlign: typeof PdfTableCellVerticalAlign;
|
|
12
|
+
PdfTableBorderStyle: typeof PdfTableBorderStyle;
|
|
13
|
+
PdfImageSourceType: typeof PdfImageSourceType;
|
|
14
|
+
}
|
|
15
|
+
declare class FEnumPdfsMixin {
|
|
16
|
+
get PdfElementType(): typeof PdfElementType;
|
|
17
|
+
get PdfAnnotationType(): typeof PdfAnnotationType;
|
|
18
|
+
get PdfListKind(): typeof PdfListKind;
|
|
19
|
+
get PdfListPresetId(): typeof PdfListPresetId;
|
|
20
|
+
get PdfTextAnchor(): typeof PdfTextAnchor;
|
|
21
|
+
get PdfTableCellVerticalAlign(): typeof PdfTableCellVerticalAlign;
|
|
22
|
+
get PdfTableBorderStyle(): typeof PdfTableBorderStyle;
|
|
23
|
+
get PdfImageSourceType(): typeof PdfImageSourceType;
|
|
24
|
+
}
|
|
25
|
+
declare module '@univerjs/core/facade' {
|
|
26
|
+
interface FEnum extends IFEnumPdfsMixin {
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Base object-oriented facade for any PDF page element.
|
|
32
|
+
*/
|
|
33
|
+
declare class FPdfPageElement {
|
|
34
|
+
protected readonly _pdfModel: PdfUnitModel;
|
|
35
|
+
protected readonly _commandService: ICommandService;
|
|
36
|
+
protected readonly _pageId: string;
|
|
37
|
+
protected readonly _elementId: string;
|
|
38
|
+
constructor(_pdfModel: PdfUnitModel, _commandService: ICommandService, _pageId: string, _elementId: string);
|
|
39
|
+
getId(): string;
|
|
40
|
+
getPageId(): string;
|
|
41
|
+
/** @internal */
|
|
42
|
+
_getInternalPdfModel(): PdfUnitModel;
|
|
43
|
+
/** @internal */
|
|
44
|
+
_getInternalCommandService(): ICommandService;
|
|
45
|
+
protected _readRaw(): IPdfPageElement;
|
|
46
|
+
exists(): boolean;
|
|
47
|
+
getType(): PdfElementType;
|
|
48
|
+
getName(): string | undefined;
|
|
49
|
+
setName(name: string): this;
|
|
50
|
+
getData(): IPdfPageElement;
|
|
51
|
+
getBounds(): {
|
|
52
|
+
left: number;
|
|
53
|
+
top: number;
|
|
54
|
+
width: number;
|
|
55
|
+
height: number;
|
|
56
|
+
angle: number;
|
|
57
|
+
};
|
|
58
|
+
getTransform(): IPdfElementTransform;
|
|
59
|
+
setTransform(patch: Partial<IPdfElementTransform>): this;
|
|
60
|
+
setPosition(left: number, top: number): this;
|
|
61
|
+
setSize(width: number, height: number): this;
|
|
62
|
+
setRotation(angle: number): this;
|
|
63
|
+
setFlip(flipX: boolean, flipY?: boolean): this;
|
|
64
|
+
setOpacity(opacity: number): this;
|
|
65
|
+
setLocked(locked: boolean): this;
|
|
66
|
+
setHidden(hidden: boolean): this;
|
|
67
|
+
isVisible(): boolean;
|
|
68
|
+
setVisible(visible: boolean): this;
|
|
69
|
+
private _reorderZIndex;
|
|
70
|
+
bringForward(): this;
|
|
71
|
+
bringToFront(): this;
|
|
72
|
+
sendBackward(): this;
|
|
73
|
+
sendToBack(): this;
|
|
74
|
+
update(patch: Partial<IPdfPageElement>): this;
|
|
75
|
+
remove(): boolean;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Object-oriented facade for a PDF paragraph element (or a `\n`-delimited paragraph inside an `FPdfTextBox`).
|
|
79
|
+
* Extends `FPdfPageElement` with structured inline block methods (`getBlocks`, `appendBlock`, `insertBlock`,
|
|
80
|
+
* `removeBlock`, `setBlockText`, `setBlockStyle`).
|
|
81
|
+
*/
|
|
82
|
+
declare class FPdfParagraph extends FPdfPageElement {
|
|
83
|
+
private readonly _paragraphIndex?;
|
|
84
|
+
private readonly _ownerTextBox?;
|
|
85
|
+
constructor(textBox: FPdfTextBox, paragraphIndex: number);
|
|
86
|
+
constructor(pdfModel: PdfUnitModel, commandService: ICommandService, pageId: string, elementId: string);
|
|
87
|
+
private _readTextEl;
|
|
88
|
+
getIndex(): number;
|
|
89
|
+
getTextBox(): FPdfTextBox;
|
|
90
|
+
getText(): string;
|
|
91
|
+
setText(text: string): this;
|
|
92
|
+
appendText(text: string): this;
|
|
93
|
+
getBlocks(): IPdfParagraphBlock[];
|
|
94
|
+
private _writeBlocks;
|
|
95
|
+
appendBlock(blockOrText: string | IPdfParagraphBlock, style?: Partial<IPdfTextStyle>): this;
|
|
96
|
+
insertBlock(index: number, blockOrText: string | IPdfParagraphBlock, style?: Partial<IPdfTextStyle>): this;
|
|
97
|
+
removeBlock(index: number): this;
|
|
98
|
+
setBlockText(index: number, text: string): this;
|
|
99
|
+
setBlockStyle(index: number, style: Partial<IPdfTextStyle>): this;
|
|
100
|
+
}
|
|
101
|
+
interface IFPdfTextSpanSource {
|
|
102
|
+
kind: 'element' | 'native';
|
|
103
|
+
elementId?: string;
|
|
104
|
+
startOffset: number;
|
|
105
|
+
endOffset: number;
|
|
106
|
+
matchedText: string;
|
|
107
|
+
bounds: {
|
|
108
|
+
left: number;
|
|
109
|
+
top: number;
|
|
110
|
+
width: number;
|
|
111
|
+
height: number;
|
|
112
|
+
};
|
|
113
|
+
nativeSpan?: IPdfNativeTextSpan;
|
|
114
|
+
siblingGroup?: {
|
|
115
|
+
invalidated: boolean;
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Represents a matched text span on a PDF page or inside an `FPdfTextBox`.
|
|
120
|
+
* Calling `replaceText()` mutates the underlying text box (or promotes a native PDF text span into an
|
|
121
|
+
* editable `FPdfTextBox`), marks this span stale, and returns the resulting `FPdfTextBox`.
|
|
122
|
+
*/
|
|
123
|
+
declare class FPdfTextSpan {
|
|
124
|
+
private readonly _pdfModel;
|
|
125
|
+
private readonly _commandService;
|
|
126
|
+
private readonly _pageId;
|
|
127
|
+
private readonly _source;
|
|
128
|
+
private _stale;
|
|
129
|
+
constructor(_pdfModel: PdfUnitModel, _commandService: ICommandService, _pageId: string, _source: IFPdfTextSpanSource);
|
|
130
|
+
getId(): string;
|
|
131
|
+
getPageId(): string;
|
|
132
|
+
getText(): string;
|
|
133
|
+
getTextRuns(): IPdfRichTextSpan[];
|
|
134
|
+
getStartOffset(): number;
|
|
135
|
+
getEndOffset(): number;
|
|
136
|
+
getBounds(): {
|
|
137
|
+
left: number;
|
|
138
|
+
top: number;
|
|
139
|
+
width: number;
|
|
140
|
+
height: number;
|
|
141
|
+
};
|
|
142
|
+
isStale(): boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Replaces this text span with `replacement`, marks the span stale so it cannot be reused with
|
|
145
|
+
* outdated offsets, and returns the owning/promoted `FPdfTextBox`.
|
|
146
|
+
*/
|
|
147
|
+
replaceText(replacement: string): FPdfTextBox;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Object-oriented facade for `PdfElementType.TEXT` text boxes.
|
|
151
|
+
*/
|
|
152
|
+
declare class FPdfTextBox extends FPdfPageElement {
|
|
153
|
+
private _readTextEl;
|
|
154
|
+
getText(): string;
|
|
155
|
+
setText(content: string): this;
|
|
156
|
+
getStyle(): IPdfTextStyle;
|
|
157
|
+
setStyle(stylePatch: Partial<IPdfTextStyle>): this;
|
|
158
|
+
getTextRuns(): IPdfRichTextSpan[];
|
|
159
|
+
setTextStyle(stylePatch: Partial<IPdfTextStyle>): this;
|
|
160
|
+
setTextStyle(startOffset: number, endOffset: number, stylePatch: Partial<IPdfTextStyle>): this;
|
|
161
|
+
setFontSize(fontSize: number): this;
|
|
162
|
+
setFontFamily(fontFamily: string): this;
|
|
163
|
+
setColor(color: string): this;
|
|
164
|
+
setBold(bold: boolean): this;
|
|
165
|
+
setItalic(italic: boolean): this;
|
|
166
|
+
setUnderline(underline: boolean): this;
|
|
167
|
+
setStrikethrough(strikethrough: boolean): this;
|
|
168
|
+
setCharacterSpacing(characterSpacing: number): this;
|
|
169
|
+
setTextAlign(textAlign: 'left' | 'center' | 'right' | 'justify'): this;
|
|
170
|
+
getDynamicFontSize(): IPdfDynamicFontSizeConfig | undefined;
|
|
171
|
+
setDynamicFontSize(config: IPdfDynamicFontSizeConfig | undefined): this;
|
|
172
|
+
getAnchor(): PdfTextAnchor | undefined;
|
|
173
|
+
setAnchor(anchor: PdfTextAnchor): this;
|
|
174
|
+
getTextAnchor(): PdfTextAnchor | undefined;
|
|
175
|
+
setTextAnchor(anchor: PdfTextAnchor): this;
|
|
176
|
+
getTextFormat(): PdfTextFormatMode;
|
|
177
|
+
setTextFormat(textFormat: PdfTextFormatMode): this;
|
|
178
|
+
getParagraphs(): FPdfParagraph[];
|
|
179
|
+
insertParagraph(text: string, index?: number): FPdfParagraph;
|
|
180
|
+
findText(query: string): FPdfTextSpan[];
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Object-oriented facade for `PdfElementType.LIST` bullet/ordered/check lists.
|
|
184
|
+
*/
|
|
185
|
+
declare class FPdfList extends FPdfPageElement {
|
|
186
|
+
private _readListEl;
|
|
187
|
+
getItems(): string[];
|
|
188
|
+
setItems(items: string[]): this;
|
|
189
|
+
addItem(item: string, index?: number): this;
|
|
190
|
+
insertItem(text: string, index?: number, level?: number): this;
|
|
191
|
+
insertItem(index: number, text: string, level?: number): this;
|
|
192
|
+
getItemLevel(index: number): number;
|
|
193
|
+
changeItemLevel(index: number, level: number): this;
|
|
194
|
+
setItemText(index: number, text: string): this;
|
|
195
|
+
removeItem(index: number): this;
|
|
196
|
+
getStartNumber(): number;
|
|
197
|
+
setStartNumber(startNumber: number): this;
|
|
198
|
+
getKind(): PdfListKind;
|
|
199
|
+
setKind(kind: PdfListKind | 'bullet' | 'ordered' | 'check'): this;
|
|
200
|
+
getPresetId(): PdfListPresetId | undefined;
|
|
201
|
+
setPreset(presetId: PdfListPresetId): this;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Object-oriented facade for an individual cell `(rowIndex, colIndex)` inside an `FPdfTable`.
|
|
205
|
+
*/
|
|
206
|
+
declare class FPdfTableCell {
|
|
207
|
+
private readonly _table;
|
|
208
|
+
private readonly _rowIndex;
|
|
209
|
+
private readonly _colIndex;
|
|
210
|
+
constructor(_table: FPdfTable, _rowIndex: number, _colIndex: number);
|
|
211
|
+
getTable(): FPdfTable;
|
|
212
|
+
getRowIndex(): number;
|
|
213
|
+
getColIndex(): number;
|
|
214
|
+
getValue(): unknown;
|
|
215
|
+
getText(): string;
|
|
216
|
+
setValue(value: unknown): this;
|
|
217
|
+
setText(text: string): this;
|
|
218
|
+
getStyle(): IPdfTableCellStyle;
|
|
219
|
+
setStyle(style: Partial<IPdfTableCellStyle>): this;
|
|
220
|
+
getVerticalAlign(): PdfTableCellVerticalAlign;
|
|
221
|
+
setVerticalAlign(align: PdfTableCellVerticalAlign): this;
|
|
222
|
+
}
|
|
223
|
+
interface IPdfTableFacadeStyle {
|
|
224
|
+
showHead: boolean;
|
|
225
|
+
borderColor?: string;
|
|
226
|
+
borderWidth?: number;
|
|
227
|
+
borderStyle?: PdfTableBorderStyle;
|
|
228
|
+
borderWidths?: IPdfTableBorderWidths;
|
|
229
|
+
zebraStripeColor?: string;
|
|
230
|
+
headerStyle?: IPdfTextStyle;
|
|
231
|
+
bodyStyle?: IPdfTextStyle;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Object-oriented facade for `PdfElementType.TABLE` structured tables.
|
|
235
|
+
*/
|
|
236
|
+
declare class FPdfTable extends FPdfPageElement {
|
|
237
|
+
private _readTableEl;
|
|
238
|
+
getRowCount(): number;
|
|
239
|
+
getColumnCount(): number;
|
|
240
|
+
getColumns(): IPdfTableColumn[];
|
|
241
|
+
getRows(): unknown[][];
|
|
242
|
+
getCell(rowIndex: number, colIndex: number): FPdfTableCell;
|
|
243
|
+
addRow(cells?: unknown[], index?: number): this;
|
|
244
|
+
removeRow(rowIndex: number): this;
|
|
245
|
+
addColumn(column: Partial<IPdfTableColumn> & {
|
|
246
|
+
header: string;
|
|
247
|
+
}, index?: number): this;
|
|
248
|
+
removeColumn(colIndex: number): this;
|
|
249
|
+
resize(rowCount: number, colCount: number): this;
|
|
250
|
+
getTheme(): string | undefined;
|
|
251
|
+
setTheme(presetOrId: string | IPdfTableThemePreset): this;
|
|
252
|
+
getStyle(): IPdfTableFacadeStyle;
|
|
253
|
+
setStyle(style: Partial<IPdfTableFacadeStyle>): this;
|
|
254
|
+
getMerges(): IPdfTableMerge[];
|
|
255
|
+
mergeCells(row: number, col: number, rowSpan: number, colSpan: number): this;
|
|
256
|
+
applyThemePreset(presetOrId: string | IPdfTableThemePreset): this;
|
|
257
|
+
setAvoidOrphanHeader(avoidOrphanHeader: boolean): this;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Detached image descriptor produced by `FPdfImageBuilder.build()`.
|
|
261
|
+
* Does not mutate the page until passed to `page.insertImage(info, index?)` or `info.insert(index?)`.
|
|
262
|
+
*/
|
|
263
|
+
interface IPdfImageBuilderInfo {
|
|
264
|
+
readonly __isPdfImageBuilderInfo: true;
|
|
265
|
+
source: string;
|
|
266
|
+
src: string;
|
|
267
|
+
resourceId?: string;
|
|
268
|
+
left: number;
|
|
269
|
+
top: number;
|
|
270
|
+
width: number;
|
|
271
|
+
height: number;
|
|
272
|
+
angle: number;
|
|
273
|
+
rotation: number;
|
|
274
|
+
fit: 'contain' | 'cover' | 'fill';
|
|
275
|
+
objectPosition: string;
|
|
276
|
+
crop?: IPdfImageCrop;
|
|
277
|
+
opacity: number;
|
|
278
|
+
altText?: string;
|
|
279
|
+
name?: string;
|
|
280
|
+
getSource(): string;
|
|
281
|
+
getSrc(): string;
|
|
282
|
+
getFit(): 'contain' | 'cover' | 'fill';
|
|
283
|
+
getObjectPosition(): string;
|
|
284
|
+
getOpacity(): number;
|
|
285
|
+
getCrop(): IPdfImageCrop | undefined;
|
|
286
|
+
insert(index?: number): FPdfImage;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Object-oriented facade for `PdfElementType.IMAGE` elements.
|
|
290
|
+
*/
|
|
291
|
+
declare class FPdfImage extends FPdfPageElement {
|
|
292
|
+
private _readImageEl;
|
|
293
|
+
getSrc(): string;
|
|
294
|
+
setSrc(src: string): this;
|
|
295
|
+
getSource(): string;
|
|
296
|
+
setSource(srcOrBytes: string | Uint8Array, mimeType?: 'image/png' | 'image/jpeg'): this;
|
|
297
|
+
getImageSourceType(): PdfImageSourceType;
|
|
298
|
+
getOpacity(): number;
|
|
299
|
+
getCrop(): IPdfImageCrop | undefined;
|
|
300
|
+
setCrop(crop: IPdfImageCrop | undefined): this;
|
|
301
|
+
getFit(): 'contain' | 'cover' | 'fill';
|
|
302
|
+
setFit(fit: 'contain' | 'cover' | 'fill'): this;
|
|
303
|
+
getObjectPosition(): string;
|
|
304
|
+
setObjectPosition(objectPosition: string): this;
|
|
305
|
+
getAltText(): string | undefined;
|
|
306
|
+
setAltText(altText: string): this;
|
|
307
|
+
toBuilder(): FPdfImageBuilder;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Fluent builder for configuring a detached `IPdfImageBuilderInfo` (via `build()`)
|
|
311
|
+
* or inserting an `FPdfImage` directly onto an `FPdfPage` (via `insert()` or `page.insertImage(builder.build())`).
|
|
312
|
+
*/
|
|
313
|
+
declare class FPdfImageBuilder {
|
|
314
|
+
private readonly _pdfModel;
|
|
315
|
+
private readonly _commandService;
|
|
316
|
+
private readonly _pageId;
|
|
317
|
+
private _src;
|
|
318
|
+
private _resourceId?;
|
|
319
|
+
private _left;
|
|
320
|
+
private _top;
|
|
321
|
+
private _width;
|
|
322
|
+
private _height;
|
|
323
|
+
private _fit;
|
|
324
|
+
private _objectPosition;
|
|
325
|
+
private _crop?;
|
|
326
|
+
private _angle;
|
|
327
|
+
private _opacity;
|
|
328
|
+
private _altText?;
|
|
329
|
+
private _name?;
|
|
330
|
+
constructor(_pdfModel: PdfUnitModel, _commandService: ICommandService, _pageId: string, existing?: FPdfImage | IPdfImageElement | Partial<IPdfImageBuilderInfo>);
|
|
331
|
+
setSource(srcOrBytes: string | Uint8Array, mimeType?: 'image/png' | 'image/jpeg'): this;
|
|
332
|
+
setPosition(left: number, top: number): this;
|
|
333
|
+
setAbsolutePosition(left: number, top: number): this;
|
|
334
|
+
setSize(width: number, height: number): this;
|
|
335
|
+
setFit(fit: 'contain' | 'cover' | 'fill'): this;
|
|
336
|
+
setObjectPosition(objectPosition: string): this;
|
|
337
|
+
setRotation(angle: number): this;
|
|
338
|
+
setCrop(crop: IPdfImageCrop | undefined): this;
|
|
339
|
+
setOpacity(opacity: number): this;
|
|
340
|
+
setAltText(altText: string): this;
|
|
341
|
+
setName(name: string): this;
|
|
342
|
+
/**
|
|
343
|
+
* Builds a detached `IPdfImageBuilderInfo` descriptor without mutating the page.
|
|
344
|
+
* Pass the returned object to `page.insertImage(info, index?)` (or call `info.insert(index?)`) to insert.
|
|
345
|
+
*/
|
|
346
|
+
build(): IPdfImageBuilderInfo;
|
|
347
|
+
buildAsync(): Promise<IPdfImageBuilderInfo>;
|
|
348
|
+
private _insertFromInfo;
|
|
349
|
+
/**
|
|
350
|
+
* Materializes this builder directly onto the page as an `FPdfImage`.
|
|
351
|
+
*/
|
|
352
|
+
insert(index?: number): FPdfImage;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Object-oriented facade for `PdfElementType.LINE` horizontal/vector dividers.
|
|
356
|
+
*/
|
|
357
|
+
declare class FPdfDivider extends FPdfPageElement {
|
|
358
|
+
private _readLineEl;
|
|
359
|
+
getStrokeColor(): string;
|
|
360
|
+
setStrokeColor(strokeColor: string): this;
|
|
361
|
+
getStrokeWidth(): number;
|
|
362
|
+
setStrokeWidth(strokeWidth: number): this;
|
|
363
|
+
setDashArray(dashArray?: number[]): this;
|
|
364
|
+
setArrows(startArrow: boolean, endArrow: boolean): this;
|
|
365
|
+
getStroke(): {
|
|
366
|
+
color: string;
|
|
367
|
+
width: number;
|
|
368
|
+
dashArray?: number[];
|
|
369
|
+
opacity: number;
|
|
370
|
+
};
|
|
371
|
+
setStroke(stroke: {
|
|
372
|
+
color?: string;
|
|
373
|
+
strokeColor?: string;
|
|
374
|
+
width?: number;
|
|
375
|
+
strokeWidth?: number;
|
|
376
|
+
dashArray?: number[];
|
|
377
|
+
opacity?: number;
|
|
378
|
+
}): this;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Object-oriented facade for `PdfElementType.ANNOTATION` markup & review elements.
|
|
382
|
+
*/
|
|
383
|
+
declare class FPdfAnnotation extends FPdfPageElement {
|
|
384
|
+
private _readAnnotEl;
|
|
385
|
+
getAnnotationType(): PdfAnnotationType;
|
|
386
|
+
setAnnotationType(annotationType: PdfAnnotationType): this;
|
|
387
|
+
getComment(): string;
|
|
388
|
+
setComment(comment: string): this;
|
|
389
|
+
getAuthor(): string;
|
|
390
|
+
setAuthor(author: string): this;
|
|
391
|
+
getStatus(): PdfAnnotationStatus | undefined;
|
|
392
|
+
setStatus(status: PdfAnnotationStatus): this;
|
|
393
|
+
setColor(color: string): this;
|
|
394
|
+
getStyle(): {
|
|
395
|
+
color?: string;
|
|
396
|
+
opacity?: number;
|
|
397
|
+
annotationType: PdfAnnotationType;
|
|
398
|
+
};
|
|
399
|
+
setStyle(style: {
|
|
400
|
+
color?: string;
|
|
401
|
+
opacity?: number;
|
|
402
|
+
annotationType?: PdfAnnotationType;
|
|
403
|
+
}): this;
|
|
404
|
+
getMarkup(): {
|
|
405
|
+
annotationType: PdfAnnotationType;
|
|
406
|
+
bounds: {
|
|
407
|
+
left: number;
|
|
408
|
+
top: number;
|
|
409
|
+
width: number;
|
|
410
|
+
height: number;
|
|
411
|
+
angle: number;
|
|
412
|
+
};
|
|
413
|
+
color?: string;
|
|
414
|
+
opacity?: number;
|
|
415
|
+
comment: string;
|
|
416
|
+
author: string;
|
|
417
|
+
};
|
|
418
|
+
getInk(): Array<Array<{
|
|
419
|
+
x: number;
|
|
420
|
+
y: number;
|
|
421
|
+
}>>;
|
|
422
|
+
getReplies(): IPdfAnnotationReply[];
|
|
423
|
+
addReply(author: string, content: string): IPdfAnnotationReply;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Instantiates the most specific typed `FPdfPageElement` subclass for an `IPdfPageElement`.
|
|
427
|
+
*/
|
|
428
|
+
declare function wrapPdfElementFacade(pdfModel: PdfUnitModel, commandService: ICommandService, pageId: string, el: IPdfPageElement): FPdfPageElement;
|
|
429
|
+
|
|
430
|
+
interface IInsertPdfTextBoxOptions {
|
|
431
|
+
text?: string;
|
|
432
|
+
content?: string;
|
|
433
|
+
name?: string;
|
|
434
|
+
left?: number;
|
|
435
|
+
top?: number;
|
|
436
|
+
width?: number;
|
|
437
|
+
height?: number;
|
|
438
|
+
angle?: number;
|
|
439
|
+
style?: Partial<IPdfTextStyle>;
|
|
440
|
+
dynamicFontSize?: IPdfDynamicFontSizeConfig;
|
|
441
|
+
linkUrl?: string;
|
|
442
|
+
linkDest?: string;
|
|
443
|
+
index?: number;
|
|
444
|
+
}
|
|
445
|
+
interface IInsertPdfParagraphOptions {
|
|
446
|
+
text?: string;
|
|
447
|
+
blocks?: IPdfParagraphBlock[];
|
|
448
|
+
name?: string;
|
|
449
|
+
left?: number;
|
|
450
|
+
top?: number;
|
|
451
|
+
width?: number;
|
|
452
|
+
height?: number;
|
|
453
|
+
style?: Partial<IPdfTextStyle>;
|
|
454
|
+
index?: number;
|
|
455
|
+
}
|
|
456
|
+
interface IInsertPdfListOptions {
|
|
457
|
+
items?: string[];
|
|
458
|
+
kind?: PdfListKind | 'bullet' | 'ordered' | 'check';
|
|
459
|
+
listType?: 'bullet' | 'ordered' | 'check';
|
|
460
|
+
presetId?: PdfListPresetId;
|
|
461
|
+
startNumber?: number;
|
|
462
|
+
itemLevels?: number[];
|
|
463
|
+
left?: number;
|
|
464
|
+
top?: number;
|
|
465
|
+
width?: number;
|
|
466
|
+
height?: number;
|
|
467
|
+
style?: Partial<IPdfTextStyle>;
|
|
468
|
+
index?: number;
|
|
469
|
+
}
|
|
470
|
+
interface IInsertPdfTableOptions {
|
|
471
|
+
rows?: number | unknown[][];
|
|
472
|
+
columns?: number | string[] | IPdfTableColumn[];
|
|
473
|
+
headers?: string[];
|
|
474
|
+
showHead?: boolean;
|
|
475
|
+
borderColor?: string;
|
|
476
|
+
borderWidth?: number;
|
|
477
|
+
borderStyle?: PdfTableBorderStyle;
|
|
478
|
+
borderWidths?: IPdfTableBorderWidths;
|
|
479
|
+
merges?: IPdfTableMerge[];
|
|
480
|
+
cellStyles?: Record<string, IPdfTableCellStyle>;
|
|
481
|
+
left?: number;
|
|
482
|
+
top?: number;
|
|
483
|
+
width?: number;
|
|
484
|
+
height?: number;
|
|
485
|
+
index?: number;
|
|
486
|
+
}
|
|
487
|
+
interface IInsertPdfImageOptions {
|
|
488
|
+
source?: string | Uint8Array;
|
|
489
|
+
src?: string | Uint8Array;
|
|
490
|
+
left?: number;
|
|
491
|
+
top?: number;
|
|
492
|
+
width?: number;
|
|
493
|
+
height?: number;
|
|
494
|
+
angle?: number;
|
|
495
|
+
rotation?: number;
|
|
496
|
+
fit?: 'contain' | 'cover' | 'fill';
|
|
497
|
+
objectPosition?: string;
|
|
498
|
+
crop?: IPdfImageCrop;
|
|
499
|
+
opacity?: number;
|
|
500
|
+
altText?: string;
|
|
501
|
+
name?: string;
|
|
502
|
+
index?: number;
|
|
503
|
+
}
|
|
504
|
+
interface IInsertPdfAnnotationOptions {
|
|
505
|
+
type?: PdfAnnotationType;
|
|
506
|
+
annotationType?: PdfAnnotationType;
|
|
507
|
+
left?: number;
|
|
508
|
+
top?: number;
|
|
509
|
+
width?: number;
|
|
510
|
+
height?: number;
|
|
511
|
+
comment?: string;
|
|
512
|
+
author?: string;
|
|
513
|
+
color?: string;
|
|
514
|
+
opacity?: number;
|
|
515
|
+
index?: number;
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Object-oriented facade for an individual PDF page (`IPdfPage`).
|
|
519
|
+
*/
|
|
520
|
+
declare class FPdfPage {
|
|
521
|
+
private readonly _pdfModel;
|
|
522
|
+
private readonly _commandService;
|
|
523
|
+
private readonly _pageId;
|
|
524
|
+
constructor(_pdfModel: PdfUnitModel, _commandService: ICommandService, _pageId: string);
|
|
525
|
+
getId(): string;
|
|
526
|
+
private _readPageMeta;
|
|
527
|
+
getData(): IPdfPage;
|
|
528
|
+
getIndex(): number;
|
|
529
|
+
getPageNumber(): number;
|
|
530
|
+
getTitle(): string;
|
|
531
|
+
setTitle(title: string): this;
|
|
532
|
+
getSize(): IPdfPageSize;
|
|
533
|
+
setSize(pageSize: IPdfPageSize): this;
|
|
534
|
+
getRotation(): PdfPageRotation;
|
|
535
|
+
setRotation(rotation: PdfPageRotation): this;
|
|
536
|
+
setBackgroundColor(backgroundColor: string): this;
|
|
537
|
+
getElements(): FPdfPageElement[];
|
|
538
|
+
getElementById(elementId: string): FPdfPageElement | null;
|
|
539
|
+
getTextBoxes(): FPdfTextBox[];
|
|
540
|
+
getParagraphs(): FPdfParagraph[];
|
|
541
|
+
getLists(): FPdfList[];
|
|
542
|
+
getTables(): FPdfTable[];
|
|
543
|
+
getImages(): FPdfImage[];
|
|
544
|
+
getDividers(): FPdfDivider[];
|
|
545
|
+
getAnnotations(): FPdfAnnotation[];
|
|
546
|
+
insertTextBox(options: IInsertPdfTextBoxOptions): FPdfTextBox;
|
|
547
|
+
insertTextBox(content: string, bounds?: Partial<{
|
|
548
|
+
left: number;
|
|
549
|
+
top: number;
|
|
550
|
+
width: number;
|
|
551
|
+
height: number;
|
|
552
|
+
}>, style?: Partial<IPdfTextStyle>): FPdfTextBox;
|
|
553
|
+
insertParagraph(options: IInsertPdfParagraphOptions): FPdfParagraph;
|
|
554
|
+
insertParagraph(text: string, bounds?: Partial<{
|
|
555
|
+
left: number;
|
|
556
|
+
top: number;
|
|
557
|
+
width: number;
|
|
558
|
+
height: number;
|
|
559
|
+
}>, style?: Partial<IPdfTextStyle>): FPdfParagraph;
|
|
560
|
+
insertList(options: IInsertPdfListOptions): FPdfList;
|
|
561
|
+
insertList(items: string[], options?: {
|
|
562
|
+
kind?: PdfListKind | 'bullet' | 'ordered' | 'check';
|
|
563
|
+
presetId?: PdfListPresetId;
|
|
564
|
+
startNumber?: number;
|
|
565
|
+
itemLevels?: number[];
|
|
566
|
+
left?: number;
|
|
567
|
+
top?: number;
|
|
568
|
+
width?: number;
|
|
569
|
+
height?: number;
|
|
570
|
+
style?: Partial<IPdfTextStyle>;
|
|
571
|
+
index?: number;
|
|
572
|
+
}): FPdfList;
|
|
573
|
+
insertTable(options: IInsertPdfTableOptions): FPdfTable;
|
|
574
|
+
insertTable(rowsOrCount: number | unknown[][], colsOrHeaders?: number | string[] | IPdfTableColumn[], bounds?: Partial<{
|
|
575
|
+
left: number;
|
|
576
|
+
top: number;
|
|
577
|
+
width: number;
|
|
578
|
+
height: number;
|
|
579
|
+
}>): FPdfTable;
|
|
580
|
+
newImage(existing?: FPdfImage | IPdfImageElement | Partial<IPdfImageBuilderInfo>): FPdfImageBuilder;
|
|
581
|
+
insertImage(info: IPdfImageBuilderInfo, index?: number): FPdfImage;
|
|
582
|
+
insertImage(options: IInsertPdfImageOptions): FPdfImage;
|
|
583
|
+
insertImage(srcOrBytes: string | Uint8Array, bounds?: Partial<{
|
|
584
|
+
left: number;
|
|
585
|
+
top: number;
|
|
586
|
+
width: number;
|
|
587
|
+
height: number;
|
|
588
|
+
fit: 'contain' | 'cover' | 'fill';
|
|
589
|
+
objectPosition: string;
|
|
590
|
+
}>, index?: number): FPdfImage;
|
|
591
|
+
insertImageAsync(sourceOrInfo: File | Blob | Uint8Array | ArrayBuffer | string | IPdfImageBuilderInfo, optionsOrIndex?: Omit<IInsertPdfImageOptions, 'source' | 'src'> | number): Promise<FPdfImage>;
|
|
592
|
+
insertDivider(bounds?: Partial<{
|
|
593
|
+
left: number;
|
|
594
|
+
top: number;
|
|
595
|
+
width: number;
|
|
596
|
+
height: number;
|
|
597
|
+
strokeColor: string;
|
|
598
|
+
strokeWidth: number;
|
|
599
|
+
dashArray: number[];
|
|
600
|
+
index: number;
|
|
601
|
+
}>): FPdfDivider;
|
|
602
|
+
insertAnnotation(options: IInsertPdfAnnotationOptions): FPdfAnnotation;
|
|
603
|
+
insertAnnotation(annotationType: PdfAnnotationType, bounds?: Partial<{
|
|
604
|
+
left: number;
|
|
605
|
+
top: number;
|
|
606
|
+
width: number;
|
|
607
|
+
height: number;
|
|
608
|
+
}>, options?: {
|
|
609
|
+
comment?: string;
|
|
610
|
+
author?: string;
|
|
611
|
+
color?: string;
|
|
612
|
+
opacity?: number;
|
|
613
|
+
}): FPdfAnnotation;
|
|
614
|
+
/**
|
|
615
|
+
* Returns all text spans on this page (both editable `TEXT` / `PARAGRAPH` elements and native base-PDF text spans).
|
|
616
|
+
* When `query` is provided, filters to matched substring spans via `findText(query)`.
|
|
617
|
+
*/
|
|
618
|
+
getTextSpans(query?: string): FPdfTextSpan[];
|
|
619
|
+
/**
|
|
620
|
+
* Searches both editable `TEXT`/`PARAGRAPH` elements and native imported base-PDF text spans on this page,
|
|
621
|
+
* returning `FPdfTextSpan` instances that support safe `replaceText()`.
|
|
622
|
+
*/
|
|
623
|
+
findText(query: string): FPdfTextSpan[];
|
|
624
|
+
remove(): boolean;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
interface IFPdfHealthDiagnosisReport {
|
|
628
|
+
healthy: boolean;
|
|
629
|
+
schema: IPdfTemplateSchemaValidationResult;
|
|
630
|
+
fonts: IPdfFontDiagnosisReport;
|
|
631
|
+
variables: IPdfVariableValidationResult;
|
|
632
|
+
cjk: ITemplateCjkReport;
|
|
633
|
+
contractHints: IPdfFieldContractHint[];
|
|
634
|
+
}
|
|
635
|
+
declare class FPdf {
|
|
636
|
+
private readonly _pdfModel;
|
|
637
|
+
private readonly _injector;
|
|
638
|
+
private readonly _commandService;
|
|
639
|
+
constructor(_pdfModel: PdfUnitModel, _injector: Injector, _commandService: ICommandService);
|
|
640
|
+
getId(): string;
|
|
641
|
+
getModel(): PdfUnitModel;
|
|
642
|
+
getName(): string;
|
|
643
|
+
setName(name: string): void;
|
|
644
|
+
/**
|
|
645
|
+
* Returns immutable document structure baseline (`pages`, `pageOrder`, `pageSize`).
|
|
646
|
+
*/
|
|
647
|
+
getDocument(): IPdfDocument;
|
|
648
|
+
/**
|
|
649
|
+
* Returns object-oriented `FPdfPage` facades for every page in `pageOrder`.
|
|
650
|
+
*/
|
|
651
|
+
getPages(): FPdfPage[];
|
|
652
|
+
/**
|
|
653
|
+
* Returns the `FPdfPage` facade matching `pageId`, or `null` if not found.
|
|
654
|
+
*/
|
|
655
|
+
getPageById(pageId: string): FPdfPage | null;
|
|
656
|
+
/**
|
|
657
|
+
* Returns the `FPdfPage` facade at 0-based `index`, or `null` if out of range.
|
|
658
|
+
*/
|
|
659
|
+
getPageByIndex(index: number): FPdfPage | null;
|
|
660
|
+
/**
|
|
661
|
+
* Inserts a new page at 0-based `index` (or at the end when omitted) via `ICommandService`
|
|
662
|
+
* and returns its `FPdfPage` facade.
|
|
663
|
+
*/
|
|
664
|
+
insertPage(index?: number, page?: Partial<IPdfPage>): FPdfPage;
|
|
665
|
+
/**
|
|
666
|
+
* Appends pages from another PDF binary (`Uint8Array`, `ArrayBuffer`, `Blob`, Base64/Data URI)
|
|
667
|
+
* or another `IPdfUnitData` snapshot onto the end of this document (Undo/Redo-safe),
|
|
668
|
+
* returning the newly appended `FPdfPage[]` instances.
|
|
669
|
+
*/
|
|
670
|
+
appendPdf(source: Uint8Array | ArrayBuffer | Blob | string | IPdfUnitData, options?: {
|
|
671
|
+
password?: string;
|
|
672
|
+
}): Promise<FPdfPage[]>;
|
|
673
|
+
/**
|
|
674
|
+
* Validates this document's template schema structure, field names, element types, and page bounds.
|
|
675
|
+
*/
|
|
676
|
+
validateTemplate(options?: IValidatePdfTemplateSchemaOptions): IPdfTemplateSchemaValidationResult;
|
|
677
|
+
/**
|
|
678
|
+
* Runs a full template doctor health check (schema validation, font & CJK coverage, required variables, and input contracts).
|
|
679
|
+
*/
|
|
680
|
+
diagnoseHealth(options?: IDiagnosePdfFontsOptions & {
|
|
681
|
+
strict?: boolean;
|
|
682
|
+
}): IFPdfHealthDiagnosisReport;
|
|
683
|
+
private _isFlushingActiveEditor;
|
|
684
|
+
private _flushActiveEditingIfNeeded;
|
|
685
|
+
/**
|
|
686
|
+
* Compiles and returns the complete `IPdfUnitData` snapshot (baseline + durable `editState`),
|
|
687
|
+
* committing any active inline element editor first.
|
|
688
|
+
*/
|
|
689
|
+
save(): IPdfUnitData;
|
|
690
|
+
/**
|
|
691
|
+
* Triggers the configured `IPdfIoAdapter.onSave` hook to persist the snapshot to a backend host.
|
|
692
|
+
* Returns `true` if a host save hook was executed, or `false` if none was configured.
|
|
693
|
+
*/
|
|
694
|
+
saveToHost(): Promise<boolean>;
|
|
695
|
+
getActivePageId(): string | null;
|
|
696
|
+
setActivePage(pageId: string): void;
|
|
697
|
+
setPageSize(pageSize: IPdfPageSize): boolean;
|
|
698
|
+
addPage(page?: Partial<IPdfPage>): boolean;
|
|
699
|
+
addElement(elementType: PdfElementType, element?: Partial<IPdfPageElement>, pageId?: string): boolean;
|
|
700
|
+
updateElement(elementId: string, patch: Partial<IPdfPageElement>, pageId?: string): boolean;
|
|
701
|
+
deleteElements(elementIds: string[], pageId?: string): boolean;
|
|
702
|
+
/**
|
|
703
|
+
* Distributes 3+ selected (or explicitly listed) unlocked elements with equal spacing
|
|
704
|
+
* along the `'horizontal'` or `'vertical'` axis (Undo/Redo-safe).
|
|
705
|
+
*/
|
|
706
|
+
distributeElements(direction: PdfDistributeDirection, elementIds?: string[], pageId?: string): boolean;
|
|
707
|
+
/**
|
|
708
|
+
* Generates a `1mm / 5mm / 10mm` millimeter calibration ruler & crosshair test-sheet PDF
|
|
709
|
+
* matching this document's paper size (or an explicit `pageSize` override).
|
|
710
|
+
*/
|
|
711
|
+
exportCalibrationGridPdf(pageSize?: IPdfPageSize): Promise<Uint8Array>;
|
|
712
|
+
/**
|
|
713
|
+
* Exports a tamper-evident PDF binary embedded with a deterministic SHA-256 cryptographic audit seal.
|
|
714
|
+
*/
|
|
715
|
+
exportSignedPdf(sealOptions: IPdfAuditSealOptions, data?: Record<string, unknown>): Promise<IPdfSignedAuditResult>;
|
|
716
|
+
/**
|
|
717
|
+
* Verifies the SHA-256 cryptographic audit seal and page content stream integrity of a signed PDF binary.
|
|
718
|
+
*/
|
|
719
|
+
verifySignedPdf(pdfBytes: Uint8Array): Promise<IPdfAuditVerificationResult>;
|
|
720
|
+
/**
|
|
721
|
+
* Validates required template variables across all pages of this PDF document against `data`.
|
|
722
|
+
*/
|
|
723
|
+
validateVariables(data?: Record<string, unknown>): IPdfVariableValidationResult;
|
|
724
|
+
loadSnapshot(snapshot: IPdfUnitData): boolean;
|
|
725
|
+
getIoCapabilities(): IPdfIoCapabilities;
|
|
726
|
+
importPdfFile(file: File, options?: {
|
|
727
|
+
target?: PdfIoTarget;
|
|
728
|
+
}): Promise<IPdfImportOutcome>;
|
|
729
|
+
/**
|
|
730
|
+
* Generates standard PDF binary bytes (`Uint8Array`) with optional dynamic dataset data and export options.
|
|
731
|
+
* Supports explicit per-operation `options.target` (`'browser' | 'server' | 'auto'`) without mutating adapter state.
|
|
732
|
+
*/
|
|
733
|
+
exportPdf(data?: Record<string, unknown>, options?: {
|
|
734
|
+
target?: PdfIoTarget;
|
|
735
|
+
} & IPdfExportOptions): Promise<Uint8Array>;
|
|
736
|
+
/**
|
|
737
|
+
* Exports standard PDF bytes with interactive `AcroForm` widgets (`PDFTextField`, `PDFCheckBox`,
|
|
738
|
+
* `PDFRadioGroup`, `PDFDropdown`) enabled.
|
|
739
|
+
*/
|
|
740
|
+
exportInteractiveFormPdf(data?: Record<string, unknown>, options?: Omit<IPdfExportOptions, 'interactiveForm'>): Promise<Uint8Array>;
|
|
741
|
+
/**
|
|
742
|
+
* Extracts user-filled `AcroForm` field values from an interactive PDF binary and populates them
|
|
743
|
+
* into the current `FPdf` document snapshot (undoable).
|
|
744
|
+
*/
|
|
745
|
+
importAcroFormValues(pdfBytes: Uint8Array): Promise<Record<string, string | boolean>>;
|
|
746
|
+
/**
|
|
747
|
+
* Dispatches silent hardware printing via the configured `IPdfIoAdapter.onSilentPrint` bridge
|
|
748
|
+
* (e.g. Lodop / QZ-Tray / Yudao Print Agent). Throws `PdfIoTargetError` if unconfigured.
|
|
749
|
+
*/
|
|
750
|
+
silentPrint(options?: ISilentPrintOptions): Promise<ISilentPrintResult>;
|
|
751
|
+
/**
|
|
752
|
+
* Generates a millimeter-aligned receipt/waybill/voucher template from a natural-language prompt
|
|
753
|
+
* via `IPdfAiCopilotAdapter` (or built-in smart millimeter layout engine) and applies it to this document.
|
|
754
|
+
*/
|
|
755
|
+
generateTemplateByAi(prompt: string): Promise<IPdfUnitData>;
|
|
756
|
+
toPdfmeTemplate(): IPdfmeTemplate;
|
|
757
|
+
loadPdfmeTemplate(template: IPdfmeTemplate): boolean;
|
|
758
|
+
getInteractionMode(): PdfInteractionMode;
|
|
759
|
+
setInteractionMode(mode: PdfInteractionMode): void;
|
|
760
|
+
getFormValues(): Record<string, string | boolean>;
|
|
761
|
+
fillFormValues(values: Record<string, unknown>): boolean;
|
|
762
|
+
exportBatchPdf(records: Array<Record<string, unknown>>, options?: IPdfExportOptions): Promise<Uint8Array>;
|
|
763
|
+
saveVersion(label?: string): IPdfVersionSnapshot | null;
|
|
764
|
+
getVersions(): IPdfVersionSnapshot[];
|
|
765
|
+
restoreVersion(versionId: string): boolean;
|
|
766
|
+
/**
|
|
767
|
+
* Loads an imported base PDF (`Uint8Array` or Base64 / Data URI string), extracts all native text spans
|
|
768
|
+
* across pages, and stores both the base PDF background and `nativeTextSpansByPage` undoably.
|
|
769
|
+
*/
|
|
770
|
+
loadBasePdfWithNativeText(pdfBytes: Uint8Array | string): Promise<IPdfNativeTextSpan[]>;
|
|
771
|
+
/**
|
|
772
|
+
* Returns non-suppressed native text spans extracted from the base PDF (filtered by `pageId` when provided).
|
|
773
|
+
*/
|
|
774
|
+
getNativeTextSpans(pageId?: string): IPdfNativeTextSpan[];
|
|
775
|
+
/**
|
|
776
|
+
* Atomically suppresses a native base-PDF text span, covers its original bounding box,
|
|
777
|
+
* and inserts an editable `TEXT` element at the exact `{ left, top, width, height }`, returning the new element ID.
|
|
778
|
+
*/
|
|
779
|
+
replaceNativeText(spanId: string, newText: string, style?: Partial<IPdfTextStyle>): string | null;
|
|
780
|
+
/**
|
|
781
|
+
* Searches and replaces text across all `TEXT` elements and (by default) native base-PDF text spans
|
|
782
|
+
* in a single undoable operation, returning the total replacement count.
|
|
783
|
+
*/
|
|
784
|
+
findAndReplaceText(query: string, replacement: string, options?: {
|
|
785
|
+
matchCase?: boolean;
|
|
786
|
+
includeNativeText?: boolean;
|
|
787
|
+
}): number;
|
|
788
|
+
/**
|
|
789
|
+
* Inserts a review annotation (`highlight`, `underline`, `strikeout`, `squiggly`, or `stickyNote`)
|
|
790
|
+
* onto `pageId` (Undo/Redo-safe) and returns its created element ID.
|
|
791
|
+
*/
|
|
792
|
+
insertAnnotation(pageId: string, spec: Partial<Omit<IPdfAnnotationElement, 'type'>> & {
|
|
793
|
+
left?: number;
|
|
794
|
+
top?: number;
|
|
795
|
+
width?: number;
|
|
796
|
+
height?: number;
|
|
797
|
+
}): string | null;
|
|
798
|
+
/**
|
|
799
|
+
* Appends a threaded reply to an existing review annotation (Undo/Redo-safe).
|
|
800
|
+
*/
|
|
801
|
+
addAnnotationReply(pageId: string, elementId: string, reply: {
|
|
802
|
+
id?: string;
|
|
803
|
+
author: string;
|
|
804
|
+
content: string;
|
|
805
|
+
createdAt?: string;
|
|
806
|
+
}): IPdfAnnotationReply | null;
|
|
807
|
+
/**
|
|
808
|
+
* Updates the review workflow status (`open` | `accepted` | `rejected` | `resolved`) of an annotation (Undo/Redo-safe).
|
|
809
|
+
*/
|
|
810
|
+
setAnnotationStatus(pageId: string, elementId: string, status: PdfAnnotationStatus): boolean;
|
|
811
|
+
/**
|
|
812
|
+
* Returns all review annotations across `pageId` (or all pages in `pageOrder` when omitted).
|
|
813
|
+
*/
|
|
814
|
+
getAnnotations(pageId?: string): IPdfAnnotationElement[];
|
|
815
|
+
/**
|
|
816
|
+
* Inserts a permanent redaction blackout box onto `pageId` (Undo/Redo-safe), which draws an opaque
|
|
817
|
+
* redaction cover and strips intersecting `TEXT` / native base-PDF text on PDF export.
|
|
818
|
+
*/
|
|
819
|
+
insertRedaction(pageId: string, rect: {
|
|
820
|
+
left: number;
|
|
821
|
+
top: number;
|
|
822
|
+
width: number;
|
|
823
|
+
height: number;
|
|
824
|
+
}, overlayLabel?: string, fillColor?: string): string | null;
|
|
825
|
+
/**
|
|
826
|
+
* Sets clockwise page rotation (`0 | 90 | 180 | 270`) on `pageId` (Undo/Redo-safe).
|
|
827
|
+
*/
|
|
828
|
+
rotatePage(pageId: string, rotation: PdfPageRotation): boolean;
|
|
829
|
+
/**
|
|
830
|
+
* Reorders document pages according to `newPageOrder` (Undo/Redo-safe).
|
|
831
|
+
*/
|
|
832
|
+
reorderPages(newPageOrder: string[]): boolean;
|
|
833
|
+
/**
|
|
834
|
+
* Sets or clears the page `CropBox` (`{ left, top, width, height }` in pt) on `pageId` (Undo/Redo-safe).
|
|
835
|
+
*/
|
|
836
|
+
setPageCropBox(pageId: string, cropBox?: IPdfCropBox): boolean;
|
|
837
|
+
/**
|
|
838
|
+
* Exports a 1-based inclusive page range `[startPage..endPage]` of this document as standard PDF bytes.
|
|
839
|
+
*/
|
|
840
|
+
exportPageRangePdfBytes(startPage: number, endPage: number, data?: Record<string, unknown>, options?: IPdfExportOptions): Promise<Uint8Array>;
|
|
841
|
+
/**
|
|
842
|
+
* Configures navigable PDF `/Outlines` bookmarks tree on this document (Undo/Redo-safe).
|
|
843
|
+
*/
|
|
844
|
+
setBookmarks(bookmarks: IPdfBookmarkItem[]): boolean;
|
|
845
|
+
/**
|
|
846
|
+
* Returns the configured PDF `/Outlines` bookmarks tree.
|
|
847
|
+
*/
|
|
848
|
+
getBookmarks(): IPdfBookmarkItem[];
|
|
849
|
+
/**
|
|
850
|
+
* Configures or clears legal/archive Bates numbering (`metadata.batesConfig`, Undo/Redo-safe).
|
|
851
|
+
*/
|
|
852
|
+
setBatesConfig(batesConfig?: IPdfBatesConfig): boolean;
|
|
853
|
+
/**
|
|
854
|
+
* Returns the current Bates numbering configuration, if any.
|
|
855
|
+
*/
|
|
856
|
+
getBatesConfig(): IPdfBatesConfig | undefined;
|
|
857
|
+
/**
|
|
858
|
+
* Adds a named Optional Content Group (`/OCProperties`) layer (Undo/Redo-safe).
|
|
859
|
+
*/
|
|
860
|
+
addLayer(layer: string | (Partial<IPdfLayer> & {
|
|
861
|
+
name: string;
|
|
862
|
+
})): IPdfLayer | null;
|
|
863
|
+
/**
|
|
864
|
+
* Updates `visible`, `locked`, `printable`, or `name` on an existing PDF layer (Undo/Redo-safe).
|
|
865
|
+
*/
|
|
866
|
+
updateLayer(layerId: string, patch: Partial<Omit<IPdfLayer, 'id'>>): boolean;
|
|
867
|
+
/**
|
|
868
|
+
* Removes a named PDF layer and unassigns elements referencing it (Undo/Redo-safe).
|
|
869
|
+
*/
|
|
870
|
+
removeLayer(layerId: string): boolean;
|
|
871
|
+
/**
|
|
872
|
+
* Lists all named PDF Optional Content Group layers on this document.
|
|
873
|
+
*/
|
|
874
|
+
getLayers(): IPdfLayer[];
|
|
875
|
+
/**
|
|
876
|
+
* Assigns one or more elements to `layerId` (or clears assignment when `layerId` is undefined, Undo/Redo-safe).
|
|
877
|
+
*/
|
|
878
|
+
assignElementLayer(elementIdOrIds: string | string[], layerId?: string, pageId?: string): boolean;
|
|
879
|
+
setHeaderFooterConfig(headerFooterConfig?: IPdfHeaderFooterConfig): boolean;
|
|
880
|
+
getHeaderFooterConfig(): IPdfHeaderFooterConfig | undefined;
|
|
881
|
+
setWatermarkConfig(watermarkConfig?: IPdfWatermarkConfig): boolean;
|
|
882
|
+
getWatermarkConfig(): IPdfWatermarkConfig | undefined;
|
|
883
|
+
/**
|
|
884
|
+
* Compares this PDF document against another `IPdfDocumentData` snapshot or `FPdf` instance.
|
|
885
|
+
*/
|
|
886
|
+
compareWith(other: IPdfDocumentData | FPdf): IPdfComparisonResult;
|
|
887
|
+
/**
|
|
888
|
+
* Imports an existing interactive AcroForm PDF binary into this unit as editable form fields + `basePdf` (Undo/Redo-safe).
|
|
889
|
+
*/
|
|
890
|
+
importAcroFormPdf(pdfBytes: Uint8Array, options?: {
|
|
891
|
+
title?: string;
|
|
892
|
+
}): Promise<IPdfDocumentData>;
|
|
893
|
+
/**
|
|
894
|
+
* Auto-detects form fields on `pageIndex` (default `0` or active page) from native text labels
|
|
895
|
+
* ending with `:` / `:` or `____` underlines (Undo/Redo-safe).
|
|
896
|
+
*/
|
|
897
|
+
autoDetectFormFields(pageIndex?: number): IPdfPageElement[];
|
|
898
|
+
/**
|
|
899
|
+
* Evaluates all `calcExpression` formulas across named PDF form fields (Undo/Redo-safe).
|
|
900
|
+
*/
|
|
901
|
+
recalculateFormFields(): Record<string, string | boolean>;
|
|
902
|
+
/**
|
|
903
|
+
* Validates `required` and `validationPattern` constraints across all PDF form fields.
|
|
904
|
+
*/
|
|
905
|
+
validateFormFields(): IPdfFormValidationResult;
|
|
906
|
+
exportFormDataToXfdf(): string;
|
|
907
|
+
importFormDataFromXfdf(xfdfXml: string): boolean;
|
|
908
|
+
exportFormDataToFdf(): string;
|
|
909
|
+
importFormDataFromFdf(fdfContent: string): boolean;
|
|
910
|
+
registerOcrAdapter(adapter: IPdfOcrAdapter): void;
|
|
911
|
+
/**
|
|
912
|
+
* Runs the registered `IPdfOcrAdapter` on `pageIndex` in either `'searchable'` (`3 Tr` invisible text)
|
|
913
|
+
* or `'editable'` (`PdfElementType.TEXT` boxes) mode with full Undo/Redo support.
|
|
914
|
+
*/
|
|
915
|
+
applyOcrToPage(pageIndex: number, mode: 'searchable' | 'editable', adapter?: IPdfOcrAdapter): Promise<IPdfOcrRecognizedBlock[]>;
|
|
916
|
+
exportToDocxSnapshot(): IPdfDocxDocumentSnapshot;
|
|
917
|
+
exportToWorkbookSnapshot(): IPdfWorkbookSnapshot;
|
|
918
|
+
exportToDocxBytes(): Promise<Uint8Array>;
|
|
919
|
+
exportToCsv(): string;
|
|
920
|
+
sanitize(options?: IPdfSanitizeOptions): IPdfDocumentData;
|
|
921
|
+
optimize(options?: IPdfOptimizeUnitOptions): IPdfDocumentData;
|
|
922
|
+
getAttachments(): IPdfAttachment[];
|
|
923
|
+
setAttachments(attachments: IPdfAttachment[]): boolean;
|
|
924
|
+
addAttachment(spec: Omit<IPdfAttachment, 'id'> & {
|
|
925
|
+
id?: string;
|
|
926
|
+
}): IPdfAttachment | null;
|
|
927
|
+
removeAttachment(attachmentId: string): boolean;
|
|
928
|
+
signWithDigest(signerInfo: IPdfSignerInfo): IPdfDocumentData;
|
|
929
|
+
verifySignature(): IPdfUnitSignatureVerificationResult;
|
|
930
|
+
setSecurityPermissions(securityPermissions?: IPdfSecurityPermissions): boolean;
|
|
931
|
+
setComplianceOptions(opts: {
|
|
932
|
+
pdfACompliant?: boolean;
|
|
933
|
+
accessibilityTagged?: boolean;
|
|
934
|
+
}): boolean;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
interface IPdfLoadedEventParams extends IEventBase {
|
|
938
|
+
pdf: FPdf;
|
|
939
|
+
unitId: string;
|
|
940
|
+
}
|
|
941
|
+
interface IPdfDisposedEventParams extends IEventBase {
|
|
942
|
+
unitId: string;
|
|
943
|
+
}
|
|
944
|
+
interface IPdfPageChangedEventParams extends IEventBase {
|
|
945
|
+
pdf: FPdf;
|
|
946
|
+
unitId: string;
|
|
947
|
+
pageId: string | null;
|
|
948
|
+
page: FPdfPage | null;
|
|
949
|
+
}
|
|
950
|
+
interface IPdfElementSelectedEventParams extends IEventBase {
|
|
951
|
+
pdf: FPdf;
|
|
952
|
+
unitId: string;
|
|
953
|
+
pageId: string | null;
|
|
954
|
+
elementIds: string[];
|
|
955
|
+
elements: FPdfPageElement[];
|
|
956
|
+
}
|
|
957
|
+
interface IPdfFormFieldChangedEventParams extends IEventBase {
|
|
958
|
+
pdf: FPdf;
|
|
959
|
+
unitId: string;
|
|
960
|
+
pageId: string;
|
|
961
|
+
elementId: string;
|
|
962
|
+
fieldName: string;
|
|
963
|
+
value: unknown;
|
|
964
|
+
}
|
|
965
|
+
interface IBeforePdfExportEventParams extends IEventBase {
|
|
966
|
+
pdf?: FPdf;
|
|
967
|
+
unitId: string;
|
|
968
|
+
snapshot: IPdfUnitData;
|
|
969
|
+
data?: Record<string, unknown>;
|
|
970
|
+
options?: IPdfExportOptions;
|
|
971
|
+
}
|
|
972
|
+
interface IPdfExportedEventParams extends IEventBase {
|
|
973
|
+
pdf?: FPdf;
|
|
974
|
+
unitId: string;
|
|
975
|
+
bytes: Uint8Array;
|
|
976
|
+
byteLength: number;
|
|
977
|
+
}
|
|
978
|
+
interface IBeforePdfPrintEventParams extends IEventBase {
|
|
979
|
+
pdf?: FPdf;
|
|
980
|
+
unitId: string;
|
|
981
|
+
snapshot: IPdfUnitData;
|
|
982
|
+
mode?: 'browser' | 'silent';
|
|
983
|
+
options?: ISilentPrintOptions | IPdfExportOptions;
|
|
984
|
+
}
|
|
985
|
+
interface IFPdfEventNameMixin {
|
|
986
|
+
readonly PdfLoaded: 'PdfLoaded';
|
|
987
|
+
readonly PdfDisposed: 'PdfDisposed';
|
|
988
|
+
readonly PdfPageChanged: 'PdfPageChanged';
|
|
989
|
+
readonly PdfElementSelected: 'PdfElementSelected';
|
|
990
|
+
readonly PdfFormFieldChanged: 'PdfFormFieldChanged';
|
|
991
|
+
readonly BeforePdfExport: 'BeforePdfExport';
|
|
992
|
+
readonly PdfExported: 'PdfExported';
|
|
993
|
+
readonly BeforePdfPrint: 'BeforePdfPrint';
|
|
994
|
+
}
|
|
995
|
+
declare class FEventNamePdfsMixin implements IFPdfEventNameMixin {
|
|
996
|
+
get PdfLoaded(): 'PdfLoaded';
|
|
997
|
+
get PdfDisposed(): 'PdfDisposed';
|
|
998
|
+
get PdfPageChanged(): 'PdfPageChanged';
|
|
999
|
+
get PdfElementSelected(): 'PdfElementSelected';
|
|
1000
|
+
get PdfFormFieldChanged(): 'PdfFormFieldChanged';
|
|
1001
|
+
get BeforePdfExport(): 'BeforePdfExport';
|
|
1002
|
+
get PdfExported(): 'PdfExported';
|
|
1003
|
+
get BeforePdfPrint(): 'BeforePdfPrint';
|
|
1004
|
+
}
|
|
1005
|
+
interface IPdfEventParamConfig {
|
|
1006
|
+
PdfLoaded: IPdfLoadedEventParams;
|
|
1007
|
+
PdfDisposed: IPdfDisposedEventParams;
|
|
1008
|
+
PdfPageChanged: IPdfPageChangedEventParams;
|
|
1009
|
+
PdfElementSelected: IPdfElementSelectedEventParams;
|
|
1010
|
+
PdfFormFieldChanged: IPdfFormFieldChangedEventParams;
|
|
1011
|
+
BeforePdfExport: IBeforePdfExportEventParams;
|
|
1012
|
+
PdfExported: IPdfExportedEventParams;
|
|
1013
|
+
BeforePdfPrint: IBeforePdfPrintEventParams;
|
|
1014
|
+
}
|
|
1015
|
+
declare module '@univerjs/core/facade' {
|
|
1016
|
+
interface FEventName extends IFPdfEventNameMixin {
|
|
1017
|
+
}
|
|
1018
|
+
interface IEventParamConfig extends IPdfEventParamConfig {
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
interface IImportPdfToSnapshotOptions extends IPdfImportSourceOptions {
|
|
1023
|
+
unitId?: string;
|
|
1024
|
+
extractNativeText?: boolean;
|
|
1025
|
+
importAcroForm?: boolean;
|
|
1026
|
+
}
|
|
1027
|
+
interface IImportPdfToUnitIdOptions extends IImportPdfToSnapshotOptions {
|
|
1028
|
+
makeCurrent?: boolean;
|
|
1029
|
+
}
|
|
1030
|
+
type PdfAppendSource = File | Blob | Uint8Array | ArrayBuffer | string | IPdfUnitData;
|
|
1031
|
+
interface IFUniverPdfsMixin {
|
|
1032
|
+
/**
|
|
1033
|
+
* Creates a new `UNIVER_PDF` unit and returns its `FPdf` facade instance.
|
|
1034
|
+
*/
|
|
1035
|
+
createPdf(data?: Partial<IPdfUnitData>, options?: ICreateUnitOptions): FPdf;
|
|
1036
|
+
/**
|
|
1037
|
+
* Returns the currently active `FPdf` facade instance, or `null` if none is active.
|
|
1038
|
+
*/
|
|
1039
|
+
getActivePdf(): FPdf | null;
|
|
1040
|
+
/**
|
|
1041
|
+
* Returns the `FPdf` facade instance for the specified `unitId`, or `null` if not found.
|
|
1042
|
+
*/
|
|
1043
|
+
getPdf(unitId: string): FPdf | null;
|
|
1044
|
+
/**
|
|
1045
|
+
* Configures or replaces the pluggable Import / Export / Save / Silent-Print IO adapter at runtime.
|
|
1046
|
+
*/
|
|
1047
|
+
setPdfIoAdapter(adapter: IPdfIoAdapter): void;
|
|
1048
|
+
/**
|
|
1049
|
+
* Returns the currently active PDF IO adapter.
|
|
1050
|
+
*/
|
|
1051
|
+
getPdfIoAdapter(): IPdfIoAdapter;
|
|
1052
|
+
/**
|
|
1053
|
+
* Configures or replaces the AI Copilot adapter for receipt/ticket template generation.
|
|
1054
|
+
*/
|
|
1055
|
+
setPdfAiCopilotAdapter(adapter: IPdfAiCopilotAdapter): void;
|
|
1056
|
+
/**
|
|
1057
|
+
* Returns the currently active PDF AI Copilot adapter.
|
|
1058
|
+
*/
|
|
1059
|
+
getPdfAiCopilotAdapter(): IPdfAiCopilotAdapter;
|
|
1060
|
+
/**
|
|
1061
|
+
* Generates a millimeter-aligned PDF template from a natural-language prompt and creates a new `FPdf` unit.
|
|
1062
|
+
*/
|
|
1063
|
+
generateTemplateByAi(prompt: string, options?: ICreateUnitOptions): Promise<FPdf>;
|
|
1064
|
+
/**
|
|
1065
|
+
* Registers a pluggable OCR page recognition adapter (`IPdfOcrAdapter`).
|
|
1066
|
+
*/
|
|
1067
|
+
registerOcrAdapter(adapter: IPdfOcrAdapter): void;
|
|
1068
|
+
/**
|
|
1069
|
+
* Imports an existing interactive AcroForm PDF binary into a new `FPdf` unit.
|
|
1070
|
+
*/
|
|
1071
|
+
importAcroFormPdf(pdfBytes: Uint8Array, options?: {
|
|
1072
|
+
unitId?: string;
|
|
1073
|
+
title?: string;
|
|
1074
|
+
}, createOptions?: ICreateUnitOptions): Promise<FPdf>;
|
|
1075
|
+
/**
|
|
1076
|
+
* Strictly validates and imports a PDF source (`File | Blob | Uint8Array | ArrayBuffer | string`)
|
|
1077
|
+
* into a complete `IPdfUnitData` snapshot without creating a mounted unit.
|
|
1078
|
+
*/
|
|
1079
|
+
importPdfToSnapshotAsync(source: File | Blob | Uint8Array | ArrayBuffer | string, options?: IImportPdfToSnapshotOptions): Promise<IPdfUnitData>;
|
|
1080
|
+
/**
|
|
1081
|
+
* Strictly validates and imports a PDF source into a new `UNIVER_PDF` unit and returns its `unitId`.
|
|
1082
|
+
*/
|
|
1083
|
+
importPdfToUnitIdAsync(source: File | Blob | Uint8Array | ArrayBuffer | string, options?: IImportPdfToUnitIdOptions): Promise<string>;
|
|
1084
|
+
/**
|
|
1085
|
+
* Exports an `IPdfUnitData` snapshot directly to PDF bytes (`Uint8Array`) without requiring a mounted unit.
|
|
1086
|
+
*/
|
|
1087
|
+
exportPdfBySnapshotAsync(snapshot: IPdfUnitData, data?: Record<string, unknown>, options?: IPdfExportOptions): Promise<Uint8Array>;
|
|
1088
|
+
/**
|
|
1089
|
+
* Exports a mounted `UNIVER_PDF` unit identified by `unitId` to PDF bytes (`Uint8Array`).
|
|
1090
|
+
*/
|
|
1091
|
+
exportPdfByUnitIdAsync(unitId: string, data?: Record<string, unknown>, options?: {
|
|
1092
|
+
target?: PdfIoTarget;
|
|
1093
|
+
} & IPdfExportOptions): Promise<Uint8Array>;
|
|
1094
|
+
/**
|
|
1095
|
+
* Appends another PDF source onto `unitId` (or the active `FPdf` unit when omitted) and returns the appended `FPdfPage[]`.
|
|
1096
|
+
*/
|
|
1097
|
+
appendPdfAsync(source: File | Blob | Uint8Array | ArrayBuffer | IPdfUnitData, unitId?: string, options?: {
|
|
1098
|
+
password?: string;
|
|
1099
|
+
}): Promise<FPdfPage[]>;
|
|
1100
|
+
/**
|
|
1101
|
+
* Appends another PDF source or `IPdfUnitData` snapshot onto `targetUnitIdOrPdf` and returns the appended `FPdfPage[]`.
|
|
1102
|
+
*/
|
|
1103
|
+
appendPdfAsync(targetUnitIdOrPdf: string | FPdf, source?: PdfAppendSource, options?: {
|
|
1104
|
+
password?: string;
|
|
1105
|
+
}): Promise<FPdfPage[]>;
|
|
1106
|
+
/**
|
|
1107
|
+
* Exports `unitIdOrPdf` (or the currently active `FPdf` unit when omitted) to PDF bytes (`Uint8Array`).
|
|
1108
|
+
*/
|
|
1109
|
+
exportPdfAsync(unitIdOrPdf?: string | FPdf, data?: Record<string, unknown>, options?: {
|
|
1110
|
+
target?: PdfIoTarget;
|
|
1111
|
+
} & IPdfExportOptions): Promise<Uint8Array>;
|
|
1112
|
+
/**
|
|
1113
|
+
* Returns built-in neutral & accent table theme presets for `FPdfTable.applyThemePreset()`.
|
|
1114
|
+
*/
|
|
1115
|
+
getPdfTableThemePresets(): IPdfTableThemePreset[];
|
|
1116
|
+
}
|
|
1117
|
+
declare class FUniverPdfsMixin extends FUniver implements IFUniverPdfsMixin {
|
|
1118
|
+
private _pdfServiceEventsWired?;
|
|
1119
|
+
private _lastFormValuesByUnit?;
|
|
1120
|
+
private _getFormValuesByUnit;
|
|
1121
|
+
private _ensurePdfServiceEventWiring;
|
|
1122
|
+
_initialize(injector: Injector): void;
|
|
1123
|
+
createPdf(data?: Partial<IPdfUnitData>, options?: ICreateUnitOptions): FPdf;
|
|
1124
|
+
getActivePdf(): FPdf | null;
|
|
1125
|
+
getPdf(unitId: string): FPdf | null;
|
|
1126
|
+
setPdfIoAdapter(adapter: IPdfIoAdapter): void;
|
|
1127
|
+
getPdfIoAdapter(): IPdfIoAdapter;
|
|
1128
|
+
setPdfAiCopilotAdapter(adapter: IPdfAiCopilotAdapter): void;
|
|
1129
|
+
getPdfAiCopilotAdapter(): IPdfAiCopilotAdapter;
|
|
1130
|
+
generateTemplateByAi(prompt: string, options?: ICreateUnitOptions): Promise<FPdf>;
|
|
1131
|
+
registerOcrAdapter(adapter: IPdfOcrAdapter): void;
|
|
1132
|
+
importAcroFormPdf(pdfBytes: Uint8Array, options?: {
|
|
1133
|
+
unitId?: string;
|
|
1134
|
+
title?: string;
|
|
1135
|
+
}, createOptions?: ICreateUnitOptions): Promise<FPdf>;
|
|
1136
|
+
importPdfToSnapshotAsync(source: File | Blob | Uint8Array | ArrayBuffer | string, options?: IImportPdfToSnapshotOptions): Promise<IPdfUnitData>;
|
|
1137
|
+
importPdfToUnitIdAsync(source: File | Blob | Uint8Array | ArrayBuffer | string, options?: IImportPdfToUnitIdOptions): Promise<string>;
|
|
1138
|
+
exportPdfBySnapshotAsync(snapshot: IPdfUnitData, data?: Record<string, unknown>, options?: IPdfExportOptions): Promise<Uint8Array>;
|
|
1139
|
+
exportPdfByUnitIdAsync(unitId: string, data?: Record<string, unknown>, options?: {
|
|
1140
|
+
target?: PdfIoTarget;
|
|
1141
|
+
} & IPdfExportOptions): Promise<Uint8Array>;
|
|
1142
|
+
appendPdfAsync(arg1: string | FPdf | PdfAppendSource, arg2?: string | PdfAppendSource, options?: {
|
|
1143
|
+
password?: string;
|
|
1144
|
+
}): Promise<FPdfPage[]>;
|
|
1145
|
+
exportPdfAsync(unitIdOrPdf?: string | FPdf, data?: Record<string, unknown>, options?: {
|
|
1146
|
+
target?: PdfIoTarget;
|
|
1147
|
+
} & IPdfExportOptions): Promise<Uint8Array>;
|
|
1148
|
+
getPdfTableThemePresets(): IPdfTableThemePreset[];
|
|
1149
|
+
}
|
|
1150
|
+
declare module '@univerjs/core/facade' {
|
|
1151
|
+
interface FUniver extends IFUniverPdfsMixin {
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
export { FEnumPdfsMixin, FEventNamePdfsMixin, FPdf, FPdfAnnotation, FPdfDivider, FPdf as FPdfDocument, FPdfImage, FPdfImageBuilder, FPdfList, FPdfPage, FPdfPageElement, FPdfParagraph, FPdfTable, FPdfTableCell, FPdfTextBox, FPdfTextSpan, FUniverPdfsMixin, type IBeforePdfExportEventParams, type IBeforePdfPrintEventParams, type IFEnumPdfsMixin, type IFPdfEventNameMixin, type IFPdfHealthDiagnosisReport, type IFPdfTextSpanSource, type IFUniverPdfsMixin, type IImportPdfToSnapshotOptions, type IImportPdfToUnitIdOptions, type IInsertPdfAnnotationOptions, type IInsertPdfImageOptions, type IInsertPdfListOptions, type IInsertPdfParagraphOptions, type IInsertPdfTableOptions, type IInsertPdfTextBoxOptions, type IPdfDisposedEventParams, type IPdfElementSelectedEventParams, type IPdfEventParamConfig, type IPdfExportedEventParams, type IPdfFormFieldChangedEventParams, type IPdfImageBuilderInfo, type IPdfLoadedEventParams, type IPdfPageChangedEventParams, type IPdfTableFacadeStyle, type PdfAppendSource, wrapPdfElementFacade };
|