@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.
@@ -31786,6 +31786,9 @@ var PdfGridLayouter = /** @__PURE__ @class */ (function (_super) {
31786
31786
  * @private
31787
31787
  */
31788
31788
  _this.breakRow = true;
31789
+ _this.slr = null;
31790
+ _this.remainderText = null;
31791
+ _this.isPaginate = false;
31789
31792
  /**
31790
31793
  * Checks whether the x co-ordinate is need to set as client size or not.
31791
31794
  * @hidden
@@ -32213,6 +32216,10 @@ var PdfGridLayouter = /** @__PURE__ @class */ (function (_super) {
32213
32216
  this.currentBounds.x += this.startLocation.x;
32214
32217
  this.currentBounds.y += this.startLocation.y;
32215
32218
  }
32219
+ if (this.isPaginate) {
32220
+ this.startLocation.y = this.currentBounds.y;
32221
+ this.isPaginate = false;
32222
+ }
32216
32223
  if (this.Grid.isChildGrid && row.grid.ParentCell != null) {
32217
32224
  if (this.Grid.ParentCell.row.grid.style.cellPadding != null) {
32218
32225
  if (row.rowBreakHeight + this.Grid.ParentCell.row.grid.style.cellPadding.top < this.currentBounds.height) {
@@ -32379,7 +32386,13 @@ var PdfGridLayouter = /** @__PURE__ @class */ (function (_super) {
32379
32386
  param.bounds.height > 0 && !this.Grid.isChildGrid) {
32380
32387
  this.currentBounds.height = param.bounds.height;
32381
32388
  }
32382
- if ((param.format !== null) && !param.format.usePaginateBounds && param.bounds !== null &&
32389
+ 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) {
32390
+ this.currentBounds.y = PdfBorders.default.top.width / 2;
32391
+ }
32392
+ else {
32393
+ this.currentBounds.y = format == null ? 0 : format.paginateBounds.y;
32394
+ }
32395
+ if (typeof param.format !== 'undefined' && (param.format !== null) && typeof param.format.usePaginateBounds !== 'undefined' && !param.format.usePaginateBounds && param.bounds !== null &&
32383
32396
  param.bounds.y > 0 && !this.Grid.isChildGrid) {
32384
32397
  this.currentBounds.y = param.bounds.y;
32385
32398
  }
@@ -32825,10 +32838,28 @@ var PdfGridLayouter = /** @__PURE__ @class */ (function (_super) {
32825
32838
  this.currentBounds.y + calculatedHeight > (this.currentBounds.height + this.startLocation.y) ||
32826
32839
  this.currentBounds.y + rowHeightWithSpan > this.currentPageBounds.height) {
32827
32840
  // If a row is repeated and still cannot fit in page, proceed draw.
32828
- if (this.Grid.LayoutFormat.break === PdfLayoutBreakType.FitPage) {
32829
- PdfGridLayouter.repeatRowIndex = this.Grid.rows.rowCollection.indexOf(row);
32841
+ var isFit = false;
32842
+ if ((this.Grid.allowRowBreakAcrossPages && !this.Grid.repeatHeader && !row.isRowHeightSet && !row.rowMergeComplete)) {
32843
+ 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) {
32844
+ isFit = this.isFitToCell((this.currentBounds.height + this.startLocation.y) - this.currentBounds.y, this.Grid, row);
32845
+ }
32846
+ else
32847
+ isFit = this.isFitToCell(this.currentPageBounds.height - this.currentBounds.y, this.Grid, row);
32848
+ if (isFit) {
32849
+ this.isPaginate = true;
32850
+ }
32830
32851
  }
32831
- if (PdfGridLayouter.repeatRowIndex > -1 && PdfGridLayouter.repeatRowIndex === row.rowIndex) {
32852
+ 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) {
32853
+ isFit = this.isFitToCell(this.currentPageBounds.height - this.currentBounds.y, this.Grid, row);
32854
+ if (!isFit)
32855
+ isFit = !(this.slr !== null && this.slr.actualSize.height == 0 && this.slr.remainder != null && this.slr.remainder.length > 0 && this.remainderText == this.slr.remainder);
32856
+ if (isFit && this.slr != null && this.slr.lineCount > 1) {
32857
+ //It may text cutoff issue
32858
+ isFit = false;
32859
+ }
32860
+ this.remainderText = null;
32861
+ }
32862
+ if (PdfGridLayouter.repeatRowIndex > -1 && PdfGridLayouter.repeatRowIndex === row.rowIndex || isFit) {
32832
32863
  if (this.Grid.allowRowBreakAcrossPages) {
32833
32864
  result_1.isFinish = true;
32834
32865
  this.drawRowWithBreak(result_1, row, calculatedHeight);
@@ -32838,10 +32869,10 @@ var PdfGridLayouter = /** @__PURE__ @class */ (function (_super) {
32838
32869
  result_1.isFinish = false;
32839
32870
  }
32840
32871
  }
32841
- // else {
32842
- // result.isFinish = false;
32843
- // this.drawRow(row, result, calculatedHeight);
32844
- // }
32872
+ else {
32873
+ result_1.isFinish = false;
32874
+ this.drawRow(row, result_1, calculatedHeight);
32875
+ }
32845
32876
  }
32846
32877
  else {
32847
32878
  result_1.isFinish = false;
@@ -32937,6 +32968,44 @@ var PdfGridLayouter = /** @__PURE__ @class */ (function (_super) {
32937
32968
  result.bounds = new RectangleF(new PointF(result.bounds.x, result.bounds.y), new SizeF(location_4.x, location_4.y));
32938
32969
  }
32939
32970
  };
32971
+ PdfGridLayouter.prototype.isFitToCell = function (currentHeight, grid, gridRow) {
32972
+ var isFit = false;
32973
+ var layouter = new PdfStringLayouter();
32974
+ for (var i = 0; i < gridRow.cells.count; i++) {
32975
+ var cell = gridRow.cells.getCell(i);
32976
+ if (typeof cell.value !== 'undefined' && cell.value !== null && typeof cell.value === 'string') {
32977
+ var font = null;
32978
+ if (typeof cell.style.font !== 'undefined' && cell.style.font != null) {
32979
+ font = cell.style.font;
32980
+ }
32981
+ else if (typeof cell.row.style.font !== 'undefined' && cell.row.style.font != null) {
32982
+ font = cell.row.style.font;
32983
+ }
32984
+ else if (typeof cell.row.grid.style.font !== 'undefined' && cell.row.grid.style.font != null) {
32985
+ font = cell.row.grid.style.font;
32986
+ }
32987
+ else {
32988
+ font = PdfDocument.defaultFont;
32989
+ }
32990
+ this.remainderText = gridRow.cells.getCell(i).value;
32991
+ var width = gridRow.cells.getCell(i).width;
32992
+ if (grid.columns.getColumn(i).isCustomWidth && gridRow.cells.getCell(i).width > grid.columns.getColumn(i).width) {
32993
+ width = grid.columns.getColumn(i).width;
32994
+ }
32995
+ this.slr = layouter.layout(gridRow.cells.getCell(i).value, font, gridRow.cells.getCell(i).stringFormat, new SizeF(width, currentHeight), false, this.currentPageBounds);
32996
+ var height = this.slr.actualSize.height;
32997
+ if (height == 0) {
32998
+ isFit = false;
32999
+ break;
33000
+ }
33001
+ else if (currentHeight > height || (typeof this.slr.remainder !== 'undefined' && this.slr.remainder !== null)) {
33002
+ isFit = true;
33003
+ break;
33004
+ }
33005
+ }
33006
+ }
33007
+ return isFit;
33008
+ };
32940
33009
  PdfGridLayouter.prototype.drawRowWithBreak = function (result, row, calculateHeight) {
32941
33010
  var location = new PointF(this.currentBounds.x, this.currentBounds.y);
32942
33011
  if (row.grid.isChildGrid && row.grid.allowRowBreakAcrossPages && this.startLocation.x !== this.currentBounds.x) {
@@ -32990,7 +33059,7 @@ var PdfGridLayouter = /** @__PURE__ @class */ (function (_super) {
32990
33059
  }
32991
33060
  //If still row is to be drawn, set cell finished drawing cell as false and update the text to be drawn.
32992
33061
  if (row.rowBreakHeight > 0.0) {
32993
- if (stringResult != null) {
33062
+ if (stringResult != null && typeof stringResult.remainder !== 'undefined') {
32994
33063
  row.cells.getCell(i).FinishedDrawingCell = false;
32995
33064
  row.cells.getCell(i).remainingString = stringResult.remainder == null ? ' ' : stringResult.remainder;
32996
33065
  if (row.grid.isChildGrid) {