@syncfusion/ej2-pdf 23.2.4 → 24.1.41

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.
@@ -28502,6 +28502,7 @@ var PdfAnnotationCollection = /** @__PURE__ @class */ (function () {
28502
28502
  }
28503
28503
  if (this._parsedAnnotations.has(index)) {
28504
28504
  this._parsedAnnotations.delete(index);
28505
+ this._reorderParsedAnnotations(index);
28505
28506
  }
28506
28507
  var crossReference = this._page._crossReference;
28507
28508
  if (crossReference && crossReference._cacheMap.has(reference)) {
@@ -28509,6 +28510,18 @@ var PdfAnnotationCollection = /** @__PURE__ @class */ (function () {
28509
28510
  }
28510
28511
  }
28511
28512
  };
28513
+ PdfAnnotationCollection.prototype._reorderParsedAnnotations = function (index) {
28514
+ var result = new Map();
28515
+ this._parsedAnnotations.forEach(function (value, key) {
28516
+ if (key > index) {
28517
+ result.set(key - 1, value);
28518
+ }
28519
+ else {
28520
+ result.set(key, value);
28521
+ }
28522
+ });
28523
+ this._parsedAnnotations = result;
28524
+ };
28512
28525
  PdfAnnotationCollection.prototype._updateCustomAppearanceResource = function (annotation) {
28513
28526
  if (annotation instanceof PdfRubberStampAnnotation && typeof annotation._appearance !== 'undefined') {
28514
28527
  annotation._appearance.normal.graphics._processResources(annotation._crossReference);
@@ -44104,26 +44117,24 @@ var _XfdfDocument = /** @__PURE__ @class */ (function (_super) {
44104
44117
  var streamDictionary = primitive.dictionary;
44105
44118
  this._writePrefix(writer, 'STREAM', key);
44106
44119
  writer._writeAttributeString('DEFINE', '');
44120
+ var data = primitive.getString();
44121
+ if (!streamDictionary.has('Length') && data && data !== '') {
44122
+ streamDictionary.update('Length', primitive.length);
44123
+ }
44107
44124
  this._writeAppearanceDictionary(writer, streamDictionary);
44108
44125
  writer._writeStartElement('DATA');
44109
- var length_1 = streamDictionary.get('Length');
44110
- if (length_1 > 0 && (streamDictionary.has('Subtype') &&
44126
+ if ((streamDictionary.has('Subtype') &&
44111
44127
  this._getValue(streamDictionary.get('Subtype')) === 'Image') ||
44112
44128
  (!streamDictionary.has('Type') && !streamDictionary.has('Subtype'))) {
44113
44129
  writer._writeAttributeString('MODE', 'RAW');
44114
44130
  writer._writeAttributeString('ENCODING', 'HEX');
44115
- var data = primitive.getString();
44116
- if (data && data !== '') {
44117
- writer._writeRaw(data);
44118
- }
44119
44131
  }
44120
- else if (length_1 > 0) {
44132
+ else {
44121
44133
  writer._writeAttributeString('MODE', 'FILTERED');
44122
44134
  writer._writeAttributeString('ENCODING', 'ASCII');
44123
- var data = primitive.getString();
44124
- if (data && data !== '') {
44125
- writer._writeRaw(data);
44126
- }
44135
+ }
44136
+ if (data && data !== '') {
44137
+ writer._writeRaw(data);
44127
44138
  }
44128
44139
  writer._writeEndElement();
44129
44140
  writer._writeEndElement();
@@ -46293,27 +46304,27 @@ var _JsonDocument = /** @__PURE__ @class */ (function (_super) {
46293
46304
  var dataTable = new Map(); // eslint-disable-line
46294
46305
  var streamTable = new Map(); // eslint-disable-line
46295
46306
  var streamDictionary = value.dictionary;
46307
+ var data = value.getString(true);
46308
+ if (!streamDictionary.has('Length') && data && data !== '') {
46309
+ streamDictionary.update('Length', value.length);
46310
+ }
46296
46311
  this._writeAppearanceDictionary(streamTable, streamDictionary);
46297
- var length_1 = streamDictionary.get('Length');
46298
46312
  var type = void 0;
46299
46313
  if (streamDictionary.has('Subtype')) {
46300
46314
  type = this._getValue(streamDictionary.get('Subtype'));
46301
46315
  }
46302
- if (length_1 > 0) {
46303
- if ((!streamDictionary.has('Type') && !streamDictionary.has('Subtype')) ||
46304
- (streamDictionary.has('Subtype') &&
46305
- (type === 'Image' || type === 'Form' || type === 'CIDFontType0C' || type === 'OpenType'))) {
46306
- dataTable.set('mode', 'raw');
46307
- dataTable.set('encoding', 'hex');
46308
- }
46309
- else {
46310
- dataTable.set('mode', 'filtered');
46311
- dataTable.set('encoding', 'ascii');
46312
- }
46313
- var data = value.getString(true);
46314
- if (data && data !== '') {
46315
- dataTable.set('bytes', data);
46316
- }
46316
+ if ((!streamDictionary.has('Type') && !streamDictionary.has('Subtype')) ||
46317
+ (streamDictionary.has('Subtype') &&
46318
+ (type === 'Image' || type === 'Form' || type === 'CIDFontType0C' || type === 'OpenType'))) {
46319
+ dataTable.set('mode', 'raw');
46320
+ dataTable.set('encoding', 'hex');
46321
+ }
46322
+ else {
46323
+ dataTable.set('mode', 'filtered');
46324
+ dataTable.set('encoding', 'ascii');
46325
+ }
46326
+ if (data && data !== '') {
46327
+ dataTable.set('bytes', data);
46317
46328
  }
46318
46329
  streamTable.set('data', this._convertToJson(dataTable));
46319
46330
  this._writeTable('stream', this._convertToJson(streamTable), table, key, array);