@syncfusion/ej2-pdf 24.2.3 → 24.2.7

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.
@@ -21655,50 +21655,54 @@ class PdfDocumentLinkAnnotation extends PdfAnnotation {
21655
21655
  referenceArray = referenceValue;
21656
21656
  }
21657
21657
  }
21658
- if (referenceArray) {
21658
+ if (referenceArray && (referenceArray[0] instanceof _PdfReference || typeof referenceArray[0] === 'number')) {
21659
+ const document = this._crossReference._document;
21660
+ let index;
21659
21661
  if (referenceArray[0] instanceof _PdfReference) {
21660
- const document = this._crossReference._document;
21661
- const index = _getPageIndex(document, this._crossReference._fetch(referenceArray[0]));
21662
- const page = document.getPage(index);
21663
- if (page) {
21664
- const mode = referenceArray[1];
21665
- if (mode.name === 'FitBH' || mode.name === 'FitH') {
21666
- const top = referenceArray[2];
21667
- const topValue = (typeof top !== 'undefined' && top !== null) ? (page.size[1] - top) : 0;
21668
- this._destination = new PdfDestination(page, [0, topValue]);
21669
- if (typeof top === 'undefined' || top === null) {
21670
- this._destination._setValidation(false);
21671
- }
21662
+ index = _getPageIndex(document, this._crossReference._fetch(referenceArray[0]));
21663
+ }
21664
+ else {
21665
+ index = referenceArray[0];
21666
+ }
21667
+ const page = document.getPage(index);
21668
+ if (page) {
21669
+ const mode = referenceArray[1];
21670
+ if (mode.name === 'FitBH' || mode.name === 'FitH') {
21671
+ const top = referenceArray[2];
21672
+ const topValue = (typeof top !== 'undefined' && top !== null) ? (page.size[1] - top) : 0;
21673
+ this._destination = new PdfDestination(page, [0, topValue]);
21674
+ if (typeof top === 'undefined' || top === null) {
21675
+ this._destination._setValidation(false);
21672
21676
  }
21673
- else if (mode.name === 'XYZ') {
21674
- const left = referenceArray[2];
21675
- const top = referenceArray[3];
21676
- const zoom = referenceArray[4];
21677
- const topValue = (typeof top !== 'undefined' && top !== null) ? (page.size[1] - top) : 0;
21678
- const leftValue = (typeof left !== 'undefined' && left !== null) ? left : 0;
21679
- this._destination = new PdfDestination(page, [leftValue, topValue]);
21680
- if (typeof zoom !== 'undefined' && zoom !== null) {
21681
- this._destination.zoom = zoom;
21682
- }
21683
- if ((typeof left !== 'undefined' && left !== null) || (typeof top !== 'undefined' && top !== null)
21684
- || (typeof zoom !== 'undefined' && zoom !== null)) {
21685
- this._destination._setValidation(false);
21686
- }
21677
+ }
21678
+ else if (mode.name === 'XYZ') {
21679
+ const left = referenceArray[2];
21680
+ const top = referenceArray[3];
21681
+ const zoom = referenceArray[4];
21682
+ const topValue = (typeof top !== 'undefined' && top !== null) ? (page.size[1] - top) : 0;
21683
+ const leftValue = (typeof left !== 'undefined' && left !== null) ? left : 0;
21684
+ this._destination = new PdfDestination(page, [leftValue, topValue]);
21685
+ if (typeof zoom !== 'undefined' && zoom !== null) {
21686
+ this._destination.zoom = zoom;
21687
21687
  }
21688
- else if (mode.name === 'FitR') {
21689
- if (referenceArray.length === 6) {
21690
- const left = referenceArray[2];
21691
- const bottom = referenceArray[3];
21692
- const right = referenceArray[4];
21693
- const top = referenceArray[5];
21694
- this._destination = new PdfDestination(page, [left, bottom, right, top]);
21695
- }
21688
+ if ((typeof left !== 'undefined' && left !== null) || (typeof top !== 'undefined' && top !== null)
21689
+ || (typeof zoom !== 'undefined' && zoom !== null)) {
21690
+ this._destination._setValidation(false);
21696
21691
  }
21697
- else if (mode.name === 'Fit') {
21698
- this._destination = new PdfDestination(page);
21699
- this._destination.mode = PdfDestinationMode.fitToPage;
21692
+ }
21693
+ else if (mode.name === 'FitR') {
21694
+ if (referenceArray.length === 6) {
21695
+ const left = referenceArray[2];
21696
+ const bottom = referenceArray[3];
21697
+ const right = referenceArray[4];
21698
+ const top = referenceArray[5];
21699
+ this._destination = new PdfDestination(page, [left, bottom, right, top]);
21700
21700
  }
21701
21701
  }
21702
+ else if (mode.name === 'Fit') {
21703
+ this._destination = new PdfDestination(page);
21704
+ this._destination.mode = PdfDestinationMode.fitToPage;
21705
+ }
21702
21706
  }
21703
21707
  }
21704
21708
  }
@@ -40691,22 +40695,26 @@ class PdfForm {
40691
40695
  if (page && document) {
40692
40696
  for (let i = 0; i < this._fieldCollection.length; i++) {
40693
40697
  const field = this._fieldCollection[Number.parseInt(i.toString(), 10)];
40694
- const index = _getPageIndex(document, field.page._pageDictionary);
40695
- if (fieldCollection.has(index)) {
40696
- value = fieldCollection.get(index);
40697
- value.push(field);
40698
- }
40699
- else {
40700
- value = [];
40701
- value.push(field);
40702
- fieldCollection.set(index, value);
40703
- }
40704
- const page = document.getPage(index);
40705
- if (!this._tabCollection.has(index)) {
40706
- this._tabCollection.set(index, page.tabOrder);
40707
- }
40708
- if (setTabOrder) {
40709
- page.tabOrder = this._tabCollection.get(index);
40698
+ if (field.page) {
40699
+ const index = _getPageIndex(document, field.page._pageDictionary);
40700
+ if (index >= 0) {
40701
+ if (fieldCollection.has(index)) {
40702
+ value = fieldCollection.get(index);
40703
+ value.push(field);
40704
+ }
40705
+ else {
40706
+ value = [];
40707
+ value.push(field);
40708
+ fieldCollection.set(index, value);
40709
+ }
40710
+ const page = document.getPage(index);
40711
+ if (!this._tabCollection.has(index)) {
40712
+ this._tabCollection.set(index, page.tabOrder);
40713
+ }
40714
+ if (setTabOrder) {
40715
+ page.tabOrder = this._tabCollection.get(index);
40716
+ }
40717
+ }
40710
40718
  }
40711
40719
  }
40712
40720
  let fieldsCount = 0;
@@ -44906,6 +44914,14 @@ class _JsonDocument extends _ExportHelper {
44906
44914
  case 'ca':
44907
44915
  this._writeAttributeString(key.toLowerCase(), primitive);
44908
44916
  break;
44917
+ case 'CustomData':
44918
+ if (primitive && primitive.length > 2 && primitive.startsWith('{') && primitive.endsWith('}')) {
44919
+ this._table.set(key, primitive);
44920
+ }
44921
+ else {
44922
+ this._writeAttributeString(key, primitive);
44923
+ }
44924
+ break;
44909
44925
  default:
44910
44926
  this._writeAttributeString(key, primitive);
44911
44927
  break;
@@ -45551,7 +45567,7 @@ class _JsonDocument extends _ExportHelper {
45551
45567
  }
45552
45568
  break;
45553
45569
  case 'customdata':
45554
- this._addString(dictionary, 'CustomData', value);
45570
+ this._addString(dictionary, 'CustomData', typeof value === 'string' ? value : JSON.stringify(value));
45555
45571
  break;
45556
45572
  case 'appearance':
45557
45573
  this._addAppearanceData(dictionary, value);