@syncfusion/ej2-pdf-export 19.2.56 → 19.3.53

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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 19.2.56
3
+ * version : 19.3.53
4
4
  * Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "_from": "@syncfusion/ej2-pdf-export@*",
3
- "_id": "@syncfusion/ej2-pdf-export@19.2.55",
3
+ "_id": "@syncfusion/ej2-pdf-export@19.2.56",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-T0iNeu5YZ4SuNLJ8468GWQci1gLRkfFmbLOeeYnu3S7/vphlyCl/kVF+h5qdlMuIaAL2FzCZupnIHB8Du2EMwA==",
5
+ "_integrity": "sha512-Lni0gsdRZgos5Djn+qYBhbmIVmw02XlnkXe+DGScnb4jiTNyyE5VaET8fzfJiuF01MXA26rI7TTXd+71sCWYEw==",
6
6
  "_location": "/@syncfusion/ej2-pdf-export",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
@@ -28,8 +28,8 @@
28
28
  "/@syncfusion/ej2-pivotview",
29
29
  "/@syncfusion/ej2-treemap"
30
30
  ],
31
- "_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix/@syncfusion/ej2-pdf-export/-/ej2-pdf-export-19.2.55.tgz",
32
- "_shasum": "9dd85bebb8b72486f74052296a258c34cbe9a45c",
31
+ "_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix/@syncfusion/ej2-pdf-export/-/ej2-pdf-export-19.2.56.tgz",
32
+ "_shasum": "5d13f0f69f560b817b21f669f45a7c241a510c09",
33
33
  "_spec": "@syncfusion/ej2-pdf-export@*",
34
34
  "_where": "/jenkins/workspace/automation_release_19.1.0.1-ZPMUBNQ6AUYH6YGEFBPVYMEQLRRW2SLD4XCZ6GATNZJFYJ3RIAOA/packages/included",
35
35
  "author": {
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "bundleDependencies": false,
42
42
  "dependencies": {
43
- "@syncfusion/ej2-compression": "~19.2.55"
43
+ "@syncfusion/ej2-compression": "~19.3.53"
44
44
  },
45
45
  "deprecated": false,
46
46
  "description": "Essential Javascript 2 PDF Library",
@@ -56,6 +56,6 @@
56
56
  "url": "git+https://github.com/syncfusion/ej2-javascript-ui-controls.git"
57
57
  },
58
58
  "typings": "index.d.ts",
59
- "version": "19.2.56",
59
+ "version": "19.3.53",
60
60
  "sideEffects": false
61
61
  }
