@syncfusion/ej2-pdf-export 27.1.50 → 27.2.2

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.
@@ -6545,10 +6545,6 @@ var PdfFont = /** @__PURE__ @class */ (function () {
6545
6545
  * @private
6546
6546
  */
6547
6547
  var PdfWriter = /** @__PURE__ @class */ (function () {
6548
- /**
6549
- * Initialize an instance of `PdfWriter` class.
6550
- * @private
6551
- */
6552
6548
  function PdfWriter(stream) {
6553
6549
  this.streamWriter = stream;
6554
6550
  }
@@ -6595,8 +6591,7 @@ var PdfWriter = /** @__PURE__ @class */ (function () {
6595
6591
  * @private
6596
6592
  */
6597
6593
  get: function () {
6598
- var result = this.streamWriter;
6599
- return result;
6594
+ return this.streamWriter;
6600
6595
  },
6601
6596
  enumerable: true,
6602
6597
  configurable: true
@@ -6612,6 +6607,81 @@ var PdfWriter = /** @__PURE__ @class */ (function () {
6612
6607
  };
6613
6608
  return PdfWriter;
6614
6609
  }());
6610
+ /**
6611
+ * Helper class for PDF writer.
6612
+ * @private
6613
+ */
6614
+ var PdfWriterHelper = /** @__PURE__ @class */ (function () {
6615
+ /**
6616
+ * Initialize an instance of `PdfWriterHelper` class.
6617
+ * @private
6618
+ */
6619
+ function PdfWriterHelper() {
6620
+ this.buffer = new PdfArrayBuffer();
6621
+ }
6622
+ /**
6623
+ * Writes the specified data.
6624
+ * @private
6625
+ */
6626
+ PdfWriterHelper.prototype.write = function (data) {
6627
+ this.buffer.write(data);
6628
+ };
6629
+ /**
6630
+ * Destroy the array buffer.
6631
+ * @private
6632
+ */
6633
+ PdfWriterHelper.prototype.destroy = function () {
6634
+ if (this.buffer) {
6635
+ this.buffer.destroy();
6636
+ this.buffer = undefined;
6637
+ }
6638
+ };
6639
+ return PdfWriterHelper;
6640
+ }());
6641
+ /**
6642
+ * Helper class for PDF writer.
6643
+ * @private
6644
+ */
6645
+ var PdfArrayBuffer = /** @__PURE__ @class */ (function () {
6646
+ /**
6647
+ * Initialize an instance of `PdfArrayBuffer` class.
6648
+ * @private
6649
+ */
6650
+ function PdfArrayBuffer() {
6651
+ this.buffer = [];
6652
+ }
6653
+ Object.defineProperty(PdfArrayBuffer.prototype, "size", {
6654
+ /**
6655
+ * Gets the `size`.
6656
+ * @private
6657
+ */
6658
+ get: function () {
6659
+ return this.buffer.length;
6660
+ },
6661
+ enumerable: true,
6662
+ configurable: true
6663
+ });
6664
+ /**
6665
+ * Writes the specified data.
6666
+ * @private
6667
+ */
6668
+ PdfArrayBuffer.prototype.write = function (value) {
6669
+ for (var i = 0; i < value.length; i++) {
6670
+ this.buffer.push(value.charCodeAt(i) & 0xff);
6671
+ }
6672
+ };
6673
+ /**
6674
+ * Destroy the array buffer.
6675
+ * @private
6676
+ */
6677
+ PdfArrayBuffer.prototype.destroy = function () {
6678
+ if (this.buffer) {
6679
+ this.buffer = [];
6680
+ this.buffer = undefined;
6681
+ }
6682
+ };
6683
+ return PdfArrayBuffer;
6684
+ }());
6615
6685
 
6616
6686
  /**
6617
6687
  * public Enum for `CompositeFontType`.
@@ -6938,6 +7008,13 @@ var PdfDocumentBase = /** @__PURE__ @class */ (function () {
6938
7008
  PdfDocumentBase.prototype.clone = function () {
6939
7009
  return this.document;
6940
7010
  };
7011
+ /**
7012
+ * Save PDF document.
7013
+ * @private
7014
+ */
7015
+ PdfDocumentBase.prototype._save = function () {
7016
+ return this.document._docSave();
7017
+ };
6941
7018
  return PdfDocumentBase;
6942
7019
  }());
6943
7020
 
@@ -7902,6 +7979,19 @@ var PdfCrossTable = /** @__PURE__ @class */ (function () {
7902
7979
  configurable: true
7903
7980
  });
7904
7981
  PdfCrossTable.prototype.save = function (writer, filename) {
7982
+ this._saveProcess(writer);
7983
+ if (typeof filename === 'undefined') {
7984
+ return writer.stream.buffer;
7985
+ }
7986
+ else {
7987
+ writer.stream.save(filename);
7988
+ }
7989
+ };
7990
+ /**
7991
+ * Saves the cross-reference table into the stream.
7992
+ * @private
7993
+ */
7994
+ PdfCrossTable.prototype._saveProcess = function (writer) {
7905
7995
  this.saveHead(writer);
7906
7996
  this.mappedReferences = null;
7907
7997
  this.objects.clear();
@@ -7921,12 +8011,14 @@ var PdfCrossTable = /** @__PURE__ @class */ (function () {
7921
8011
  var oi = this.objectCollection.items(i);
7922
8012
  oi.object.isSaving = false;
7923
8013
  }
7924
- if (typeof filename === 'undefined') {
7925
- return writer.stream.buffer;
7926
- }
7927
- else {
7928
- writer.stream.save(filename);
7929
- }
8014
+ };
8015
+ /**
8016
+ * Saves the cross-reference table into the stream.
8017
+ * @private
8018
+ */
8019
+ PdfCrossTable.prototype._save = function (writer) {
8020
+ this._saveProcess(writer);
8021
+ return new Uint8Array(writer.stream.buffer.buffer);
7930
8022
  };
7931
8023
  /**
7932
8024
  * `Saves the endess` of the file.
@@ -8152,7 +8244,6 @@ var PdfCrossTable = /** @__PURE__ @class */ (function () {
8152
8244
  * @private
8153
8245
  */
8154
8246
  PdfCrossTable.prototype.doSaveObject = function (obj, reference, writer) {
8155
- var correctPosition = writer.length;
8156
8247
  writer.write(reference.objNumber.toString());
8157
8248
  writer.write(Operators.whiteSpace);
8158
8249
  writer.write(reference.genNumber.toString());
@@ -8160,7 +8251,6 @@ var PdfCrossTable = /** @__PURE__ @class */ (function () {
8160
8251
  writer.write(Operators.obj);
8161
8252
  writer.write(Operators.newLine);
8162
8253
  obj.save(writer);
8163
- var stream = writer.stream;
8164
8254
  writer.write(Operators.endObj);
8165
8255
  writer.write(Operators.newLine);
8166
8256
  };
@@ -21416,6 +21506,21 @@ var PdfDocument = /** @__PURE__ @class */ (function (_super) {
21416
21506
  this.crossTable.save(writer, arg2);
21417
21507
  }
21418
21508
  };
21509
+ /**
21510
+ * Saves the document to the specified output stream and return the stream as byte array.
21511
+ * @private
21512
+ */
21513
+ PdfDocument.prototype._docSave = function () {
21514
+ var stream = new PdfWriterHelper();
21515
+ this.checkPagesPresence();
21516
+ if (stream === null) {
21517
+ throw new Error('ArgumentNullException : stream');
21518
+ }
21519
+ this.streamWriter = stream;
21520
+ var writer = new PdfWriter(stream);
21521
+ writer.document = this;
21522
+ return this.crossTable._save(writer);
21523
+ };
21419
21524
  /**
21420
21525
  * Checks the pages `presence`.
21421
21526
  * @private
@@ -21457,7 +21562,9 @@ var PdfDocument = /** @__PURE__ @class */ (function (_super) {
21457
21562
  PdfDocument.cache.destroy();
21458
21563
  this.crossTable.pdfObjects.destroy();
21459
21564
  PdfDocument.cache = undefined;
21460
- this.streamWriter.destroy();
21565
+ if (this.streamWriter) {
21566
+ this.streamWriter.destroy();
21567
+ }
21461
21568
  };
21462
21569
  /**
21463
21570
  * `Font` used in complex objects to draw strings and text when it is not defined explicitly.
@@ -30308,19 +30415,31 @@ var PdfGridCell = /** @__PURE__ @class */ (function () {
30308
30415
  var returnBounds = new RectangleF(bounds.x, bounds.y, bounds.width, bounds.height);
30309
30416
  if (!(this.objectValue instanceof PdfGrid)) {
30310
30417
  if (typeof this.style.cellPadding === 'undefined' || this.style.cellPadding == null) {
30311
- returnBounds.x += this.gridRow.grid.style.cellPadding.left + this.cellStyle.borders.left.width;
30312
- returnBounds.y += this.gridRow.grid.style.cellPadding.top + this.cellStyle.borders.top.width;
30418
+ returnBounds.x += this.gridRow.grid.style.cellPadding.left;
30419
+ returnBounds.y += this.gridRow.grid.style.cellPadding.top;
30313
30420
  returnBounds.width -= (this.gridRow.grid.style.cellPadding.right + this.gridRow.grid.style.cellPadding.left);
30314
30421
  returnBounds.height -= (this.gridRow.grid.style.cellPadding.bottom + this.gridRow.grid.style.cellPadding.top);
30315
- returnBounds.height -= (this.cellStyle.borders.top.width + this.cellStyle.borders.bottom.width);
30316
30422
  }
30317
30423
  else {
30318
- returnBounds.x += this.style.cellPadding.left + this.cellStyle.borders.left.width;
30319
- returnBounds.y += this.style.cellPadding.top + this.cellStyle.borders.top.width;
30424
+ returnBounds.x += this.style.cellPadding.left;
30425
+ returnBounds.y += this.style.cellPadding.top;
30320
30426
  returnBounds.width -= (this.style.cellPadding.right + this.style.cellPadding.left);
30321
- returnBounds.width -= (this.cellStyle.borders.left.width + this.cellStyle.borders.right.width);
30322
30427
  returnBounds.height -= (this.style.cellPadding.bottom + this.style.cellPadding.top);
30323
- returnBounds.height -= (this.cellStyle.borders.top.width + this.cellStyle.borders.bottom.width);
30428
+ if (this.rowSpan === 1) {
30429
+ returnBounds.width -= (this.style.borders.left.width);
30430
+ }
30431
+ }
30432
+ if (typeof this.style.borders === 'undefined' || this.style.borders == null) {
30433
+ returnBounds.x += this.gridRow.style.border.left.width;
30434
+ returnBounds.y += this.gridRow.style.border.top.width;
30435
+ returnBounds.width -= (this.gridRow.style.border.left.width + this.gridRow.style.border.right.width);
30436
+ returnBounds.height -= (this.gridRow.style.border.top.width + this.gridRow.style.border.bottom.width);
30437
+ }
30438
+ else {
30439
+ returnBounds.x += this.style.borders.left.width;
30440
+ returnBounds.y += this.style.borders.top.width;
30441
+ returnBounds.width -= (this.style.borders.left.width + this.style.borders.right.width);
30442
+ returnBounds.height -= (this.style.borders.top.width + this.style.borders.bottom.width);
30324
30443
  if (this.rowSpan === 1) {
30325
30444
  returnBounds.width -= (this.style.borders.left.width);
30326
30445
  }
@@ -36336,5 +36455,5 @@ var PdfPageTemplateElement = /** @__PURE__ @class */ (function () {
36336
36455
  return PdfPageTemplateElement;
36337
36456
  }());
36338
36457
 
36339
- export { ArabicShape, ArabicShapeRenderer, BeginPageLayoutEventArgs, Bidi, ByteArray, Dictionary, DictionaryProperties, DuplexMode, ElementLayouter, EndPageLayoutEventArgs, FontDescriptorFlags, FontEncoding, GetResourceEventHandler, GridCellEventArgs, Guid, ImageDecoder, ImageFormat, InternalEnum, LineInfo, LineType, Matrix, ObjectInfo, ObjectStatus, ObjectType, Operators, PageAddedEventArgs, PageScalingMode, PageSettingsState, PathPointType, PdfAction, PdfActionLinkAnnotation, PdfAlignmentStyle, PdfAnnotation, PdfAnnotationCollection, PdfArc, PdfArray, PdfBitmap, PdfBlend, PdfBlendMode, PdfBorderOverlapStyle, PdfBorders, PdfBrush, PdfBrushes, PdfCacheCollection, PdfCancelEventArgs, PdfCatalog, PdfCollection, PdfColor, PdfColorBlend, PdfColorSpace, PdfCompositeField, PdfCrossTable, PdfDashStyle, PdfDestination, PdfDestinationMode, PdfDictionary, PdfDockStyle, PdfDocument, PdfDocumentBase, PdfDocumentLinkAnnotation, PdfDocumentPageCollection, PdfDocumentTemplate, PdfFillMode, PdfFont, PdfFontFamily, PdfFontMetrics, PdfFontStyle, PdfFontType, PdfFunction, PdfGradientBrush, PdfGraphics, PdfGraphicsState, PdfGraphicsUnit, PdfGrid, PdfGridBeginCellDrawEventArgs, PdfGridBeginPageLayoutEventArgs, PdfGridCell, PdfGridCellCollection, PdfGridCellStyle, PdfGridColumn, PdfGridColumnCollection, PdfGridEndCellDrawEventArgs, PdfGridEndPageLayoutEventArgs, PdfGridHeaderCollection, PdfGridImagePosition, PdfGridLayoutFormat, PdfGridLayoutResult, PdfGridLayouter, PdfGridRow, PdfGridRowCollection, PdfGridRowStyle, PdfGridStyle, PdfGridStyleBase, PdfHorizontalAlignment, PdfHorizontalOverflowType, PdfImage, PdfLayoutBreakType, PdfLayoutElement, PdfLayoutFormat, PdfLayoutParams, PdfLayoutResult, PdfLayoutType, PdfLineCap, PdfLineJoin, PdfLinearGradientBrush, PdfLinkAnnotation, PdfMainObjectCollection, PdfMargins, PdfName, PdfNumber, PdfNumberStyle, PdfPaddings, PdfPage, PdfPageBase, PdfPageCountField, PdfPageLayer, PdfPageLayerCollection, PdfPageLayout, PdfPageMode, PdfPageNumberField, PdfPageOrientation, PdfPageRotateAngle, PdfPageSettings, PdfPageSize, PdfPageTemplateElement, PdfPath, PdfPen, PdfRadialGradientBrush, PdfReference, PdfReferenceHolder, PdfResources, PdfSampledFunction, PdfSection, PdfSectionCollection, PdfSectionPageCollection, PdfSectionTemplate, PdfSolidBrush, PdfStandardFont, PdfStandardFontMetricsFactory, PdfStream, PdfStreamWriter, PdfString, PdfStringFormat, PdfStringLayoutResult, PdfStringLayouter, PdfSubSuperScript, PdfTemplate, PdfTextAlignment, PdfTextDirection, PdfTextElement, PdfTextLayoutResult, PdfTextWebLink, PdfTilingBrush, PdfTransformationMatrix, PdfTransparency, PdfTrueTypeFont, PdfUriAction, PdfUriAnnotation, PdfVerticalAlignment, PdfViewerPreferences, PdfWordWrapType, PdfWriter, PointF, ProcedureSets, Rectangle, RectangleF, RegisteredObject, RowLayoutResult, RtlCharacters, RtlRenderer, SaveAnnotationEventHandler, SaveCmapEventHandler, SaveDescendantFontEventHandler, SaveFontDictionaryEventHandler, SaveFontProgramEventHandler, SaveSectionCollectionEventHandler, SaveSectionEventHandler, SaveTemplateEventHandler, SizeF, StandardWidthTable, StringTokenizer, TemplateType, TextLayouter, TextPageLayoutResult, TextRenderingMode, TtfCmapEncoding, TtfCmapFormat, TtfCompositeGlyphFlags, TtfMacintoshEncodingID, TtfMicrosoftEncodingID, TtfPlatformID, WidthTable, defaultToString };
36458
+ export { ArabicShape, ArabicShapeRenderer, BeginPageLayoutEventArgs, Bidi, ByteArray, Dictionary, DictionaryProperties, DuplexMode, ElementLayouter, EndPageLayoutEventArgs, FontDescriptorFlags, FontEncoding, GetResourceEventHandler, GridCellEventArgs, Guid, ImageDecoder, ImageFormat, InternalEnum, LineInfo, LineType, Matrix, ObjectInfo, ObjectStatus, ObjectType, Operators, PageAddedEventArgs, PageScalingMode, PageSettingsState, PathPointType, PdfAction, PdfActionLinkAnnotation, PdfAlignmentStyle, PdfAnnotation, PdfAnnotationCollection, PdfArc, PdfArray, PdfArrayBuffer, PdfBitmap, PdfBlend, PdfBlendMode, PdfBorderOverlapStyle, PdfBorders, PdfBrush, PdfBrushes, PdfCacheCollection, PdfCancelEventArgs, PdfCatalog, PdfCollection, PdfColor, PdfColorBlend, PdfColorSpace, PdfCompositeField, PdfCrossTable, PdfDashStyle, PdfDestination, PdfDestinationMode, PdfDictionary, PdfDockStyle, PdfDocument, PdfDocumentBase, PdfDocumentLinkAnnotation, PdfDocumentPageCollection, PdfDocumentTemplate, PdfFillMode, PdfFont, PdfFontFamily, PdfFontMetrics, PdfFontStyle, PdfFontType, PdfFunction, PdfGradientBrush, PdfGraphics, PdfGraphicsState, PdfGraphicsUnit, PdfGrid, PdfGridBeginCellDrawEventArgs, PdfGridBeginPageLayoutEventArgs, PdfGridCell, PdfGridCellCollection, PdfGridCellStyle, PdfGridColumn, PdfGridColumnCollection, PdfGridEndCellDrawEventArgs, PdfGridEndPageLayoutEventArgs, PdfGridHeaderCollection, PdfGridImagePosition, PdfGridLayoutFormat, PdfGridLayoutResult, PdfGridLayouter, PdfGridRow, PdfGridRowCollection, PdfGridRowStyle, PdfGridStyle, PdfGridStyleBase, PdfHorizontalAlignment, PdfHorizontalOverflowType, PdfImage, PdfLayoutBreakType, PdfLayoutElement, PdfLayoutFormat, PdfLayoutParams, PdfLayoutResult, PdfLayoutType, PdfLineCap, PdfLineJoin, PdfLinearGradientBrush, PdfLinkAnnotation, PdfMainObjectCollection, PdfMargins, PdfName, PdfNumber, PdfNumberStyle, PdfPaddings, PdfPage, PdfPageBase, PdfPageCountField, PdfPageLayer, PdfPageLayerCollection, PdfPageLayout, PdfPageMode, PdfPageNumberField, PdfPageOrientation, PdfPageRotateAngle, PdfPageSettings, PdfPageSize, PdfPageTemplateElement, PdfPath, PdfPen, PdfRadialGradientBrush, PdfReference, PdfReferenceHolder, PdfResources, PdfSampledFunction, PdfSection, PdfSectionCollection, PdfSectionPageCollection, PdfSectionTemplate, PdfSolidBrush, PdfStandardFont, PdfStandardFontMetricsFactory, PdfStream, PdfStreamWriter, PdfString, PdfStringFormat, PdfStringLayoutResult, PdfStringLayouter, PdfSubSuperScript, PdfTemplate, PdfTextAlignment, PdfTextDirection, PdfTextElement, PdfTextLayoutResult, PdfTextWebLink, PdfTilingBrush, PdfTransformationMatrix, PdfTransparency, PdfTrueTypeFont, PdfUriAction, PdfUriAnnotation, PdfVerticalAlignment, PdfViewerPreferences, PdfWordWrapType, PdfWriter, PdfWriterHelper, PointF, ProcedureSets, Rectangle, RectangleF, RegisteredObject, RowLayoutResult, RtlCharacters, RtlRenderer, SaveAnnotationEventHandler, SaveCmapEventHandler, SaveDescendantFontEventHandler, SaveFontDictionaryEventHandler, SaveFontProgramEventHandler, SaveSectionCollectionEventHandler, SaveSectionEventHandler, SaveTemplateEventHandler, SizeF, StandardWidthTable, StringTokenizer, TemplateType, TextLayouter, TextPageLayoutResult, TextRenderingMode, TtfCmapEncoding, TtfCmapFormat, TtfCompositeGlyphFlags, TtfMacintoshEncodingID, TtfMicrosoftEncodingID, TtfPlatformID, WidthTable, defaultToString };
36340
36459
  //# sourceMappingURL=ej2-pdf-export.es5.js.map