@mescius/wijmo.grid.pdf 5.20232.939
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/COMMERCIAL-LICENSE.html +485 -0
- package/README.md +363 -0
- package/es2015-commonjs.js +14 -0
- package/es2015-esm.js +14 -0
- package/es5-esm.js +14 -0
- package/index.d.ts +920 -0
- package/index.js +14 -0
- package/package.json +55 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,920 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
*
|
|
3
|
+
* Wijmo Library 5.20232.939
|
|
4
|
+
* https://developer.mescius.com/wijmo
|
|
5
|
+
*
|
|
6
|
+
* Copyright(c) MESCIUS inc. All rights reserved.
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the End-User License Agreement For MESCIUS Wijmo Software.
|
|
9
|
+
* us.sales@mescius.com
|
|
10
|
+
* https://developer.mescius.com/wijmo/licensing
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* {@module wijmo.grid.pdf}
|
|
15
|
+
* Defines the {@link FlexGridPdfConverter} class used to export the {@link FlexGrid} to PDF.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
export declare var ___keepComment: any;
|
|
21
|
+
import { CancelEventArgs, Color, Rect, Size, Point, EventArgs } from '@grapecity/wijmo';
|
|
22
|
+
import { CellRange, GridPanel } from '@grapecity/wijmo.grid';
|
|
23
|
+
import { PdfBrush, PdfPageArea, IPdfTag, IPdfTagContent, IPdfFontFile, IPdfDocumentOptions } from '@grapecity/wijmo.pdf';
|
|
24
|
+
import * as pdf from '@grapecity/wijmo.pdf';
|
|
25
|
+
import * as grid from '@grapecity/wijmo.grid';
|
|
26
|
+
import * as detail from '@grapecity/wijmo.grid.detail';
|
|
27
|
+
import * as multiRow from '@grapecity/wijmo.grid.multirow';
|
|
28
|
+
import * as sheet from '@grapecity/wijmo.grid.sheet';
|
|
29
|
+
import * as olap from '@grapecity/wijmo.olap';
|
|
30
|
+
import * as transposed from '@grapecity/wijmo.grid.transposed';
|
|
31
|
+
import * as transposedMultiRow from '@grapecity/wijmo.grid.transposedmultirow';
|
|
32
|
+
import * as selfModule from '@grapecity/wijmo.grid.pdf';
|
|
33
|
+
export declare function softGrid(): typeof grid;
|
|
34
|
+
export declare function softDetail(): typeof detail;
|
|
35
|
+
export declare function softMultiRow(): typeof multiRow;
|
|
36
|
+
export declare function softSheet(): typeof sheet;
|
|
37
|
+
export declare function softOlap(): typeof olap;
|
|
38
|
+
export declare function softTransposed(): typeof transposed;
|
|
39
|
+
export declare function softTransposedMultiRow(): typeof transposedMultiRow;
|
|
40
|
+
/**
|
|
41
|
+
* Specifies how the grid content should be scaled to fit the page.
|
|
42
|
+
*/
|
|
43
|
+
export declare enum ScaleMode {
|
|
44
|
+
/**
|
|
45
|
+
* Render the grid in actual size, breaking into pages as needed.
|
|
46
|
+
*/
|
|
47
|
+
ActualSize = 0,
|
|
48
|
+
/**
|
|
49
|
+
* Scale the grid, so that it fits the page width.
|
|
50
|
+
*/
|
|
51
|
+
PageWidth = 1,
|
|
52
|
+
/**
|
|
53
|
+
* Scale the grid, so that it fits on a single page.
|
|
54
|
+
*/
|
|
55
|
+
SinglePage = 2
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Specifies whether the whole grid or just a section should be rendered.
|
|
59
|
+
*/
|
|
60
|
+
export declare enum ExportMode {
|
|
61
|
+
/**
|
|
62
|
+
* Exports all the data from grid.
|
|
63
|
+
*/
|
|
64
|
+
All = 0,
|
|
65
|
+
/**
|
|
66
|
+
* Exports the current selection only.
|
|
67
|
+
*/
|
|
68
|
+
Selection = 1
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Represents the look and feel of a cell.
|
|
72
|
+
*/
|
|
73
|
+
export interface ICellStyle {
|
|
74
|
+
/**
|
|
75
|
+
* Represents the background color of a cell.
|
|
76
|
+
*/
|
|
77
|
+
backgroundColor?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Represents the border color of a cell.
|
|
80
|
+
*/
|
|
81
|
+
borderColor?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Represents the text color of a cell.
|
|
84
|
+
*/
|
|
85
|
+
color?: string;
|
|
86
|
+
/**
|
|
87
|
+
* Represents the font of a cell.
|
|
88
|
+
*/
|
|
89
|
+
font?: any;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Represents the look and feel of the {@link FlexGrid} being exported.
|
|
93
|
+
*/
|
|
94
|
+
export interface IFlexGridStyle {
|
|
95
|
+
/**
|
|
96
|
+
* Specifies the cell style applied to cells within a {@link FlexGrid}.
|
|
97
|
+
*/
|
|
98
|
+
cellStyle?: ICellStyle;
|
|
99
|
+
/**
|
|
100
|
+
* Represents the cell style applied to odd-numbered rows of the {@link FlexGrid}.
|
|
101
|
+
*/
|
|
102
|
+
altCellStyle?: ICellStyle;
|
|
103
|
+
/**
|
|
104
|
+
* Represents the cell style applied to grouped rows of the {@link FlexGrid}.
|
|
105
|
+
*/
|
|
106
|
+
groupCellStyle?: ICellStyle;
|
|
107
|
+
/**
|
|
108
|
+
* Represents the cell style applied to row headers and column headers of
|
|
109
|
+
* the {@link FlexGrid}.
|
|
110
|
+
*/
|
|
111
|
+
headerCellStyle?: ICellStyle;
|
|
112
|
+
/**
|
|
113
|
+
* Represents the cell style applied to column footers of the {@link FlexGrid}.
|
|
114
|
+
*/
|
|
115
|
+
footerCellStyle?: ICellStyle;
|
|
116
|
+
/**
|
|
117
|
+
* Represents the cell style applied to cells of the {@link FlexGrid} that contain
|
|
118
|
+
* validation errors if the {@link FlexGrid.showErrors} property is enabled.
|
|
119
|
+
*/
|
|
120
|
+
errorCellStyle?: ICellStyle;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Represents the settings used by the {@link FlexGridPdfConverter.draw} and
|
|
124
|
+
* {@link FlexGridPdfConverter.drawToPosition} methods.
|
|
125
|
+
*/
|
|
126
|
+
export interface IFlexGridDrawSettings {
|
|
127
|
+
/**
|
|
128
|
+
* Indicates whether custom cell content and style should be evaluated and exported.
|
|
129
|
+
* If set to true then export logic will retrieve cell content using cell.innerText property,
|
|
130
|
+
* and cell style using getComputedStyle(cell).
|
|
131
|
+
* Default is 'undefined' (i.e. false).
|
|
132
|
+
*/
|
|
133
|
+
customCellContent?: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Indicates whether to draw detail rows.
|
|
136
|
+
* If set to false then the detail rows will be ignored; otherwise the detail rows will be drawn empty
|
|
137
|
+
* and their content should be drawn manually using formatItem event handler.
|
|
138
|
+
* Default is 'undefined' (i.e. false).
|
|
139
|
+
*/
|
|
140
|
+
drawDetailRows?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Represents an array of custom fonts that will be embedded into the document.
|
|
143
|
+
*
|
|
144
|
+
* This sample illustrates how to setup the FlexGridPdfConverter to use two custom
|
|
145
|
+
* fonts, Cuprum-Bold.ttf and Cuprum-Regular.ttf. The first one is applied to the
|
|
146
|
+
* header cells only, while the second one is applied to all the remaining cells.
|
|
147
|
+
*
|
|
148
|
+
* <pre>
|
|
149
|
+
* wijmo.grid.pdf.FlexGridPdfConverter.export(flex, fileName, {
|
|
150
|
+
* embeddedFonts: [{
|
|
151
|
+
* source: 'resources/ttf/Cuprum-Bold.ttf',
|
|
152
|
+
* name: 'cuprum',
|
|
153
|
+
* style: 'normal',
|
|
154
|
+
* weight: 'bold'
|
|
155
|
+
* }, {
|
|
156
|
+
* source: 'resources/ttf/Cuprum-Regular.ttf',
|
|
157
|
+
* name: 'cuprum',
|
|
158
|
+
* style: 'normal',
|
|
159
|
+
* weight: 'normal'
|
|
160
|
+
* }],
|
|
161
|
+
* styles: {
|
|
162
|
+
* cellStyle: {
|
|
163
|
+
* font: {
|
|
164
|
+
* family: 'cuprum'
|
|
165
|
+
* }
|
|
166
|
+
* },
|
|
167
|
+
* headerCellStyle: {
|
|
168
|
+
* font: {
|
|
169
|
+
* weight: 'bold'
|
|
170
|
+
* }
|
|
171
|
+
* }
|
|
172
|
+
* }
|
|
173
|
+
* });
|
|
174
|
+
* </pre>
|
|
175
|
+
*/
|
|
176
|
+
embeddedFonts?: IPdfFontFile[];
|
|
177
|
+
/**
|
|
178
|
+
* Determines the export mode.
|
|
179
|
+
*/
|
|
180
|
+
exportMode?: ExportMode;
|
|
181
|
+
/**
|
|
182
|
+
* An optional callback function called for every exported cell that allows to perform transformations of exported
|
|
183
|
+
* cell value and style, or perform a custom drawing.
|
|
184
|
+
*
|
|
185
|
+
* The function accepts the {@link PdfFormatItemEventArgs} class instance as the first argument.
|
|
186
|
+
*
|
|
187
|
+
* In case of custom drawing the {@link PdfFormatItemEventArgs.cancel} property should be set to true to cancel the default cell content drawing, and
|
|
188
|
+
* the {@link PdfFormatItemEventArgs.cancelBorders} property should be set to true to cancel the default cell borders drawing.
|
|
189
|
+
*
|
|
190
|
+
* <pre>
|
|
191
|
+
* wijmo.grid.pdf.FlexGridPdfConverter.export(flex, fileName, {
|
|
192
|
+
* formatItem: function(args) {
|
|
193
|
+
* // Change the background color of the regular cells of "Country" column.
|
|
194
|
+
* if (args.panel.cellType === wijmo.grid.CellType.Cell && args.panel.columns[args.col].binding === "country") {
|
|
195
|
+
* args.style.backgroundColor = 'blue';
|
|
196
|
+
* }
|
|
197
|
+
* }
|
|
198
|
+
* });</pre>
|
|
199
|
+
*/
|
|
200
|
+
formatItem?: (args: PdfFormatItemEventArgs) => void;
|
|
201
|
+
/**
|
|
202
|
+
* Determines the maximum number of pages to export.
|
|
203
|
+
*/
|
|
204
|
+
maxPages?: number;
|
|
205
|
+
/**
|
|
206
|
+
* Indicates whether merged values should be repeated across pages when the merged range
|
|
207
|
+
* is split on multiple pages.
|
|
208
|
+
*/
|
|
209
|
+
repeatMergedValuesAcrossPages?: boolean;
|
|
210
|
+
/**
|
|
211
|
+
* Indicates whether star-sized columns widths should be recalculated against the PDF page
|
|
212
|
+
* width instead of using the grid's width.
|
|
213
|
+
*/
|
|
214
|
+
recalculateStarWidths?: boolean;
|
|
215
|
+
/**
|
|
216
|
+
* Represents the look and feel of an exported {@link FlexGrid}.
|
|
217
|
+
*/
|
|
218
|
+
styles?: IFlexGridStyle;
|
|
219
|
+
/**
|
|
220
|
+
* An optional function that gives feedback about the progress of a task.
|
|
221
|
+
* The function accepts a single argument, a number changing from 0.0 to 1.0, where the value of 0.0 indicates that
|
|
222
|
+
* the operation has just begun and the value of 1.0 indicates that the operation has completed.
|
|
223
|
+
*
|
|
224
|
+
* <pre>
|
|
225
|
+
* wijmo.grid.pdf.FlexGridPdfConverter.export(flex, fileName, {
|
|
226
|
+
* progress: function(value) {
|
|
227
|
+
* // Handle the progress here.
|
|
228
|
+
* }
|
|
229
|
+
* });</pre>
|
|
230
|
+
*/
|
|
231
|
+
progress?: (value: number) => void;
|
|
232
|
+
/**
|
|
233
|
+
* When turned on, decreases the drawing time by activating the cell styles caching if {@link IFlexGridDrawSettings.customCellContent} property is enabled.
|
|
234
|
+
*
|
|
235
|
+
* The combination of cell's inline style specific properties, own CSS classes and CSS classes of row containing the cell is used as
|
|
236
|
+
* the cache tag. Before the cell style is calculated, the cache is checked first, and if the style associated with the tag is found there,
|
|
237
|
+
* it's taken from there and doesn't get recalculated.
|
|
238
|
+
*
|
|
239
|
+
* Using this mode can make the drawing slower when considerable amount of cells have the unique set of CSS classes and inline styles.
|
|
240
|
+
* Also, when pseudo classes like :first-child and :nth-child are used to style the cells and rows, the cell styles can be determined
|
|
241
|
+
* incorrectly.
|
|
242
|
+
*
|
|
243
|
+
* The default value is <b>true</b>.
|
|
244
|
+
*/
|
|
245
|
+
quickCellStyles?: boolean;
|
|
246
|
+
_progressMax?: number;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Represents the settings used by the {@link FlexGridPdfConverter.export} method.
|
|
250
|
+
*/
|
|
251
|
+
export interface IFlexGridExportSettings extends IFlexGridDrawSettings {
|
|
252
|
+
/**
|
|
253
|
+
* Determines the scale mode.
|
|
254
|
+
*/
|
|
255
|
+
scaleMode?: ScaleMode;
|
|
256
|
+
/**
|
|
257
|
+
* Represents the options of the underlying {@link PdfDocument}.
|
|
258
|
+
*/
|
|
259
|
+
documentOptions?: IPdfDocumentOptions;
|
|
260
|
+
}
|
|
261
|
+
export interface _IFlexGridAdapter {
|
|
262
|
+
columns: _IColumnCollection;
|
|
263
|
+
rows: _IRowCollection;
|
|
264
|
+
bottomLeftCells: _IGridPanel;
|
|
265
|
+
cells: _IGridPanel;
|
|
266
|
+
columnFooters: _IGridPanel;
|
|
267
|
+
columnHeaders: _IGridPanel;
|
|
268
|
+
rowHeaders: _IGridPanel;
|
|
269
|
+
topLeftCells: _IGridPanel;
|
|
270
|
+
treeIndent: number;
|
|
271
|
+
getSelection(): _ICellRange[];
|
|
272
|
+
getComputedStyle(panel: _IGridPanel, cell: HTMLElement): CSSStyleDeclaration;
|
|
273
|
+
getComputedDefBorderColor(): string;
|
|
274
|
+
getMergedRange(p: _IGridPanel, r: number, c: number): _ICellRange;
|
|
275
|
+
showColumnHeader: boolean;
|
|
276
|
+
showRowHeader: boolean;
|
|
277
|
+
showColumnFooter: boolean;
|
|
278
|
+
alignMergedTextToTheTopRow(panel: _IGridPanel): boolean;
|
|
279
|
+
getCell(panel: _IGridPanel, row: number, column: number, updateContent: boolean): HTMLElement;
|
|
280
|
+
getCellContent(panel: _IGridPanel, row: _IRow, col: _IColumn, colIdx: number): string;
|
|
281
|
+
getCellStyle(panel: _IGridPanel, row: _IRow, col: _IColumn): ICellStyle;
|
|
282
|
+
getColumn(panel: _IGridPanel, row: number, col: number): _IColumn;
|
|
283
|
+
isAlternatingRow(row: _IRow): boolean;
|
|
284
|
+
isBooleanCell(panel: _IGridPanel, row: _IRow, col: _IColumn): boolean;
|
|
285
|
+
isGroupRow(row: _IRow): boolean;
|
|
286
|
+
isNewRow(row: _IRow): boolean;
|
|
287
|
+
isDetailRow(row: _IRow): boolean;
|
|
288
|
+
isExpandableGroupRow(row: _IRow): boolean;
|
|
289
|
+
isRenderableRow(row: _IRow): boolean;
|
|
290
|
+
isRenderableColumn(col: _IColumn): boolean;
|
|
291
|
+
}
|
|
292
|
+
export interface _IGridPanel {
|
|
293
|
+
columns: _IColumnCollection;
|
|
294
|
+
cellType: number;
|
|
295
|
+
rows: _IRowCollection;
|
|
296
|
+
height: number;
|
|
297
|
+
width: number;
|
|
298
|
+
}
|
|
299
|
+
export interface _IColumnCollection {
|
|
300
|
+
[index: number]: _IColumn;
|
|
301
|
+
firstVisibleIndex: number;
|
|
302
|
+
length: number;
|
|
303
|
+
}
|
|
304
|
+
export interface _IRowCol {
|
|
305
|
+
dataType?: number;
|
|
306
|
+
binding?: string;
|
|
307
|
+
index: number;
|
|
308
|
+
isVisible: boolean;
|
|
309
|
+
}
|
|
310
|
+
export interface _IColumn extends _IRowCol {
|
|
311
|
+
aggregate: number;
|
|
312
|
+
name?: string;
|
|
313
|
+
visibleIndex: number;
|
|
314
|
+
renderWidth: number;
|
|
315
|
+
wordWrap: boolean;
|
|
316
|
+
multiLine: boolean;
|
|
317
|
+
getAlignment(row?: _IRow): string;
|
|
318
|
+
}
|
|
319
|
+
export interface _ICellRange {
|
|
320
|
+
row: number;
|
|
321
|
+
col: number;
|
|
322
|
+
row2: number;
|
|
323
|
+
col2: number;
|
|
324
|
+
bottomRow: number;
|
|
325
|
+
rightCol: number;
|
|
326
|
+
leftCol: number;
|
|
327
|
+
topRow: number;
|
|
328
|
+
isValid: boolean;
|
|
329
|
+
rowSpan: number;
|
|
330
|
+
columnSpan: number;
|
|
331
|
+
isSingleCell: boolean;
|
|
332
|
+
getRenderSize(flex: _IFlexGridAdapter, panel: _IGridPanel): Size;
|
|
333
|
+
clone(): _ICellRange;
|
|
334
|
+
}
|
|
335
|
+
export interface _IRowCollection {
|
|
336
|
+
[index: number]: _IRow;
|
|
337
|
+
length: number;
|
|
338
|
+
maxGroupLevel: number;
|
|
339
|
+
}
|
|
340
|
+
export interface _IRow extends _IRowCol {
|
|
341
|
+
level?: number;
|
|
342
|
+
renderHeight: number;
|
|
343
|
+
wordWrap: boolean;
|
|
344
|
+
multiLine: boolean;
|
|
345
|
+
}
|
|
346
|
+
export declare enum _CellType {
|
|
347
|
+
None = 0,
|
|
348
|
+
Cell = 1,
|
|
349
|
+
ColumnHeader = 2,
|
|
350
|
+
RowHeader = 3,
|
|
351
|
+
TopLeft = 4,
|
|
352
|
+
ColumnFooter = 5,
|
|
353
|
+
BottomLeft = 6
|
|
354
|
+
}
|
|
355
|
+
export declare function _merge(dst: any, src: any, overwrite?: boolean): any;
|
|
356
|
+
export declare function _combineColumns(regCol: _IColumn, bndCol: _IColumn): _IColumn;
|
|
357
|
+
export declare function _cloneStyle(val: CSSStyleDeclaration): any;
|
|
358
|
+
/**
|
|
359
|
+
* Represents arguments of the IFlexGridDrawSettings.formatItem callback.
|
|
360
|
+
*/
|
|
361
|
+
export declare class PdfFormatItemEventArgs extends /*wijmo.grid.CellRangeEventArgs*/ CancelEventArgs {
|
|
362
|
+
private _p;
|
|
363
|
+
private _rng;
|
|
364
|
+
private _data;
|
|
365
|
+
private _tagContent;
|
|
366
|
+
private _canvas;
|
|
367
|
+
private _cell;
|
|
368
|
+
private _clientRect;
|
|
369
|
+
private _contentRect;
|
|
370
|
+
private _textRect;
|
|
371
|
+
private _style;
|
|
372
|
+
private _getFormattedCell;
|
|
373
|
+
private _getTextRect;
|
|
374
|
+
/**
|
|
375
|
+
* Initializes a new instance of the {@link PdfFormatItemEventArgs} class.
|
|
376
|
+
*
|
|
377
|
+
* @param p {@link GridPanel} that contains the range.
|
|
378
|
+
* @param rng Range of cells affected by the event.
|
|
379
|
+
* @param cell Element that represents the grid cell to be rendered.
|
|
380
|
+
* @param canvas Canvas to perform the custom painting on.
|
|
381
|
+
* @param clientRect Object that represents the client rectangle of the grid cell to be rendered in canvas coordinates.
|
|
382
|
+
* @param contentRect Object that represents the content rectangle of the grid cell to be rendered in canvas coordinates.
|
|
383
|
+
* @param style Object that represents the style of the grid cell to be rendered.
|
|
384
|
+
* @param getFormattedCell Callback function that should return the grid cell when the getFormattedCell method is called.
|
|
385
|
+
* @param getTextRect Callback function that should return the text rectangle of the grid cell to be rendered in canvas coordinates.
|
|
386
|
+
*/
|
|
387
|
+
constructor(p: any, rng: any, cell: HTMLElement, canvas: PdfPageArea, clientRect: Rect, contentRect: Rect, style: ICellStyle, getFormattedCell: () => HTMLElement, getTextRect: () => Rect);
|
|
388
|
+
/**
|
|
389
|
+
* Gets the {@link GridPanel} affected by this event.
|
|
390
|
+
*/
|
|
391
|
+
readonly panel: GridPanel;
|
|
392
|
+
/**
|
|
393
|
+
* Gets the {@link CellRange} affected by this event.
|
|
394
|
+
*/
|
|
395
|
+
readonly range: CellRange;
|
|
396
|
+
/**
|
|
397
|
+
* Gets the row affected by this event.
|
|
398
|
+
*/
|
|
399
|
+
readonly row: number;
|
|
400
|
+
/**
|
|
401
|
+
* Gets the column affected by this event.
|
|
402
|
+
*/
|
|
403
|
+
readonly col: number;
|
|
404
|
+
/**
|
|
405
|
+
* Gets or sets the data associated with the event.
|
|
406
|
+
*/
|
|
407
|
+
data: any;
|
|
408
|
+
/**
|
|
409
|
+
* Gets or sets a value that indicates that default cell borders drawing should be canceled.
|
|
410
|
+
*/
|
|
411
|
+
cancelBorders: boolean;
|
|
412
|
+
/**
|
|
413
|
+
* Gets the canvas to perform the custom painting on.
|
|
414
|
+
*/
|
|
415
|
+
readonly canvas: PdfPageArea;
|
|
416
|
+
/**
|
|
417
|
+
* Gets a reference to the element that represents the grid cell being rendered.
|
|
418
|
+
* If IFlexGridDrawSettings.customCellContent is set to true then contains
|
|
419
|
+
* reference to the element that represents the formatted grid cell; otherwise, a null value.
|
|
420
|
+
*/
|
|
421
|
+
readonly cell: HTMLElement;
|
|
422
|
+
/**
|
|
423
|
+
* Gets the client rectangle of the cell being rendered in canvas coordinates.
|
|
424
|
+
*/
|
|
425
|
+
readonly clientRect: Rect;
|
|
426
|
+
/**
|
|
427
|
+
* Gets the content rectangle of the cell being rendered in canvas coordinates.
|
|
428
|
+
*/
|
|
429
|
+
readonly contentRect: Rect;
|
|
430
|
+
/**
|
|
431
|
+
* Draws the background of the cell with the specified brush or color, or, if it is not specified, with the value of the {@link style.backgroundColor} property.
|
|
432
|
+
* @param brush The brush or color to use.
|
|
433
|
+
*/
|
|
434
|
+
drawBackground(brush?: PdfBrush | Color | string): void;
|
|
435
|
+
/**
|
|
436
|
+
* Returns a reference to the element that represents the grid cell being rendered.
|
|
437
|
+
* This method is useful when export of custom formatting is disabled, but you need
|
|
438
|
+
* to export custom content for certain cells.
|
|
439
|
+
*/
|
|
440
|
+
getFormattedCell(): HTMLElement;
|
|
441
|
+
/**
|
|
442
|
+
* Gets or sets a reference to a marked structure content of the cell.
|
|
443
|
+
*
|
|
444
|
+
* If user produces Tagged PDF and draws the cell content manually, then he can mark the cell content and return a reference to the structure content via this property.
|
|
445
|
+
* The returned item will be incorporated into the document's structure tree.
|
|
446
|
+
*
|
|
447
|
+
* For example:
|
|
448
|
+
* <pre>
|
|
449
|
+
* args.tagContent = args.canvas.beginTagContent(wijmo.pdf.PdfTagType.P);
|
|
450
|
+
* args.canvas.drawText('Some text', x, y);
|
|
451
|
+
* args.canvas.endTagContent();
|
|
452
|
+
* </pre>
|
|
453
|
+
*/
|
|
454
|
+
tagContent: IPdfTagContent | IPdfTag;
|
|
455
|
+
/**
|
|
456
|
+
* Gets an object that represents the style of the cell being rendered.
|
|
457
|
+
* If IFlexGridDrawSettings.customCellContent is set to true then the style is inferred
|
|
458
|
+
* from the cell style; othwerwise it contains a combination of the IFlexGridDrawSettings.styles export
|
|
459
|
+
* setting, according to the row type of exported cell.
|
|
460
|
+
*/
|
|
461
|
+
readonly style: ICellStyle;
|
|
462
|
+
/**
|
|
463
|
+
* Gets the value that represents the top position of the text of the cell being rendered in canvas coordinates.
|
|
464
|
+
*/
|
|
465
|
+
readonly textTop: number;
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Provides a functionality to export the {@link FlexGrid} to PDF.
|
|
469
|
+
*/
|
|
470
|
+
export declare class _FlexGridPdfCoreConverter {
|
|
471
|
+
private static BorderWidth;
|
|
472
|
+
private static DefFont;
|
|
473
|
+
static DefaultDrawSettings: IFlexGridDrawSettings;
|
|
474
|
+
/**
|
|
475
|
+
* Draws the {@link FlexGrid} to an existing {@link PdfDocument} instance at the
|
|
476
|
+
* specified coordinates.
|
|
477
|
+
*
|
|
478
|
+
* If width is not specified, then grid will be rendered in actual size
|
|
479
|
+
* without any page breaks.
|
|
480
|
+
* If height is not specified, then grid will be scaled to fit the width
|
|
481
|
+
* without any page breaks.
|
|
482
|
+
* If both, width and height are determined, then grid will be scaled to fit
|
|
483
|
+
* the specified rectangle without any page breaks.
|
|
484
|
+
*
|
|
485
|
+
* <pre>
|
|
486
|
+
* var doc = new wijmo.pdf.PdfDocument({
|
|
487
|
+
* ended: function (sender, args) {
|
|
488
|
+
* wijmo.pdf.saveBlob(args.blob, 'FlexGrid.pdf');
|
|
489
|
+
* }
|
|
490
|
+
* });
|
|
491
|
+
*
|
|
492
|
+
* wijmo.grid.pdf.FlexGridPdfConverter.drawToPosition(grid, doc, new wijmo.Point(0, 0), null, null, {
|
|
493
|
+
* maxPages: 10,
|
|
494
|
+
* styles: {
|
|
495
|
+
* cellStyle: {
|
|
496
|
+
* backgroundColor: '#ffffff',
|
|
497
|
+
* borderColor: '#c6c6c6'
|
|
498
|
+
* },
|
|
499
|
+
* headerCellStyle: {
|
|
500
|
+
* backgroundColor: '#eaeaea'
|
|
501
|
+
* }
|
|
502
|
+
* }
|
|
503
|
+
* });
|
|
504
|
+
* </pre>
|
|
505
|
+
*
|
|
506
|
+
* @param flex The {@link FlexGrid} instance to export.
|
|
507
|
+
* @param doc The {@link PdfDocument} instance to draw in.
|
|
508
|
+
* @param point The position to draw at, in points.
|
|
509
|
+
* @param width The width of the drawing area in points.
|
|
510
|
+
* @param height The height of the drawing area in points.
|
|
511
|
+
* @param settings The draw settings.
|
|
512
|
+
*/
|
|
513
|
+
static draw(flex: _IFlexGridAdapter, doc: pdf.PdfDocument, point?: Point, width?: number, height?: number, settings?: IFlexGridExportSettings): void;
|
|
514
|
+
static _applyDefaultDrawSettings(settings: any): IFlexGridDrawSettings;
|
|
515
|
+
private static _drawInternal;
|
|
516
|
+
private static _getCellsCount;
|
|
517
|
+
private static _getRowsToRender;
|
|
518
|
+
private static _getScaleFactor;
|
|
519
|
+
private static _canBreakRows;
|
|
520
|
+
private static _getPages;
|
|
521
|
+
}
|
|
522
|
+
declare class FlexGridRenderer {
|
|
523
|
+
private _flex;
|
|
524
|
+
private _borderWidth;
|
|
525
|
+
private _lastPage;
|
|
526
|
+
private _topLeft;
|
|
527
|
+
private _rowHeader;
|
|
528
|
+
private _columnHeader;
|
|
529
|
+
private _cells;
|
|
530
|
+
private _bottomLeft;
|
|
531
|
+
private _columnFooter;
|
|
532
|
+
private _settings;
|
|
533
|
+
constructor(flex: _IFlexGridAdapter, settings: IFlexGridExportSettings, range: RowRange, borderWidth: number, lastPage: boolean);
|
|
534
|
+
readonly settings: IFlexGridExportSettings;
|
|
535
|
+
isRenderableRow(row: _IRow): boolean;
|
|
536
|
+
isRenderableColumn(col: _IColumn): boolean;
|
|
537
|
+
getCellsCount(): number;
|
|
538
|
+
render(doc: pdf.PdfDocument, cellRendered?: () => void): void;
|
|
539
|
+
readonly flex: _IFlexGridAdapter;
|
|
540
|
+
readonly renderSize: Size;
|
|
541
|
+
readonly showColumnHeader: boolean;
|
|
542
|
+
readonly showRowHeader: boolean;
|
|
543
|
+
readonly showColumnFooter: boolean;
|
|
544
|
+
alignMergedTextToTheTopRow(panel: _IGridPanel): boolean;
|
|
545
|
+
getColumn(panel: _IGridPanel, row: number, col: number): _IColumn;
|
|
546
|
+
isAlternatingRow(row: _IRow): boolean;
|
|
547
|
+
isGroupRow(row: _IRow): boolean;
|
|
548
|
+
isNewRow(row: _IRow): boolean;
|
|
549
|
+
isExpandableGroupRow(row: _IRow): boolean;
|
|
550
|
+
isBooleanCell(panel: _IGridPanel, row: _IRow, col: _IColumn): boolean;
|
|
551
|
+
getCellStyle(panel: _IGridPanel, row: _IRow, col: _IColumn): ICellStyle;
|
|
552
|
+
}
|
|
553
|
+
declare class PanelSection {
|
|
554
|
+
private _range;
|
|
555
|
+
private _panel;
|
|
556
|
+
private _flex;
|
|
557
|
+
private _renderableRowsCnt;
|
|
558
|
+
private _renderableColumnsCnt;
|
|
559
|
+
private _size;
|
|
560
|
+
constructor(flex: _IFlexGridAdapter, panel: _IGridPanel, range: RowRange);
|
|
561
|
+
readonly renderableRowsCount: number;
|
|
562
|
+
readonly renderableColumnsCount: number;
|
|
563
|
+
readonly size: Size;
|
|
564
|
+
readonly range: RowRange;
|
|
565
|
+
readonly panel: _IGridPanel;
|
|
566
|
+
}
|
|
567
|
+
declare class PanelSectionRenderer extends PanelSection {
|
|
568
|
+
private _borderWidth;
|
|
569
|
+
private _gr;
|
|
570
|
+
private _renderSize;
|
|
571
|
+
constructor(gr: FlexGridRenderer, panel: _IGridPanel, range: RowRange, borderWidth: number);
|
|
572
|
+
readonly gr: FlexGridRenderer;
|
|
573
|
+
readonly renderSize: Size;
|
|
574
|
+
private _getRangeWidth;
|
|
575
|
+
private _getRangeHeight;
|
|
576
|
+
getCellsCount(): number;
|
|
577
|
+
render(doc: pdf.PdfDocument, x: number, y: number, cellRendered: () => void, tableSection: TrStructCache): void;
|
|
578
|
+
}
|
|
579
|
+
declare class TrStructCache {
|
|
580
|
+
private doc;
|
|
581
|
+
private tableSection;
|
|
582
|
+
private _trh;
|
|
583
|
+
private _trb;
|
|
584
|
+
private _trf;
|
|
585
|
+
constructor(doc: pdf.PdfDocument, tableSection: pdf.IPdfTag);
|
|
586
|
+
readonly el: IPdfTag;
|
|
587
|
+
getTR(row: number, cellType: _CellType): IPdfTag;
|
|
588
|
+
}
|
|
589
|
+
export declare class _CellRenderer {
|
|
590
|
+
private _pr;
|
|
591
|
+
private _area;
|
|
592
|
+
private _borderWidth;
|
|
593
|
+
private readonly InvisiblePen;
|
|
594
|
+
constructor(panelRenderer: PanelSectionRenderer, area: pdf.PdfPageArea, borderWidth: number);
|
|
595
|
+
renderCell(value: string, row: _IRow, column: _IColumn, rng: _CellRangeExt, r: Rect): pdf.IPdfTagContent | pdf.IPdfTag;
|
|
596
|
+
private _renderCell;
|
|
597
|
+
private _isBooleanCellAndValue;
|
|
598
|
+
private _isBoolean;
|
|
599
|
+
private _measureCell;
|
|
600
|
+
private _decompositeStyle;
|
|
601
|
+
private _parseBorder;
|
|
602
|
+
private _parsePadding;
|
|
603
|
+
private _renderEmptyCell;
|
|
604
|
+
private _renderBooleanCell;
|
|
605
|
+
private _renderTextCell;
|
|
606
|
+
private _calculateTextRect;
|
|
607
|
+
private _getTextLineHeight;
|
|
608
|
+
}
|
|
609
|
+
export declare class _CellRange implements _ICellRange {
|
|
610
|
+
private _row;
|
|
611
|
+
private _col;
|
|
612
|
+
private _row2;
|
|
613
|
+
private _col2;
|
|
614
|
+
constructor(cr: _ICellRange);
|
|
615
|
+
constructor(row: number, col: number, row2: number, col2: number);
|
|
616
|
+
row: number;
|
|
617
|
+
col: number;
|
|
618
|
+
row2: number;
|
|
619
|
+
col2: number;
|
|
620
|
+
readonly topRow: number;
|
|
621
|
+
readonly bottomRow: number;
|
|
622
|
+
readonly leftCol: number;
|
|
623
|
+
readonly rightCol: number;
|
|
624
|
+
readonly columnSpan: number;
|
|
625
|
+
readonly rowSpan: number;
|
|
626
|
+
readonly isValid: boolean;
|
|
627
|
+
readonly isSingleCell: boolean;
|
|
628
|
+
copyFrom(cr: _CellRange): void;
|
|
629
|
+
clone(): _CellRange;
|
|
630
|
+
getRenderSize(flex: _IFlexGridAdapter, p: _IGridPanel): Size;
|
|
631
|
+
setRange(r?: number, c?: number, r2?: number, c2?: number): void;
|
|
632
|
+
}
|
|
633
|
+
export declare class _CellRangeExt extends _CellRange {
|
|
634
|
+
firstVisibleRow: number;
|
|
635
|
+
visibleRowsCount: number;
|
|
636
|
+
constructor(panel: _IGridPanel, cr: _ICellRange);
|
|
637
|
+
constructor(panel: _IGridPanel, row: number, col: number, row2: number, col2: number);
|
|
638
|
+
copyFrom(cr: _CellRangeExt): void;
|
|
639
|
+
clone(): _CellRangeExt;
|
|
640
|
+
}
|
|
641
|
+
declare class RowRange {
|
|
642
|
+
private _ranges;
|
|
643
|
+
constructor(ranges: _ICellRange[]);
|
|
644
|
+
length(): number;
|
|
645
|
+
readonly isValid: boolean;
|
|
646
|
+
readonly leftCol: number;
|
|
647
|
+
readonly rightCol: number;
|
|
648
|
+
clone(leftCol?: number, rightCol?: number): RowRange;
|
|
649
|
+
getRenderSize(flex: _IFlexGridAdapter, panel: _IGridPanel): Size;
|
|
650
|
+
find(panel: _IGridPanel, fn: (row: _IRow) => boolean): _IRow | null;
|
|
651
|
+
forEach(panel: _IGridPanel, fn: (row: _IRow, range?: _ICellRange, rowIdx?: number, seqIdx?: number) => void | boolean): void;
|
|
652
|
+
subrange(from: number, count: number, leftCol?: number, rightCol?: number): RowRange;
|
|
653
|
+
}
|
|
654
|
+
export declare function _removeFakeCell(): void;
|
|
655
|
+
/**
|
|
656
|
+
* Provides a functionality to export the {@link FlexGrid} to PDF.
|
|
657
|
+
*
|
|
658
|
+
* The example below shows how you can use a {@link FlexGridPdfConverter} to
|
|
659
|
+
* export a {@link FlexGrid} to PDF:
|
|
660
|
+
*
|
|
661
|
+
* {@sample Grid/ImportExportPrint/PDF/ExportToFile/purejs Example}
|
|
662
|
+
*/
|
|
663
|
+
export declare class FlexGridPdfConverter {
|
|
664
|
+
static _DefaultExportSettings: IFlexGridExportSettings;
|
|
665
|
+
/**
|
|
666
|
+
* Draws the {@link FlexGrid} to an existing {@link PdfDocument} at the
|
|
667
|
+
* (0, @wijmo.pdf.PdfDocument.y) coordinates.
|
|
668
|
+
*
|
|
669
|
+
* If both, **width** and **height** are determined, then grid will be scaled to fit the
|
|
670
|
+
* specified rectangle without any page breaks.
|
|
671
|
+
* If only **width** is specifed, then grid will be scaled to fit the width, breaking
|
|
672
|
+
* into pages vertically as needed.
|
|
673
|
+
* Otherwise grid will be rendered in actual size, breaking into pages as needed.
|
|
674
|
+
*
|
|
675
|
+
* <pre>
|
|
676
|
+
* var doc = new wijmo.pdf.PdfDocument({
|
|
677
|
+
* ended: function (sender, args) {
|
|
678
|
+
* wijmo.pdf.saveBlob(args.blob, 'FlexGrid.pdf');
|
|
679
|
+
* }
|
|
680
|
+
* });
|
|
681
|
+
*
|
|
682
|
+
* wijmo.grid.pdf.FlexGridPdfConverter.draw(grid, doc, null, null, {
|
|
683
|
+
* maxPages: 10,
|
|
684
|
+
* styles: {
|
|
685
|
+
* cellStyle: {
|
|
686
|
+
* backgroundColor: '#ffffff',
|
|
687
|
+
* borderColor: '#c6c6c6'
|
|
688
|
+
* },
|
|
689
|
+
* headerCellStyle: {
|
|
690
|
+
* backgroundColor: '#eaeaea'
|
|
691
|
+
* }
|
|
692
|
+
* }
|
|
693
|
+
* });
|
|
694
|
+
* </pre>
|
|
695
|
+
*
|
|
696
|
+
* @param flex The {@link FlexGrid} instance to export.
|
|
697
|
+
* @param doc The {@link PdfDocument} instance to draw in.
|
|
698
|
+
* @param width The width of the drawing area in points.
|
|
699
|
+
* @param height The height of the drawing area in points.
|
|
700
|
+
* @param settings The draw settings.
|
|
701
|
+
*/
|
|
702
|
+
static draw(flex: any, doc: pdf.PdfDocument, width?: number, height?: number, settings?: IFlexGridDrawSettings): void;
|
|
703
|
+
/**
|
|
704
|
+
* Draws the {@link FlexGrid} to an existing {@link PdfDocument} instance at the
|
|
705
|
+
* specified coordinates.
|
|
706
|
+
*
|
|
707
|
+
* If both, **width** and **height** are determined, then grid will be scaled to fit
|
|
708
|
+
* the specified rectangle without any page breaks.
|
|
709
|
+
* If only **width** is specified, then grid will be scaled to fit the width without
|
|
710
|
+
* any page breaks.
|
|
711
|
+
* Othwerwise grid will be rendered in actual size without any page breaks.
|
|
712
|
+
*
|
|
713
|
+
* <pre>
|
|
714
|
+
* var doc = new wijmo.pdf.PdfDocument({
|
|
715
|
+
* ended: function (sender, args) {
|
|
716
|
+
* wijmo.pdf.saveBlob(args.blob, 'FlexGrid.pdf');
|
|
717
|
+
* }
|
|
718
|
+
* });
|
|
719
|
+
*
|
|
720
|
+
* wijmo.grid.pdf.FlexGridPdfConverter.drawToPosition(grid, doc, new wijmo.Point(0, 0), null, null, {
|
|
721
|
+
* maxPages: 10,
|
|
722
|
+
* styles: {
|
|
723
|
+
* cellStyle: {
|
|
724
|
+
* backgroundColor: '#ffffff',
|
|
725
|
+
* borderColor: '#c6c6c6'
|
|
726
|
+
* },
|
|
727
|
+
* headerCellStyle: {
|
|
728
|
+
* backgroundColor: '#eaeaea'
|
|
729
|
+
* }
|
|
730
|
+
* }
|
|
731
|
+
* });
|
|
732
|
+
* </pre>
|
|
733
|
+
*
|
|
734
|
+
* @param flex The {@link FlexGrid} instance to export.
|
|
735
|
+
* @param doc The {@link PdfDocument} instance to draw in.
|
|
736
|
+
* @param point The position to draw at, in points.
|
|
737
|
+
* @param width The width of the drawing area in points.
|
|
738
|
+
* @param height The height of the drawing area in points.
|
|
739
|
+
* @param settings The draw settings.
|
|
740
|
+
*/
|
|
741
|
+
static drawToPosition(flex: any, doc: pdf.PdfDocument, point: Point, width?: number, height?: number, settings?: IFlexGridDrawSettings): void;
|
|
742
|
+
/**
|
|
743
|
+
* Exports the {@link FlexGrid} to PDF.
|
|
744
|
+
*
|
|
745
|
+
* <pre>
|
|
746
|
+
* wijmo.grid.pdf.FlexGridPdfConverter.export(grid, 'FlexGrid.pdf', {
|
|
747
|
+
* scaleMode: wijmo.grid.pdf.ScaleMode.PageWidth,
|
|
748
|
+
* maxPages: 10,
|
|
749
|
+
* styles: {
|
|
750
|
+
* cellStyle: {
|
|
751
|
+
* backgroundColor: '#ffffff',
|
|
752
|
+
* borderColor: '#c6c6c6'
|
|
753
|
+
* },
|
|
754
|
+
* headerCellStyle: {
|
|
755
|
+
* backgroundColor: '#eaeaea'
|
|
756
|
+
* }
|
|
757
|
+
* },
|
|
758
|
+
* documentOptions: {
|
|
759
|
+
* info: {
|
|
760
|
+
* title: 'Sample'
|
|
761
|
+
* }
|
|
762
|
+
* }
|
|
763
|
+
* });
|
|
764
|
+
* </pre>
|
|
765
|
+
*
|
|
766
|
+
* @param flex The {@link FlexGrid} instance to export.
|
|
767
|
+
* @param fileName Name of the file to export.
|
|
768
|
+
* @param settings The export settings.
|
|
769
|
+
*/
|
|
770
|
+
static export(flex: grid.FlexGrid, fileName: string, settings?: IFlexGridExportSettings): void;
|
|
771
|
+
static _getFlexGridAdapter(flex: grid.FlexGrid, settings: IFlexGridDrawSettings): _IFlexGridAdapter;
|
|
772
|
+
static _applyDefaultExportSettings(settings: any): IFlexGridExportSettings;
|
|
773
|
+
}
|
|
774
|
+
/**
|
|
775
|
+
* Represents a single item of the {@link IClientData} dictionary.
|
|
776
|
+
*/
|
|
777
|
+
export interface IClientDataItem {
|
|
778
|
+
/**
|
|
779
|
+
* Gets or sets the content for the data item.
|
|
780
|
+
*/
|
|
781
|
+
content: any;
|
|
782
|
+
/**
|
|
783
|
+
* Gets or sets the settings for the data item.
|
|
784
|
+
*/
|
|
785
|
+
settings: any;
|
|
786
|
+
}
|
|
787
|
+
/**
|
|
788
|
+
* Represents a dictionary of {name: value} pairs which contains client data.
|
|
789
|
+
*/
|
|
790
|
+
export interface IClientData {
|
|
791
|
+
[name: string]: IClientDataItem;
|
|
792
|
+
}
|
|
793
|
+
/**
|
|
794
|
+
* Provides arguments for the callback parameter of the {@link PdfWebWorkerClient.exportGrid} and {@link PdfWebWorkerClient.export} methods.
|
|
795
|
+
*/
|
|
796
|
+
export declare class PdfWebWorkerExportDoneEventArgs extends EventArgs {
|
|
797
|
+
private _blob;
|
|
798
|
+
private _buf;
|
|
799
|
+
/**
|
|
800
|
+
* Initializes a new instance of the {@link PdfWebWorkerExportDoneEventArgs} class.
|
|
801
|
+
*
|
|
802
|
+
* @param buffer An ArrayBuffer.
|
|
803
|
+
*/
|
|
804
|
+
constructor(buffer: ArrayBuffer);
|
|
805
|
+
/**
|
|
806
|
+
* Gets a Blob object that contains the document data.
|
|
807
|
+
*/
|
|
808
|
+
readonly blob: Blob;
|
|
809
|
+
/**
|
|
810
|
+
* Gets an ArrayBuffer that contains the document data.
|
|
811
|
+
*/
|
|
812
|
+
readonly buffer: ArrayBuffer;
|
|
813
|
+
}
|
|
814
|
+
/**
|
|
815
|
+
* Represents client-side methods for exporting FlexGrid to PDF/generating PDF, for use with Web Worker.
|
|
816
|
+
*/
|
|
817
|
+
export declare class PdfWebWorkerClient {
|
|
818
|
+
/**
|
|
819
|
+
* Exports the {@link FlexGrid} to PDF in a background thread.
|
|
820
|
+
*
|
|
821
|
+
* @param worker The Web Worker instance to run the exporting code in.
|
|
822
|
+
* @param grid The {@link FlexGrid} instance to export.
|
|
823
|
+
* @param fileName The name of the file to export.
|
|
824
|
+
* @param settings The export settings.
|
|
825
|
+
* @param done An optional callback function to call when exporting is done. The function takes a single parameter, an instance of the {@link PdfWebWorkerExportDoneEventArgs} class.
|
|
826
|
+
* To prevent the creation of a file the function should return False.
|
|
827
|
+
* @param progress An optional function that gives feedback about the progress of the export. The function takes a single parameter, a number changing from 0.0 to 1.0,
|
|
828
|
+
* where the value of 0.0 indicates that the operation has just begun and the value of 1.0 indicates that the operation has completed.
|
|
829
|
+
*/
|
|
830
|
+
static exportGrid(worker: Worker, grid: grid.FlexGrid, fileName: string, settings?: IFlexGridExportSettings, done?: (args: PdfWebWorkerExportDoneEventArgs) => false | void, progress?: (value: number) => void): void;
|
|
831
|
+
/**
|
|
832
|
+
* Exports PDF in a background thread.
|
|
833
|
+
*
|
|
834
|
+
* @param worker The Web Worker instance to run the exporting code in.
|
|
835
|
+
* @param settings An object containing {@link PdfDocument}'s initialization settings.
|
|
836
|
+
* @param done The callback function to call when drawing is done. The function takes a single parameter, an instance of the {@link PdfWebWorkerExportDoneEventArgs} class.
|
|
837
|
+
* @param progress An optional function that gives feedback about the progress of the export. The function takes a single parameter, a number changing from 0.0 to 1.0,
|
|
838
|
+
* where the value of 0.0 indicates that the operation has just begun and the value of 1.0 indicates that the operation has completed.
|
|
839
|
+
*/
|
|
840
|
+
static export(worker: Worker, settings: any, done: (args: PdfWebWorkerExportDoneEventArgs) => void, progress?: (value: number) => void): void;
|
|
841
|
+
/**
|
|
842
|
+
* Adds named FlexGrid with settings, which will be used in a Web Worker to generate a PDF document.
|
|
843
|
+
* This method should be used in conjunction with the {@link PdfWebWorkerClient.export} method.
|
|
844
|
+
*
|
|
845
|
+
* @param worker The Web Worker instance to send the data to.
|
|
846
|
+
* @param grid The grid
|
|
847
|
+
* @param name The name associated with the grid.
|
|
848
|
+
* @param settings The draw settings.
|
|
849
|
+
*/
|
|
850
|
+
static addGrid(worker: Worker, grid: grid.FlexGrid, name: string, settings?: IFlexGridDrawSettings): void;
|
|
851
|
+
/**
|
|
852
|
+
* Adds named image with settings, which will be used in a Web Worker to generate a PDF document.
|
|
853
|
+
* This method should be used in conjunction with the {@link PdfWebWorkerClient.export} method.
|
|
854
|
+
*
|
|
855
|
+
* @param worker The Web Worker instance to send the data to.
|
|
856
|
+
* @param image A string containing the URL to get the image from or the data URI containing a base64 encoded image.
|
|
857
|
+
* @param name The name associated with the image.
|
|
858
|
+
* @param settings The image drawing settings.
|
|
859
|
+
*/
|
|
860
|
+
static addImage(worker: Worker, image: string, name: string, settings?: pdf.IPdfImageDrawSettings): void;
|
|
861
|
+
/**
|
|
862
|
+
* Adds named string which will be used in a Web Worker code to generate a PDF document.
|
|
863
|
+
* This method should be used in conjunction with the {@link PdfWebWorkerClient.export} method.
|
|
864
|
+
*
|
|
865
|
+
* @param worker The Web Worker instance to send the data to.
|
|
866
|
+
* @param value The value.
|
|
867
|
+
* @param name The name associated with the string.
|
|
868
|
+
*/
|
|
869
|
+
static addString(worker: Worker, value: string, name: string): void;
|
|
870
|
+
/**
|
|
871
|
+
* Serializes the {@link FlexGrid} to ArrayBuffer. The serialized data can be send to a Web Worker using the postMessage method.
|
|
872
|
+
*
|
|
873
|
+
* @param grid The {@link FlexGrid} instance to serialize.
|
|
874
|
+
* @param settings The export settings used to serialize the grid.
|
|
875
|
+
*/
|
|
876
|
+
static serializeGrid(grid: grid.FlexGrid, settings?: IFlexGridExportSettings): ArrayBuffer;
|
|
877
|
+
private static _addClientData;
|
|
878
|
+
private static _clearClientData;
|
|
879
|
+
private static _clientDataToArrayBuffer;
|
|
880
|
+
private static _gridToJson;
|
|
881
|
+
private static _getJsonConverter;
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* Represents server-side methods for exporting FlexGrid to PDF/generating PDF, for use with Web Worker.
|
|
885
|
+
*/
|
|
886
|
+
export declare class PdfWebWorker {
|
|
887
|
+
/**
|
|
888
|
+
* Performs the export started in a UI thread by calling the {@link PdfWebWorkerClient.exportGrid} method.
|
|
889
|
+
*/
|
|
890
|
+
static initExportGrid(): void;
|
|
891
|
+
/**
|
|
892
|
+
* Performs the PDF document generation started in a UI thread by calling the {@link PdfWebWorkerClient.export} method.
|
|
893
|
+
*
|
|
894
|
+
* @param draw The callback function to draw PDF.
|
|
895
|
+
* The function takes two parameters:
|
|
896
|
+
* <ul>
|
|
897
|
+
* <li><b>doc</b>: An instance of the {@link wijmo.pdf.PdfDocument} class.</li>
|
|
898
|
+
* <li><b>clientData</b>: A dictionary of {name: value} pairs that contains the data added on the client side.</li>
|
|
899
|
+
* </ul>
|
|
900
|
+
*/
|
|
901
|
+
static initExport(draw: (doc: pdf.PdfDocument, clientData: IClientData) => void): void;
|
|
902
|
+
/**
|
|
903
|
+
* Sends the progress value to a client, where it will be handled by the {@link PdfWebWorkerClient.export}'s progress callback function.
|
|
904
|
+
* Should be used in conjunction with the {@link PdfWebWorkerClient.export} method to inform client about the progress of the export.
|
|
905
|
+
*
|
|
906
|
+
* @param value The progress value, in the range of [0.0..1.0].
|
|
907
|
+
*/
|
|
908
|
+
static sendExportProgress(value: number): void;
|
|
909
|
+
/**
|
|
910
|
+
* Deserializes the {@link FlexGrid} from ArrayBuffer to its internal representation that can be used in a Web Worker and passed to the {@link FlexGridPdfConverter.draw} and {@link FlexGridPdfConverter.drawToPosition} methods.
|
|
911
|
+
*
|
|
912
|
+
* @param data The data to deserialize.
|
|
913
|
+
* @param settings The draw settings used to deserialize the grid.
|
|
914
|
+
*/
|
|
915
|
+
static deserializeGrid(data: ArrayBuffer, settings?: IFlexGridDrawSettings): any;
|
|
916
|
+
private static _deserializeGridFromString;
|
|
917
|
+
private static _disableUnsupportedFeatures;
|
|
918
|
+
private static _getJsonAdapter;
|
|
919
|
+
}
|
|
920
|
+
export {};
|