@syncfusion/ej2-pdf 23.1.39 → 23.1.44

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.
@@ -14164,6 +14164,7 @@ var PdfAnnotation = /** @__PURE__ @class */ (function () {
14164
14164
  this._isImported = false;
14165
14165
  this._isLoaded = false;
14166
14166
  this._setAppearance = false;
14167
+ this._isExport = false;
14167
14168
  this._opacity = 1;
14168
14169
  this._isAllRotation = true;
14169
14170
  this._flatten = false;
@@ -23763,11 +23764,11 @@ var PdfRubberStampAnnotation = /** @__PURE__ @class */ (function (_super) {
23763
23764
  PdfRubberStampAnnotation.prototype._doPostProcess = function (isFlatten) {
23764
23765
  if (isFlatten === void 0) { isFlatten = false; }
23765
23766
  var isTransformBBox = false;
23766
- if (this._isLoaded && (this._setAppearance || isFlatten)) {
23767
- if (!isFlatten) {
23767
+ if (this._isLoaded && (this._setAppearance || isFlatten || this._isExport)) {
23768
+ if ((!isFlatten && !this._isExport) || this._setAppearance) {
23768
23769
  this._appearanceTemplate = this._createRubberStampAppearance();
23769
23770
  }
23770
- if (!this._appearanceTemplate && isFlatten && this._dictionary.has('AP')) {
23771
+ if (!this._appearanceTemplate && (this._isExport || isFlatten) && this._dictionary.has('AP')) {
23771
23772
  var dictionary = this._dictionary.get('AP');
23772
23773
  if (dictionary && dictionary.has('N')) {
23773
23774
  var appearanceStream = dictionary.get('N');
@@ -23824,8 +23825,10 @@ var PdfRubberStampAnnotation = /** @__PURE__ @class */ (function (_super) {
23824
23825
  }
23825
23826
  }
23826
23827
  else {
23827
- this._postProcess();
23828
- if ((!this._appearanceTemplate) && isFlatten) {
23828
+ if (!(this._isImported && this._dictionary.has('AP'))) {
23829
+ this._postProcess();
23830
+ }
23831
+ if ((!this._appearanceTemplate) && (isFlatten || this._isImported)) {
23829
23832
  if (!this._dictionary.has('AP')) {
23830
23833
  this._appearanceTemplate = this._createRubberStampAppearance();
23831
23834
  }
@@ -28302,6 +28305,7 @@ var PdfAnnotationCollection = /** @__PURE__ @class */ (function () {
28302
28305
  * @param {PdfPage} page PDF page object.
28303
28306
  */
28304
28307
  function PdfAnnotationCollection(array, xref, page) {
28308
+ this._isExport = false;
28305
28309
  this._annotations = array;
28306
28310
  this._page = page;
28307
28311
  this._crossReference = xref;
@@ -28695,6 +28699,7 @@ var PdfAnnotationCollection = /** @__PURE__ @class */ (function () {
28695
28699
  for (var i = this.count - 1; i >= 0; i--) {
28696
28700
  var annotation = this.at(i);
28697
28701
  if (annotation) {
28702
+ annotation._isExport = this._isExport;
28698
28703
  annotation._doPostProcess(annotation.flatten || isFlatten);
28699
28704
  }
28700
28705
  }
@@ -44045,7 +44050,7 @@ var _XfdfDocument = /** @__PURE__ @class */ (function (_super) {
44045
44050
  }
44046
44051
  };
44047
44052
  _XfdfDocument.prototype._writeObject = function (writer, primitive, dictionary, key) {
44048
- if (primitive) {
44053
+ if (primitive !== null && typeof primitive !== 'undefined') {
44049
44054
  if (primitive instanceof _PdfName) {
44050
44055
  this._writePrefix(writer, 'NAME', key);
44051
44056
  writer._writeAttributeString('VAL', primitive.name);
@@ -44272,6 +44277,7 @@ var _XfdfDocument = /** @__PURE__ @class */ (function (_super) {
44272
44277
  case 'Vertices':
44273
44278
  case 'GroupNesting':
44274
44279
  case 'ITEx':
44280
+ case 'TextMarkupContent':
44275
44281
  break;
44276
44282
  default:
44277
44283
  this._writeAttributeString(writer, key.toLowerCase(), primitive);
@@ -44589,6 +44595,7 @@ var _XfdfDocument = /** @__PURE__ @class */ (function (_super) {
44589
44595
  var annotations = page.annotations;
44590
44596
  var annotation = annotations._parseAnnotation(annotationDictionary);
44591
44597
  if (annotation) {
44598
+ annotation._isImported = true;
44592
44599
  var reference = this._crossReference._getNextReference();
44593
44600
  this._crossReference._cacheMap.set(reference, annotationDictionary);
44594
44601
  if (annotationDictionary.has('NM') || annotationDictionary.has('IRT')) {
@@ -45109,26 +45116,23 @@ var _XfdfDocument = /** @__PURE__ @class */ (function (_super) {
45109
45116
  _XfdfDocument.prototype._addAppearanceData = function (element, dictionary) {
45110
45117
  var innerText = element.textContent;
45111
45118
  if (innerText && innerText !== '') {
45112
- var appearanceArray = _decode(innerText);
45113
- if (appearanceArray && appearanceArray.length > 0) {
45114
- var document_1 = (new DOMParser()).parseFromString(_bytesToString(appearanceArray), 'text/xml');
45115
- if (document_1 && document_1.hasChildNodes) {
45116
- var childNodes = document_1.childNodes;
45117
- if (childNodes && childNodes.length === 1) {
45118
- var rootNode = childNodes[0];
45119
- if (rootNode && rootNode.nodeType === 1) {
45120
- var rootElement = rootNode;
45121
- if (rootElement.nodeName.toLowerCase() === 'DICT' && rootElement.hasAttribute('KEY')) {
45122
- var key = rootElement.getAttribute('KEY');
45123
- if (key && key === 'AP' && rootElement.hasChildNodes) {
45124
- var appearance = new _PdfDictionary(this._crossReference);
45125
- childNodes = rootElement.childNodes;
45126
- for (var i = 0; i < childNodes.length; i++) {
45127
- this._getAppearance(appearance, childNodes[Number.parseInt(i.toString(), 10)]);
45128
- }
45129
- if (appearance.size > 0) {
45130
- dictionary.update('AP', appearance);
45131
- }
45119
+ var document_1 = (new DOMParser()).parseFromString(atob(innerText), 'text/xml');
45120
+ if (document_1 && document_1.hasChildNodes) {
45121
+ var childNodes = document_1.childNodes;
45122
+ if (childNodes && childNodes.length === 1) {
45123
+ var rootNode = childNodes[0];
45124
+ if (rootNode && rootNode.nodeType === 1) {
45125
+ var rootElement = rootNode;
45126
+ if (rootElement.nodeName.toUpperCase() === 'DICT' && rootElement.hasAttribute('KEY')) {
45127
+ var key = rootElement.getAttribute('KEY');
45128
+ if (key && key === 'AP' && rootElement.hasChildNodes) {
45129
+ var appearance = new _PdfDictionary(this._crossReference);
45130
+ childNodes = rootElement.childNodes;
45131
+ for (var i = 0; i < childNodes.length; i++) {
45132
+ this._getAppearance(appearance, childNodes[Number.parseInt(i.toString(), 10)]);
45133
+ }
45134
+ if (appearance.size > 0) {
45135
+ dictionary.update('AP', appearance);
45132
45136
  }
45133
45137
  }
45134
45138
  }
@@ -45158,7 +45162,7 @@ var _XfdfDocument = /** @__PURE__ @class */ (function (_super) {
45158
45162
  dictionary = this._getDictionary(element);
45159
45163
  if (dictionary) {
45160
45164
  var reference = this._crossReference._getNextReference();
45161
- this._crossReference._cacheMap.set(reference, stream);
45165
+ this._crossReference._cacheMap.set(reference, dictionary);
45162
45166
  this._addKey(reference, appearance, element);
45163
45167
  }
45164
45168
  break;
@@ -46128,6 +46132,7 @@ var _JsonDocument = /** @__PURE__ @class */ (function (_super) {
46128
46132
  case 'MeasurementTypes':
46129
46133
  case 'GroupNesting':
46130
46134
  case 'ITEx':
46135
+ case 'TextMarkupContent':
46131
46136
  break;
46132
46137
  case 'Border':
46133
46138
  case 'A':
@@ -48964,6 +48969,7 @@ var PdfDocument = /** @__PURE__ @class */ (function () {
48964
48969
  this._hasUserPasswordOnly = false;
48965
48970
  this._encryptOnlyAttachment = false;
48966
48971
  this._encryptMetaData = false;
48972
+ this._isExport = false;
48967
48973
  this._allowCustomData = false;
48968
48974
  if (!data) {
48969
48975
  throw new Error('PDF data cannot be undefined or null');
@@ -49338,6 +49344,7 @@ var PdfDocument = /** @__PURE__ @class */ (function () {
49338
49344
  });
49339
49345
  };
49340
49346
  PdfDocument.prototype.exportAnnotations = function (arg1, arg2) {
49347
+ this._isExport = true;
49341
49348
  this._doPostProcessOnAnnotations();
49342
49349
  var helper;
49343
49350
  var settings;
@@ -49613,6 +49620,7 @@ var PdfDocument = /** @__PURE__ @class */ (function () {
49613
49620
  if (isFlatten === void 0) { isFlatten = false; }
49614
49621
  for (var i = 0; i < this.pageCount; i++) {
49615
49622
  var page = this.getPage(i);
49623
+ page.annotations._isExport = this._isExport;
49616
49624
  page.annotations._doPostProcess(isFlatten);
49617
49625
  if (isFlatten) {
49618
49626
  if (page._pageDictionary.has('Annots')) {