@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.
@@ -27357,6 +27357,7 @@ class PdfAnnotationCollection {
27357
27357
  }
27358
27358
  if (this._parsedAnnotations.has(index)) {
27359
27359
  this._parsedAnnotations.delete(index);
27360
+ this._reorderParsedAnnotations(index);
27360
27361
  }
27361
27362
  const crossReference = this._page._crossReference;
27362
27363
  if (crossReference && crossReference._cacheMap.has(reference)) {
@@ -27364,6 +27365,18 @@ class PdfAnnotationCollection {
27364
27365
  }
27365
27366
  }
27366
27367
  }
27368
+ _reorderParsedAnnotations(index) {
27369
+ const result = new Map();
27370
+ this._parsedAnnotations.forEach((value, key) => {
27371
+ if (key > index) {
27372
+ result.set(key - 1, value);
27373
+ }
27374
+ else {
27375
+ result.set(key, value);
27376
+ }
27377
+ });
27378
+ this._parsedAnnotations = result;
27379
+ }
27367
27380
  _updateCustomAppearanceResource(annotation) {
27368
27381
  if (annotation instanceof PdfRubberStampAnnotation && typeof annotation._appearance !== 'undefined') {
27369
27382
  annotation._appearance.normal.graphics._processResources(annotation._crossReference);
@@ -42495,26 +42508,24 @@ class _XfdfDocument extends _ExportHelper {
42495
42508
  const streamDictionary = primitive.dictionary;
42496
42509
  this._writePrefix(writer, 'STREAM', key);
42497
42510
  writer._writeAttributeString('DEFINE', '');
42511
+ const data = primitive.getString();
42512
+ if (!streamDictionary.has('Length') && data && data !== '') {
42513
+ streamDictionary.update('Length', primitive.length);
42514
+ }
42498
42515
  this._writeAppearanceDictionary(writer, streamDictionary);
42499
42516
  writer._writeStartElement('DATA');
42500
- const length = streamDictionary.get('Length');
42501
- if (length > 0 && (streamDictionary.has('Subtype') &&
42517
+ if ((streamDictionary.has('Subtype') &&
42502
42518
  this._getValue(streamDictionary.get('Subtype')) === 'Image') ||
42503
42519
  (!streamDictionary.has('Type') && !streamDictionary.has('Subtype'))) {
42504
42520
  writer._writeAttributeString('MODE', 'RAW');
42505
42521
  writer._writeAttributeString('ENCODING', 'HEX');
42506
- const data = primitive.getString();
42507
- if (data && data !== '') {
42508
- writer._writeRaw(data);
42509
- }
42510
42522
  }
42511
- else if (length > 0) {
42523
+ else {
42512
42524
  writer._writeAttributeString('MODE', 'FILTERED');
42513
42525
  writer._writeAttributeString('ENCODING', 'ASCII');
42514
- const data = primitive.getString();
42515
- if (data && data !== '') {
42516
- writer._writeRaw(data);
42517
- }
42526
+ }
42527
+ if (data && data !== '') {
42528
+ writer._writeRaw(data);
42518
42529
  }
42519
42530
  writer._writeEndElement();
42520
42531
  writer._writeEndElement();
@@ -44636,27 +44647,27 @@ class _JsonDocument extends _ExportHelper {
44636
44647
  const dataTable = new Map(); // eslint-disable-line
44637
44648
  const streamTable = new Map(); // eslint-disable-line
44638
44649
  const streamDictionary = value.dictionary;
44650
+ const data = value.getString(true);
44651
+ if (!streamDictionary.has('Length') && data && data !== '') {
44652
+ streamDictionary.update('Length', value.length);
44653
+ }
44639
44654
  this._writeAppearanceDictionary(streamTable, streamDictionary);
44640
- const length = streamDictionary.get('Length');
44641
44655
  let type;
44642
44656
  if (streamDictionary.has('Subtype')) {
44643
44657
  type = this._getValue(streamDictionary.get('Subtype'));
44644
44658
  }
44645
- if (length > 0) {
44646
- if ((!streamDictionary.has('Type') && !streamDictionary.has('Subtype')) ||
44647
- (streamDictionary.has('Subtype') &&
44648
- (type === 'Image' || type === 'Form' || type === 'CIDFontType0C' || type === 'OpenType'))) {
44649
- dataTable.set('mode', 'raw');
44650
- dataTable.set('encoding', 'hex');
44651
- }
44652
- else {
44653
- dataTable.set('mode', 'filtered');
44654
- dataTable.set('encoding', 'ascii');
44655
- }
44656
- const data = value.getString(true);
44657
- if (data && data !== '') {
44658
- dataTable.set('bytes', data);
44659
- }
44659
+ if ((!streamDictionary.has('Type') && !streamDictionary.has('Subtype')) ||
44660
+ (streamDictionary.has('Subtype') &&
44661
+ (type === 'Image' || type === 'Form' || type === 'CIDFontType0C' || type === 'OpenType'))) {
44662
+ dataTable.set('mode', 'raw');
44663
+ dataTable.set('encoding', 'hex');
44664
+ }
44665
+ else {
44666
+ dataTable.set('mode', 'filtered');
44667
+ dataTable.set('encoding', 'ascii');
44668
+ }
44669
+ if (data && data !== '') {
44670
+ dataTable.set('bytes', data);
44660
44671
  }
44661
44672
  streamTable.set('data', this._convertToJson(dataTable));
44662
44673
  this._writeTable('stream', this._convertToJson(streamTable), table, key, array);
@@ -48275,7 +48286,7 @@ class _ImageDecoder {
48275
48286
  }
48276
48287
  }
48277
48288
  _skipStream() {
48278
- let length = this._getBuffer(this._position) << 8 | this._getBuffer(this._position + 1);
48289
+ const length = this._getBuffer(this._position) << 8 | this._getBuffer(this._position + 1);
48279
48290
  this._seek(2);
48280
48291
  if (length < 2) {
48281
48292
  throw new Error('Error decoding JPEG image');
@@ -48287,7 +48298,7 @@ class _ImageDecoder {
48287
48298
  _readExceededJpegImage() {
48288
48299
  let isContinueReading = true;
48289
48300
  while (isContinueReading) {
48290
- let marker = this._getMarker();
48301
+ const marker = this._getMarker();
48291
48302
  switch (marker) {
48292
48303
  case 0x00C0:
48293
48304
  case 0x00C1: