@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.
@@ -17946,6 +17946,7 @@ class PdfSection {
17946
17946
  * @private
17947
17947
  * @param document The parent document.
17948
17948
  * @param page The parent page.
17949
+ * @param headers If true - return headers/footers, if false - return simple templates.
17949
17950
  * @param foreground If true - return foreground templates, if false - return background templates.
17950
17951
  * @returns Returns array of the document templates.
17951
17952
  */
@@ -26836,7 +26837,7 @@ class PdfGridCell {
26836
26837
  }
26837
26838
  }
26838
26839
  // private setTransparency(graphics : PdfGraphics, pen : PdfPen) : void {
26839
- // let alpha : number = (pen.color.a / 255)as number;
26840
+ // let alpha : number = (pen.color.a / 255) as number;
26840
26841
  // graphics.save();
26841
26842
  // graphics.setTransparency(alpha);
26842
26843
  // }
@@ -27527,6 +27528,7 @@ class PdfGridRow {
27527
27528
  this.isRowMergeComplete = true;
27528
27529
  this.repeatFlag = false;
27529
27530
  this.rowFontSplit = false;
27531
+ this.isHeaderRow = false;
27530
27532
  this.pdfGrid = grid;
27531
27533
  }
27532
27534
  //Properties
@@ -27707,10 +27709,10 @@ class PdfGridRow {
27707
27709
  this.rowMergeComplete = false;
27708
27710
  if (cell.rowSpan > 1) {
27709
27711
  let cellIn = i;
27710
- let rowin = this.grid.rows.rowCollection.indexOf(this);
27712
+ let rowin = this.isHeaderRow ? this.grid.headers.indexOf(this) : this.grid.rows.rowCollection.indexOf(this);
27711
27713
  for (let j = 0; j < cell.rowSpan; j++) {
27712
27714
  if ((j + 1) < cell.rowSpan) {
27713
- this.grid.rows.getRow(rowin + j + 1).cells.getCell(cellIn).hasRowSpan = true;
27715
+ (this.isHeaderRow ? this.grid.headers.getHeader(rowin + j + 1) : this.grid.rows.getRow(rowin + j + 1)).cells.getCell(cellIn).hasRowSpan = true;
27714
27716
  }
27715
27717
  }
27716
27718
  if (maxHeight < cell.height) {
@@ -27839,6 +27841,7 @@ class PdfGridHeaderCollection {
27839
27841
  let row;
27840
27842
  for (let i = 0; i < arg; i++) {
27841
27843
  row = new PdfGridRow(this.grid);
27844
+ row.isHeaderRow = true;
27842
27845
  for (let j = 0; j < this.grid.columns.count; j++) {
27843
27846
  row.cells.add(new PdfGridCell());
27844
27847
  }
@@ -28128,6 +28131,20 @@ class PdfGrid extends PdfLayoutElement {
28128
28131
  * @private
28129
28132
  */
28130
28133
  layout(param) {
28134
+ let width = param.bounds.width;
28135
+ let height = param.bounds.height;
28136
+ let hasChanged = false;
28137
+ if (typeof param.bounds.width === 'undefined' || param.bounds.width === 0) {
28138
+ width = param.page.getClientSize().width - param.bounds.x;
28139
+ hasChanged = true;
28140
+ }
28141
+ if (typeof param.bounds.height === 'undefined' || param.bounds.height === 0) {
28142
+ height = param.page.getClientSize().height - param.bounds.y;
28143
+ hasChanged = true;
28144
+ }
28145
+ if (hasChanged) {
28146
+ param.bounds = new RectangleF(param.bounds.x, param.bounds.y, width, height);
28147
+ }
28131
28148
  if (this.rows.count !== 0) {
28132
28149
  let currentRow = this.rows.getRow(0).cells.getCell(0).style;
28133
28150
  if (currentRow.borders != null && ((currentRow.borders.left != null && currentRow.borders.left.width !== 1) ||
@@ -28682,7 +28699,10 @@ class PdfGridLayouter extends ElementLayouter {
28682
28699
  let index = 0;
28683
28700
  index = this.currentGraphics.page.section.indexOf(this.currentGraphics.page);
28684
28701
  this.listOfNavigatePages.push(index);
28685
- if (format != null && format.break === PdfLayoutBreakType.FitColumnsToPage) {
28702
+ if (typeof param.bounds !== 'undefined' && param.bounds !== null && (!(param.bounds.x === 0 && param.bounds.y === 0 && param.bounds.width === 0 && param.bounds.height === 0))) {
28703
+ this.currentBounds = new RectangleF(new PointF(param.bounds.x, param.bounds.y), new SizeF(param.bounds.width, param.bounds.height));
28704
+ }
28705
+ else if (format != null && format.break === PdfLayoutBreakType.FitColumnsToPage) {
28686
28706
  this.currentBounds = new RectangleF(new PointF(param.bounds.x, param.bounds.y), new SizeF(this.Grid.columns.width, this.currentGraphics.clientSize.height));
28687
28707
  }
28688
28708
  else {
@@ -28722,7 +28742,12 @@ class PdfGridLayouter extends ElementLayouter {
28722
28742
  }
28723
28743
  if (!this.Grid.style.allowHorizontalOverflow) {
28724
28744
  this.columnRanges = [];
28725
- this.Grid.measureColumnsWidth(this.currentBounds);
28745
+ if (typeof this.Grid.isChildGrid !== 'undefined' && typeof this.Grid.isChildGrid) {
28746
+ this.Grid.measureColumnsWidth(this.currentBounds);
28747
+ }
28748
+ else {
28749
+ this.Grid.measureColumnsWidth(new RectangleF(this.currentBounds.x, this.currentBounds.y, this.currentBounds.x + this.currentBounds.width, this.currentBounds.height));
28750
+ }
28726
28751
  this.columnRanges.push([0, this.Grid.columns.count - 1]);
28727
28752
  }
28728
28753
  else {
@@ -29108,7 +29133,7 @@ class PdfGridLayouter extends ElementLayouter {
29108
29133
  }
29109
29134
  row.grid.splitChildRowIndex = -1;
29110
29135
  row.grid.isGridSplit = false;
29111
- rowResult.isFinish = true;
29136
+ rowResult.isFinish = this.checkIsFisished(row);
29112
29137
  //row.NestedGridLayoutResult.bounds.height = row.rowBreakHeightValue;
29113
29138
  //this.currentBounds.y = rowResult.bounds.y;
29114
29139
  for (let i = 0; i < row.cells.count; i++) {
@@ -29167,9 +29192,10 @@ class PdfGridLayouter extends ElementLayouter {
29167
29192
  {
29168
29193
  this.currentBounds.y = format == null ? 0 : format.paginateBounds.y;
29169
29194
 
29170
- }
29171
- if (this.raiseBeforePageLayout(this.currentPage, this.currentBounds, this.currentRowIndex))
29172
- break;*/
29195
+ }*/
29196
+ if (this.raiseBeforePageLayout(this.currentPage, this.currentBounds, this.currentRowIndex).returnValue) {
29197
+ break;
29198
+ }
29173
29199
  if ((param.format !== null) && !param.format.usePaginateBounds && param.bounds !== null &&
29174
29200
  param.bounds.height > 0 && !this.Grid.isChildGrid) {
29175
29201
  this.currentBounds.height = param.bounds.height;
@@ -29179,6 +29205,11 @@ class PdfGridLayouter extends ElementLayouter {
29179
29205
  }
29180
29206
  else {
29181
29207
  this.currentBounds.y = format == null ? 0 : format.paginateBounds.y;
29208
+ if (format != null && (format.paginateBounds.x !== 0 || format.paginateBounds.y !== 0 || format.paginateBounds.height !== 0 || format.paginateBounds.width !== 0)) {
29209
+ this.currentBounds.x = format.paginateBounds.x;
29210
+ this.currentBounds.width = format.paginateBounds.width;
29211
+ this.currentBounds.height = format.paginateBounds.height;
29212
+ }
29182
29213
  }
29183
29214
  if (typeof param.format !== 'undefined' && (param.format !== null) && typeof param.format.usePaginateBounds !== 'undefined' && !param.format.usePaginateBounds && param.bounds !== null &&
29184
29215
  param.bounds.y > 0 && !this.Grid.isChildGrid) {
@@ -29327,6 +29358,15 @@ class PdfGridLayouter extends ElementLayouter {
29327
29358
  this.raisePageLayouted(result);
29328
29359
  return result;
29329
29360
  }
29361
+ checkIsFisished(row) {
29362
+ let result = true;
29363
+ for (let i = 0; i < row.cells.count; i++) {
29364
+ if (!row.cells.getCell(i).FinishedDrawingCell) {
29365
+ result = false;
29366
+ }
29367
+ }
29368
+ return result;
29369
+ }
29330
29370
  /* tslint:enable */
29331
29371
  /**
29332
29372
  * Gets the `next page`.
@@ -29408,7 +29448,7 @@ class PdfGridLayouter extends ElementLayouter {
29408
29448
  for (let i = 0; i < layoutedPages.size(); i++) {
29409
29449
  for (let j = i, count = (layoutedPages.size() / this.columnRanges.length); j < layoutedPages.size(); j += count) {
29410
29450
  let page = pages[j];
29411
- if (document.pages.indexOf(page) === -1) {
29451
+ if (typeof page !== 'undefined' && document.pages.indexOf(page) === -1) {
29412
29452
  document.pages.add(page);
29413
29453
  }
29414
29454
  }
@@ -29470,7 +29510,7 @@ class PdfGridLayouter extends ElementLayouter {
29470
29510
  // new SizeF(args.Bounds.width + args.Bounds.x ,
29471
29511
  // args.Bounds.height)));
29472
29512
  // }
29473
- cancel = args.cancel;
29513
+ cancel = (typeof args.cancel === 'undefined' ? false : args.cancel);
29474
29514
  currentBounds = args.bounds;
29475
29515
  currentRow = args.startRowIndex;
29476
29516
  }
@@ -29527,7 +29567,7 @@ class PdfGridLayouter extends ElementLayouter {
29527
29567
  // }
29528
29568
  }
29529
29569
  let calculatedHeight = row.rowBreakHeight > 0.0 ? row.rowBreakHeight : row.height;
29530
- if (this.Grid.isChildGrid && this.Grid.ParentCell != null) {
29570
+ if (typeof this.Grid.isChildGrid !== 'undefined' && this.Grid.isChildGrid && typeof this.Grid.ParentCell !== 'undefined' && this.Grid.ParentCell != null) {
29531
29571
  //Split row only if row height exceeds page height and AllowRowBreakAcrossPages is true.
29532
29572
  // if (calculatedHeight + this.Grid.ParentCell.row.grid.style.cellPadding.bottom +
29533
29573
  // this.Grid.ParentCell.row.grid.style.cellPadding.top > this.currentPageBounds.height) {
@@ -29557,7 +29597,7 @@ class PdfGridLayouter extends ElementLayouter {
29557
29597
  + calculatedHeight > this.currentBounds.height || this.currentBounds.y +
29558
29598
  this.Grid.ParentCell.row.grid.style.cellPadding.bottom + rowHeightWithSpan > this.currentPageBounds.height) {
29559
29599
  //If a row is repeated and still cannot fit in page, proceed draw.
29560
- if (this.Grid.ParentCell.row.grid.LayoutFormat.break === PdfLayoutBreakType.FitPage) {
29600
+ if (typeof this.Grid.ParentCell.row.grid.LayoutFormat !== 'undefined' && this.Grid.ParentCell.row.grid.LayoutFormat.break === PdfLayoutBreakType.FitPage) {
29561
29601
  PdfGridLayouter.repeatRowIndex = this.Grid.rows.rowCollection.indexOf(row);
29562
29602
  this.Grid.splitChildRowIndex = this.Grid.rows.rowCollection.indexOf(row);
29563
29603
  }
@@ -29627,7 +29667,7 @@ class PdfGridLayouter extends ElementLayouter {
29627
29667
  // If a row is repeated and still cannot fit in page, proceed draw.
29628
29668
  let isFit = false;
29629
29669
  if ((this.Grid.allowRowBreakAcrossPages && !this.Grid.repeatHeader && !row.isRowHeightSet && !row.rowMergeComplete)) {
29630
- 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) {
29670
+ if (this.Grid.LayoutFormat !== null && this.Grid.LayoutFormat.paginateBounds.height > 0) {
29631
29671
  isFit = this.isFitToCell((this.currentBounds.height + this.startLocation.y) - this.currentBounds.y, this.Grid, row);
29632
29672
  }
29633
29673
  else
@@ -29785,7 +29825,18 @@ class PdfGridLayouter extends ElementLayouter {
29785
29825
  isFit = false;
29786
29826
  break;
29787
29827
  }
29788
- else if (currentHeight > height || (typeof this.slr.remainder !== 'undefined' && this.slr.remainder !== null)) {
29828
+ 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)
29829
+ height += (gridRow.cells.getCell(i).style.borders.top.width + gridRow.cells.getCell(i).style.borders.bottom.width) * 2;
29830
+ if (this.slr.lineCount > 1 && gridRow.cells.getCell(i).stringFormat != null && gridRow.cells.getCell(i).stringFormat.lineSpacing != 0)
29831
+ height += (this.slr.lineCount - 1) * (gridRow.cells.getCell(i).style.stringFormat.lineSpacing);
29832
+ if (gridRow.cells.getCell(i).style.cellPadding == null) {
29833
+ height += (grid.style.cellPadding.top + grid.style.cellPadding.bottom);
29834
+ }
29835
+ else {
29836
+ height += (grid.style.cellPadding.top + grid.style.cellPadding.bottom);
29837
+ }
29838
+ height += grid.style.cellSpacing;
29839
+ if (currentHeight > height || (typeof this.slr.remainder !== 'undefined' && this.slr.remainder !== null)) {
29789
29840
  isFit = true;
29790
29841
  break;
29791
29842
  }
@@ -29849,9 +29900,7 @@ class PdfGridLayouter extends ElementLayouter {
29849
29900
  if (stringResult != null && typeof stringResult.remainder !== 'undefined') {
29850
29901
  row.cells.getCell(i).FinishedDrawingCell = false;
29851
29902
  row.cells.getCell(i).remainingString = stringResult.remainder == null ? ' ' : stringResult.remainder;
29852
- if (row.grid.isChildGrid) {
29853
- row.rowBreakHeight = calculateHeight - stringResult.actualSize.height;
29854
- }
29903
+ row.rowBreakHeight = calculateHeight - stringResult.actualSize.height;
29855
29904
  }
29856
29905
  }
29857
29906
  result.isFinish = (!result.isFinish) ? result.isFinish : row.cells.getCell(i).FinishedDrawingCell;