@syncfusion/ej2-pdf-export 19.3.53 → 19.4.48

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.
@@ -19546,6 +19546,7 @@ var PdfSection = /** @__PURE__ @class */ (function () {
19546
19546
  * @private
19547
19547
  * @param document The parent document.
19548
19548
  * @param page The parent page.
19549
+ * @param headers If true - return headers/footers, if false - return simple templates.
19549
19550
  * @param foreground If true - return foreground templates, if false - return background templates.
19550
19551
  * @returns Returns array of the document templates.
19551
19552
  */
@@ -29865,7 +29866,7 @@ var PdfGridCell = /** @__PURE__ @class */ (function () {
29865
29866
  }
29866
29867
  };
29867
29868
  // private setTransparency(graphics : PdfGraphics, pen : PdfPen) : void {
29868
- // let alpha : number = (pen.color.a / 255)as number;
29869
+ // let alpha : number = (pen.color.a / 255) as number;
29869
29870
  // graphics.save();
29870
29871
  // graphics.setTransparency(alpha);
29871
29872
  // }
@@ -30584,6 +30585,7 @@ var PdfGridRow = /** @__PURE__ @class */ (function () {
30584
30585
  this.isRowMergeComplete = true;
30585
30586
  this.repeatFlag = false;
30586
30587
  this.rowFontSplit = false;
30588
+ this.isHeaderRow = false;
30587
30589
  this.pdfGrid = grid;
30588
30590
  }
30589
30591
  Object.defineProperty(PdfGridRow.prototype, "rowSpanExists", {
@@ -30812,10 +30814,10 @@ var PdfGridRow = /** @__PURE__ @class */ (function () {
30812
30814
  this.rowMergeComplete = false;
30813
30815
  if (cell.rowSpan > 1) {
30814
30816
  var cellIn = i;
30815
- var rowin = this.grid.rows.rowCollection.indexOf(this);
30817
+ var rowin = this.isHeaderRow ? this.grid.headers.indexOf(this) : this.grid.rows.rowCollection.indexOf(this);
30816
30818
  for (var j = 0; j < cell.rowSpan; j++) {
30817
30819
  if ((j + 1) < cell.rowSpan) {
30818
- this.grid.rows.getRow(rowin + j + 1).cells.getCell(cellIn).hasRowSpan = true;
30820
+ (this.isHeaderRow ? this.grid.headers.getHeader(rowin + j + 1) : this.grid.rows.getRow(rowin + j + 1)).cells.getCell(cellIn).hasRowSpan = true;
30819
30821
  }
30820
30822
  }
30821
30823
  if (maxHeight < cell.height) {
@@ -30958,6 +30960,7 @@ var PdfGridHeaderCollection = /** @__PURE__ @class */ (function () {
30958
30960
  var row = void 0;
30959
30961
  for (var i = 0; i < arg; i++) {
30960
30962
  row = new PdfGridRow(this.grid);
30963
+ row.isHeaderRow = true;
30961
30964
  for (var j = 0; j < this.grid.columns.count; j++) {
30962
30965
  row.cells.add(new PdfGridCell());
30963
30966
  }
@@ -31319,6 +31322,20 @@ var PdfGrid = /** @__PURE__ @class */ (function (_super) {
31319
31322
  * @private
31320
31323
  */
31321
31324
  PdfGrid.prototype.layout = function (param) {
31325
+ var width = param.bounds.width;
31326
+ var height = param.bounds.height;
31327
+ var hasChanged = false;
31328
+ if (typeof param.bounds.width === 'undefined' || param.bounds.width === 0) {
31329
+ width = param.page.getClientSize().width - param.bounds.x;
31330
+ hasChanged = true;
31331
+ }
31332
+ if (typeof param.bounds.height === 'undefined' || param.bounds.height === 0) {
31333
+ height = param.page.getClientSize().height - param.bounds.y;
31334
+ hasChanged = true;
31335
+ }
31336
+ if (hasChanged) {
31337
+ param.bounds = new RectangleF(param.bounds.x, param.bounds.y, width, height);
31338
+ }
31322
31339
  if (this.rows.count !== 0) {
31323
31340
  var currentRow = this.rows.getRow(0).cells.getCell(0).style;
31324
31341
  if (currentRow.borders != null && ((currentRow.borders.left != null && currentRow.borders.left.width !== 1) ||
@@ -31894,7 +31911,10 @@ var PdfGridLayouter = /** @__PURE__ @class */ (function (_super) {
31894
31911
  var index = 0;
31895
31912
  index = this.currentGraphics.page.section.indexOf(this.currentGraphics.page);
31896
31913
  this.listOfNavigatePages.push(index);
31897
- if (format != null && format.break === PdfLayoutBreakType.FitColumnsToPage) {
31914
+ if (typeof param.bounds !== 'undefined' && param.bounds !== null && (!(param.bounds.x === 0 && param.bounds.y === 0 && param.bounds.width === 0 && param.bounds.height === 0))) {
31915
+ this.currentBounds = new RectangleF(new PointF(param.bounds.x, param.bounds.y), new SizeF(param.bounds.width, param.bounds.height));
31916
+ }
31917
+ else if (format != null && format.break === PdfLayoutBreakType.FitColumnsToPage) {
31898
31918
  this.currentBounds = new RectangleF(new PointF(param.bounds.x, param.bounds.y), new SizeF(this.Grid.columns.width, this.currentGraphics.clientSize.height));
31899
31919
  }
31900
31920
  else {
@@ -31934,7 +31954,12 @@ var PdfGridLayouter = /** @__PURE__ @class */ (function (_super) {
31934
31954
  }
31935
31955
  if (!this.Grid.style.allowHorizontalOverflow) {
31936
31956
  this.columnRanges = [];
31937
- this.Grid.measureColumnsWidth(this.currentBounds);
31957
+ if (typeof this.Grid.isChildGrid !== 'undefined' && typeof this.Grid.isChildGrid) {
31958
+ this.Grid.measureColumnsWidth(this.currentBounds);
31959
+ }
31960
+ else {
31961
+ this.Grid.measureColumnsWidth(new RectangleF(this.currentBounds.x, this.currentBounds.y, this.currentBounds.x + this.currentBounds.width, this.currentBounds.height));
31962
+ }
31938
31963
  this.columnRanges.push([0, this.Grid.columns.count - 1]);
31939
31964
  }
31940
31965
  else {
@@ -32320,7 +32345,7 @@ var PdfGridLayouter = /** @__PURE__ @class */ (function (_super) {
32320
32345
  }
32321
32346
  row.grid.splitChildRowIndex = -1;
32322
32347
  row.grid.isGridSplit = false;
32323
- rowResult.isFinish = true;
32348
+ rowResult.isFinish = this.checkIsFisished(row);
32324
32349
  //row.NestedGridLayoutResult.bounds.height = row.rowBreakHeightValue;
32325
32350
  //this.currentBounds.y = rowResult.bounds.y;
32326
32351
  for (var i_4 = 0; i_4 < row.cells.count; i_4++) {
@@ -32379,9 +32404,10 @@ var PdfGridLayouter = /** @__PURE__ @class */ (function (_super) {
32379
32404
  {
32380
32405
  this.currentBounds.y = format == null ? 0 : format.paginateBounds.y;
32381
32406
 
32382
- }
32383
- if (this.raiseBeforePageLayout(this.currentPage, this.currentBounds, this.currentRowIndex))
32384
- break;*/
32407
+ }*/
32408
+ if (this.raiseBeforePageLayout(this.currentPage, this.currentBounds, this.currentRowIndex).returnValue) {
32409
+ break;
32410
+ }
32385
32411
  if ((param.format !== null) && !param.format.usePaginateBounds && param.bounds !== null &&
32386
32412
  param.bounds.height > 0 && !this.Grid.isChildGrid) {
32387
32413
  this.currentBounds.height = param.bounds.height;
@@ -32391,6 +32417,11 @@ var PdfGridLayouter = /** @__PURE__ @class */ (function (_super) {
32391
32417
  }
32392
32418
  else {
32393
32419
  this.currentBounds.y = format == null ? 0 : format.paginateBounds.y;
32420
+ if (format != null && (format.paginateBounds.x !== 0 || format.paginateBounds.y !== 0 || format.paginateBounds.height !== 0 || format.paginateBounds.width !== 0)) {
32421
+ this.currentBounds.x = format.paginateBounds.x;
32422
+ this.currentBounds.width = format.paginateBounds.width;
32423
+ this.currentBounds.height = format.paginateBounds.height;
32424
+ }
32394
32425
  }
32395
32426
  if (typeof param.format !== 'undefined' && (param.format !== null) && typeof param.format.usePaginateBounds !== 'undefined' && !param.format.usePaginateBounds && param.bounds !== null &&
32396
32427
  param.bounds.y > 0 && !this.Grid.isChildGrid) {
@@ -32539,6 +32570,15 @@ var PdfGridLayouter = /** @__PURE__ @class */ (function (_super) {
32539
32570
  this.raisePageLayouted(result);
32540
32571
  return result;
32541
32572
  };
32573
+ PdfGridLayouter.prototype.checkIsFisished = function (row) {
32574
+ var result = true;
32575
+ for (var i = 0; i < row.cells.count; i++) {
32576
+ if (!row.cells.getCell(i).FinishedDrawingCell) {
32577
+ result = false;
32578
+ }
32579
+ }
32580
+ return result;
32581
+ };
32542
32582
  /* tslint:enable */
32543
32583
  /**
32544
32584
  * Gets the `next page`.
@@ -32620,7 +32660,7 @@ var PdfGridLayouter = /** @__PURE__ @class */ (function (_super) {
32620
32660
  for (var i = 0; i < layoutedPages.size(); i++) {
32621
32661
  for (var j = i, count_1 = (layoutedPages.size() / this.columnRanges.length); j < layoutedPages.size(); j += count_1) {
32622
32662
  var page = pages[j];
32623
- if (document.pages.indexOf(page) === -1) {
32663
+ if (typeof page !== 'undefined' && document.pages.indexOf(page) === -1) {
32624
32664
  document.pages.add(page);
32625
32665
  }
32626
32666
  }
@@ -32682,7 +32722,7 @@ var PdfGridLayouter = /** @__PURE__ @class */ (function (_super) {
32682
32722
  // new SizeF(args.Bounds.width + args.Bounds.x ,
32683
32723
  // args.Bounds.height)));
32684
32724
  // }
32685
- cancel = args.cancel;
32725
+ cancel = (typeof args.cancel === 'undefined' ? false : args.cancel);
32686
32726
  currentBounds = args.bounds;
32687
32727
  currentRow = args.startRowIndex;
32688
32728
  }
@@ -32740,7 +32780,7 @@ var PdfGridLayouter = /** @__PURE__ @class */ (function (_super) {
32740
32780
  // }
32741
32781
  }
32742
32782
  var calculatedHeight = row.rowBreakHeight > 0.0 ? row.rowBreakHeight : row.height;
32743
- if (this.Grid.isChildGrid && this.Grid.ParentCell != null) {
32783
+ if (typeof this.Grid.isChildGrid !== 'undefined' && this.Grid.isChildGrid && typeof this.Grid.ParentCell !== 'undefined' && this.Grid.ParentCell != null) {
32744
32784
  //Split row only if row height exceeds page height and AllowRowBreakAcrossPages is true.
32745
32785
  // if (calculatedHeight + this.Grid.ParentCell.row.grid.style.cellPadding.bottom +
32746
32786
  // this.Grid.ParentCell.row.grid.style.cellPadding.top > this.currentPageBounds.height) {
@@ -32770,7 +32810,7 @@ var PdfGridLayouter = /** @__PURE__ @class */ (function (_super) {
32770
32810
  + calculatedHeight > this.currentBounds.height || this.currentBounds.y +
32771
32811
  this.Grid.ParentCell.row.grid.style.cellPadding.bottom + rowHeightWithSpan > this.currentPageBounds.height) {
32772
32812
  //If a row is repeated and still cannot fit in page, proceed draw.
32773
- if (this.Grid.ParentCell.row.grid.LayoutFormat.break === PdfLayoutBreakType.FitPage) {
32813
+ if (typeof this.Grid.ParentCell.row.grid.LayoutFormat !== 'undefined' && this.Grid.ParentCell.row.grid.LayoutFormat.break === PdfLayoutBreakType.FitPage) {
32774
32814
  PdfGridLayouter.repeatRowIndex = this.Grid.rows.rowCollection.indexOf(row);
32775
32815
  this.Grid.splitChildRowIndex = this.Grid.rows.rowCollection.indexOf(row);
32776
32816
  }
@@ -32840,7 +32880,7 @@ var PdfGridLayouter = /** @__PURE__ @class */ (function (_super) {
32840
32880
  // If a row is repeated and still cannot fit in page, proceed draw.
32841
32881
  var isFit = false;
32842
32882
  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) {
32883
+ if (this.Grid.LayoutFormat !== null && this.Grid.LayoutFormat.paginateBounds.height > 0) {
32844
32884
  isFit = this.isFitToCell((this.currentBounds.height + this.startLocation.y) - this.currentBounds.y, this.Grid, row);
32845
32885
  }
32846
32886
  else
@@ -32998,7 +33038,18 @@ var PdfGridLayouter = /** @__PURE__ @class */ (function (_super) {
32998
33038
  isFit = false;
32999
33039
  break;
33000
33040
  }
33001
- else if (currentHeight > height || (typeof this.slr.remainder !== 'undefined' && this.slr.remainder !== null)) {
33041
+ if (gridRow.cells.getCell(i).style != null && gridRow.cells.getCell(i).style.borders != null && gridRow.cells.getCell(i).style.borders.top != null && gridRow.cells.getCell(i).style.borders.bottom != null)
33042
+ height += (gridRow.cells.getCell(i).style.borders.top.width + gridRow.cells.getCell(i).style.borders.bottom.width) * 2;
33043
+ if (this.slr.lineCount > 1 && gridRow.cells.getCell(i).stringFormat != null && gridRow.cells.getCell(i).stringFormat.lineSpacing != 0)
33044
+ height += (this.slr.lineCount - 1) * (gridRow.cells.getCell(i).style.stringFormat.lineSpacing);
33045
+ if (gridRow.cells.getCell(i).style.cellPadding == null) {
33046
+ height += (grid.style.cellPadding.top + grid.style.cellPadding.bottom);
33047
+ }
33048
+ else {
33049
+ height += (grid.style.cellPadding.top + grid.style.cellPadding.bottom);
33050
+ }
33051
+ height += grid.style.cellSpacing;
33052
+ if (currentHeight > height || (typeof this.slr.remainder !== 'undefined' && this.slr.remainder !== null)) {
33002
33053
  isFit = true;
33003
33054
  break;
33004
33055
  }
@@ -33062,9 +33113,7 @@ var PdfGridLayouter = /** @__PURE__ @class */ (function (_super) {
33062
33113
  if (stringResult != null && typeof stringResult.remainder !== 'undefined') {
33063
33114
  row.cells.getCell(i).FinishedDrawingCell = false;
33064
33115
  row.cells.getCell(i).remainingString = stringResult.remainder == null ? ' ' : stringResult.remainder;
33065
- if (row.grid.isChildGrid) {
33066
- row.rowBreakHeight = calculateHeight - stringResult.actualSize.height;
33067
- }
33116
+ row.rowBreakHeight = calculateHeight - stringResult.actualSize.height;
33068
33117
  }
33069
33118
  }
33070
33119
  result.isFinish = (!result.isFinish) ? result.isFinish : row.cells.getCell(i).FinishedDrawingCell;