@syncfusion/ej2-pdf 23.1.44 → 23.2.6

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.
@@ -21353,12 +21353,17 @@ class PdfDocumentLinkAnnotation extends PdfAnnotation {
21353
21353
  else if (this._dictionary.has('A') && !this._destination) {
21354
21354
  const action = this._dictionary.get('A');
21355
21355
  if (action.has('D')) {
21356
- const reference = action.get('D');
21357
- if (reference) {
21358
- const referenceValue = this._crossReference._fetch(reference); // eslint-disable-line
21356
+ const reference = action.get('D'); // eslint-disable-line
21357
+ if (reference !== null && typeof reference !== 'undefined') {
21359
21358
  let referenceArray; // eslint-disable-line
21360
- if (Array.isArray(referenceValue)) {
21361
- referenceArray = referenceValue;
21359
+ if (Array.isArray(reference)) {
21360
+ referenceArray = reference;
21361
+ }
21362
+ else if (reference instanceof _PdfReference) {
21363
+ const referenceValue = this._crossReference._fetch(reference); // eslint-disable-line
21364
+ if (Array.isArray(referenceValue)) {
21365
+ referenceArray = referenceValue;
21366
+ }
21362
21367
  }
21363
21368
  if (referenceArray) {
21364
21369
  if (referenceArray[0] instanceof _PdfReference) {
@@ -27352,6 +27357,7 @@ class PdfAnnotationCollection {
27352
27357
  }
27353
27358
  if (this._parsedAnnotations.has(index)) {
27354
27359
  this._parsedAnnotations.delete(index);
27360
+ this._reorderParsedAnnotations(index);
27355
27361
  }
27356
27362
  const crossReference = this._page._crossReference;
27357
27363
  if (crossReference && crossReference._cacheMap.has(reference)) {
@@ -27359,6 +27365,18 @@ class PdfAnnotationCollection {
27359
27365
  }
27360
27366
  }
27361
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
+ }
27362
27380
  _updateCustomAppearanceResource(annotation) {
27363
27381
  if (annotation instanceof PdfRubberStampAnnotation && typeof annotation._appearance !== 'undefined') {
27364
27382
  annotation._appearance.normal.graphics._processResources(annotation._crossReference);
@@ -36049,16 +36067,20 @@ class _PdfCatalog {
36049
36067
  if (this._catalogDictionary.has('AcroForm')) {
36050
36068
  form = this._catalogDictionary.get('AcroForm');
36051
36069
  }
36052
- else {
36053
- form = new _PdfDictionary(this._crossReference);
36054
- const ref = this._crossReference._getNextReference();
36055
- this._crossReference._cacheMap.set(ref, form);
36056
- this._catalogDictionary.set('AcroForm', ref);
36057
- this._catalogDictionary._updated = true;
36070
+ if (form === null || typeof form === 'undefined') {
36071
+ form = this._createForm();
36058
36072
  }
36059
36073
  return form;
36060
36074
  }
36061
36075
  /* eslint-disable */
36076
+ _createForm() {
36077
+ const form = new _PdfDictionary(this._crossReference);
36078
+ const ref = this._crossReference._getNextReference();
36079
+ this._crossReference._cacheMap.set(ref, form);
36080
+ this._catalogDictionary.set('AcroForm', ref);
36081
+ this._catalogDictionary._updated = true;
36082
+ return form;
36083
+ }
36062
36084
  getPageDictionary(pageIndex) {
36063
36085
  const nodesToVisit = [this._topPagesDictionary];
36064
36086
  const visitedNodes = new _PdfReferenceSet();
@@ -37116,7 +37138,7 @@ class _PdfParser {
37116
37138
  const dictBytes = stream.getBytes(dictLength);
37117
37139
  stream.position = initialStreamPos;
37118
37140
  cacheKey = this._computeMaxNumber(imageBytes) + '_' + this._computeMaxNumber(dictBytes);
37119
- const cacheEntry = this.imageCache[cacheKey]; // eslint-disable-line
37141
+ const cacheEntry = this.imageCache.get(cacheKey);
37120
37142
  if (cacheEntry !== undefined) {
37121
37143
  this.second = _PdfCommand.get('EI');
37122
37144
  this.shift();
@@ -37130,7 +37152,7 @@ class _PdfParser {
37130
37152
  imageStream = this.filter(imageStream, dictionary, length);
37131
37153
  imageStream.dictionary = dictionary;
37132
37154
  if (cacheKey !== undefined) {
37133
- this.imageCache[cacheKey] = imageStream; // eslint-disable-line
37155
+ this.imageCache.set(cacheKey, imageStream);
37134
37156
  }
37135
37157
  this.second = _PdfCommand.get('EI');
37136
37158
  this.shift();