@@ -212,6 +212,9 @@ export declare class PdfGridLayouter extends ElementLayouter {
212
212
  * @private
213
213
  */
214
214
  private rowBreakPageHeightCellIndex;
215
+ private slr;
216
+ private remainderText;
217
+ private isPaginate;
215
218
  /**
216
219
  * Initialize a new instance for `PdfGrid` class.
217
220
  * @private
@@ -331,6 +334,7 @@ export declare class PdfGridLayouter extends ElementLayouter {
331
334
  */
332
335
  private raisePageLayouted;
333
336
  private drawRow;
337
+ private isFitToCell;
334
338
  /**
335
339
  * `Draws row`
336
340
  * @private
@@ -19,6 +19,8 @@ import { PdfLayoutType, PdfLayoutBreakType } from './../../../graphics/figures/e
19
19
  import { PdfLayoutResult, PdfLayoutFormat, ElementLayouter } from './../../../graphics/figures/base/element-layouter';
20
20
  import { PdfHorizontalOverflowType } from '../styles/style';
21
21
  import { TemporaryDictionary } from './../../../collections/object-object-pair/dictionary';
22
+ import { PdfStringLayouter } from './../../../graphics/fonts/string-layouter';
23
+ import { PdfDocument } from './../../../document/pdf-document';
22
24
  /**
23
25
  * Class `lay outing the text`.
24
26
  *
@@ -90,6 +92,9 @@ var PdfGridLayouter = /** @class */ (function (_super) {
90
92
  * @private
91
93
  */
92
94
  _this.breakRow = true;
95
+ _this.slr = null;
96
+ _this.remainderText = null;
97
+ _this.isPaginate = false;
93
98
  /**
94
99
  * Checks whether the x co-ordinate is need to set as client size or not.
95
100
  * @hidden
@@ -519,6 +524,10 @@ var PdfGridLayouter = /** @class */ (function (_super) {
519
524
  this.currentBounds.x += this.startLocation.x;
520
525
  this.currentBounds.y += this.startLocation.y;
521
526
  }
527
+ if (this.isPaginate) {
528
+ this.startLocation.y = this.currentBounds.y;
529
+ this.isPaginate = false;
530
+ }
522
531
  if (this.Grid.isChildGrid && row.grid.ParentCell != null) {
523
532
  if (this.Grid.ParentCell.row.grid.style.cellPadding != null) {
524
533
  if (row.rowBreakHeight + this.Grid.ParentCell.row.grid.style.cellPadding.top < this.currentBounds.height) {
@@ -686,7 +695,13 @@ var PdfGridLayouter = /** @class */ (function (_super) {
686
695
  param.bounds.height > 0 && !this.Grid.isChildGrid) {
687
696
  this.currentBounds.height = param.bounds.height;
688
697
  }
689
- if ((param.format !== null) && !param.format.usePaginateBounds && param.bounds !== null &&
698
+ if (typeof param.format !== 'undefined' && param.format != null && typeof param.format.usePaginateBounds !== 'undefined' && !param.format.usePaginateBounds && !(param.format.paginateBounds.x === 0 && param.format.paginateBounds.y === 0 && param.format.paginateBounds.width === 0 && param.format.paginateBounds.height === 0) && param.format.paginateBounds.y === 0) {
699
+ this.currentBounds.y = PdfBorders.default.top.width / 2;
700
+ }
701
+ else {
702
+ this.currentBounds.y = format == null ? 0 : format.paginateBounds.y;
703
+ }
704
+ if (typeof param.format !== 'undefined' && (param.format !== null) && typeof param.format.usePaginateBounds !== 'undefined' && !param.format.usePaginateBounds && param.bounds !== null &&
690
705
  param.bounds.y > 0 && !this.Grid.isChildGrid) {
691
706
  this.currentBounds.y = param.bounds.y;
692
707
  }
@@ -1134,10 +1149,28 @@ var PdfGridLayouter = /** @class */ (function (_super) {
1134
1149
  this.currentBounds.y + calculatedHeight > (this.currentBounds.height + this.startLocation.y) ||
1135
1150
  this.currentBounds.y + rowHeightWithSpan > this.currentPageBounds.height) {
1136
1151
  // If a row is repeated and still cannot fit in page, proceed draw.
1137
- if (this.Grid.LayoutFormat.break === PdfLayoutBreakType.FitPage) {
1138
- PdfGridLayouter.repeatRowIndex = this.Grid.rows.rowCollection.indexOf(row);
1152
+ var isFit = false;
1153
+ if ((this.Grid.allowRowBreakAcrossPages && !this.Grid.repeatHeader && !row.isRowHeightSet && !row.rowMergeComplete)) {
1154
+ if (this.Grid.LayoutFormat !== null && this.Grid.LayoutFormat.paginateBounds.height > 0 && typeof this.Grid.ParentCell !== 'undefined' && this.Grid.ParentCell !== null && (this.currentBounds.y + this.Grid.ParentCell.row.grid.style.cellPadding.bottom + calculatedHeight) > this.currentBounds.height) {
1155
+ isFit = this.isFitToCell((this.currentBounds.height + this.startLocation.y) - this.currentBounds.y, this.Grid, row);
1156
+ }
1157
+ else
1158
+ isFit = this.isFitToCell(this.currentPageBounds.height - this.currentBounds.y, this.Grid, row);
1159
+ if (isFit) {
1160
+ this.isPaginate = true;
1161
+ }
1139
1162
  }
1140
- if (PdfGridLayouter.repeatRowIndex > -1 && PdfGridLayouter.repeatRowIndex === row.rowIndex) {
1163
+ else if (this.Grid.allowRowBreakAcrossPages && this.Grid.LayoutFormat != null && this.Grid.LayoutFormat.layout == PdfLayoutType.Paginate && this.Grid.LayoutFormat.break != PdfLayoutBreakType.FitElement && row.isRowHeightSet && this.currentBounds.y + height > this.currentPageBounds.height) {
1164
+ isFit = this.isFitToCell(this.currentPageBounds.height - this.currentBounds.y, this.Grid, row);
1165
+ if (!isFit)
1166
+ isFit = !(this.slr !== null && this.slr.actualSize.height == 0 && this.slr.remainder != null && this.slr.remainder.length > 0 && this.remainderText == this.slr.remainder);
1167
+ if (isFit && this.slr != null && this.slr.lineCount > 1) {
1168
+ //It may text cutoff issue
1169
+ isFit = false;
1170
+ }
1171
+ this.remainderText = null;
1172
+ }
1173
+ if (PdfGridLayouter.repeatRowIndex > -1 && PdfGridLayouter.repeatRowIndex === row.rowIndex || isFit) {
1141
1174
  if (this.Grid.allowRowBreakAcrossPages) {
1142
1175
  result_1.isFinish = true;
1143
1176
  this.drawRowWithBreak(result_1, row, calculatedHeight);
@@ -1147,10 +1180,10 @@ var PdfGridLayouter = /** @class */ (function (_super) {
1147
1180
  result_1.isFinish = false;
1148
1181
  }
1149
1182
  }
1150
- // else {
1151
- // result.isFinish = false;
1152
- // this.drawRow(row, result, calculatedHeight);
1153
- // }
1183
+ else {
1184
+ result_1.isFinish = false;
1185
+ this.drawRow(row, result_1, calculatedHeight);
1186
+ }
1154
1187
  }
1155
1188
  else {
1156
1189
  result_1.isFinish = false;
@@ -1246,6 +1279,44 @@ var PdfGridLayouter = /** @class */ (function (_super) {
1246
1279
  result.bounds = new RectangleF(new PointF(result.bounds.x, result.bounds.y), new SizeF(location_4.x, location_4.y));
1247
1280
  }
1248
1281
  };
1282
+ PdfGridLayouter.prototype.isFitToCell = function (currentHeight, grid, gridRow) {
1283
+ var isFit = false;
1284
+ var layouter = new PdfStringLayouter();
1285
+ for (var i = 0; i < gridRow.cells.count; i++) {
1286
+ var cell = gridRow.cells.getCell(i);
1287
+ if (typeof cell.value !== 'undefined' && cell.value !== null && typeof cell.value === 'string') {
1288
+ var font = null;
1289
+ if (typeof cell.style.font !== 'undefined' && cell.style.font != null) {
1290
+ font = cell.style.font;
1291
+ }
1292
+ else if (typeof cell.row.style.font !== 'undefined' && cell.row.style.font != null) {
1293
+ font = cell.row.style.font;
1294
+ }
1295
+ else if (typeof cell.row.grid.style.font !== 'undefined' && cell.row.grid.style.font != null) {
1296
+ font = cell.row.grid.style.font;
1297
+ }
1298
+ else {
1299
+ font = PdfDocument.defaultFont;
1300
+ }
1301
+ this.remainderText = gridRow.cells.getCell(i).value;
1302
+ var width = gridRow.cells.getCell(i).width;
1303
+ if (grid.columns.getColumn(i).isCustomWidth && gridRow.cells.getCell(i).width > grid.columns.getColumn(i).width) {
1304
+ width = grid.columns.getColumn(i).width;
1305
+ }
1306
+ this.slr = layouter.layout(gridRow.cells.getCell(i).value, font, gridRow.cells.getCell(i).stringFormat, new SizeF(width, currentHeight), false, this.currentPageBounds);
1307
+ var height = this.slr.actualSize.height;
1308
+ if (height == 0) {
1309
+ isFit = false;
1310
+ break;
1311
+ }
1312
+ else if (currentHeight > height || (typeof this.slr.remainder !== 'undefined' && this.slr.remainder !== null)) {
1313
+ isFit = true;
1314
+ break;
1315
+ }
1316
+ }
1317
+ }
1318
+ return isFit;
1319
+ };
1249
1320
  PdfGridLayouter.prototype.drawRowWithBreak = function (result, row, calculateHeight) {
1250
1321
  var location = new PointF(this.currentBounds.x, this.currentBounds.y);
1251
1322
  if (row.grid.isChildGrid && row.grid.allowRowBreakAcrossPages && this.startLocation.x !== this.currentBounds.x) {
@@ -1299,7 +1370,7 @@ var PdfGridLayouter = /** @class */ (function (_super) {
1299
1370
  }
1300
1371
  //If still row is to be drawn, set cell finished drawing cell as false and update the text to be drawn.
1301
1372
  if (row.rowBreakHeight > 0.0) {
1302
- if (stringResult != null) {
1373
+ if (stringResult != null && typeof stringResult.remainder !== 'undefined') {
1303
1374
  row.cells.getCell(i).FinishedDrawingCell = false;
1304
1375
  row.cells.getCell(i).remainingString = stringResult.remainder == null ? ' ' : stringResult.remainder;
1305
1376
  if (row.grid.isChildGrid) {