@syncfusion/ej2-pdf 23.1.39 → 23.2.4

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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 23.1.39
3
+ * version : 23.2.4
4
4
  * Copyright Syncfusion Inc. 2001 - 2023. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "_from": "@syncfusion/ej2-pdf@*",
3
- "_id": "@syncfusion/ej2-pdf@23.1.38",
3
+ "_id": "@syncfusion/ej2-pdf@23.1.44",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-FL3hsArLkJBVTcoPCA8xNYz8Ap0RpHpKVVdR2R5qETpw4SoLPbvv78ig0Samph39eQ0s/WFgzqMxmiJZmwY7VQ==",
5
+ "_integrity": "sha512-8HbSb/V/LGnq4auV59phtsHcMVBv7UR0AIUl/s/knmrkr07ZR9Oy3W8K+g8brO3IUnL1T5hrtcBQffH8nZi4uA==",
6
6
  "_location": "/@syncfusion/ej2-pdf",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
@@ -21,8 +21,8 @@
21
21
  "/@syncfusion/ej2",
22
22
  "/@syncfusion/ej2-pdfviewer"
23
23
  ],
24
- "_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-pdf/-/ej2-pdf-23.1.38.tgz",
25
- "_shasum": "9adbd287dae5a6e106e9ec477330805f5aa0fb91",
24
+ "_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-pdf/-/ej2-pdf-23.1.44.tgz",
25
+ "_shasum": "bffcba5e74423d38f84f2900ca6ad4d3aea41b28",
26
26
  "_spec": "@syncfusion/ej2-pdf@*",
27
27
  "_where": "/jenkins/workspace/elease-automation_release_23.1.1/packages/included",
28
28
  "author": {
@@ -30,8 +30,8 @@
30
30
  },
31
31
  "bundleDependencies": false,
32
32
  "dependencies": {
33
- "@syncfusion/ej2-base": "~23.1.38",
34
- "@syncfusion/ej2-compression": "~23.1.36"
33
+ "@syncfusion/ej2-base": "~23.2.4",
34
+ "@syncfusion/ej2-compression": "~23.2.4"
35
35
  },
36
36
  "deprecated": false,
37
37
  "description": "Feature-rich JavaScript PDF library with built-in support for loading and manipulating PDF document.",
@@ -55,7 +55,7 @@
55
55
  "url": "https://github.com/syncfusion/ej2-javascript-ui-controls/tree/master/controls/pdf"
56
56
  },
57
57
  "typings": "index.d.ts",
58
- "version": "23.1.39",
58
+ "version": "23.2.4",
59
59
  "sideEffects": false,
60
60
  "homepage": "https://www.syncfusion.com/javascript-ui-controls"
61
61
  }
@@ -19,6 +19,7 @@ export declare class PdfAnnotationCollection {
19
19
  _annotations: Array<_PdfReference>;
20
20
  _comments: Array<PdfPopupAnnotation>;
21
21
  _parsedAnnotations: Map<number, PdfAnnotation>;
22
+ _isExport: boolean;
22
23
  private _page;
23
24
  private _crossReference;
24
25
  /**
@@ -25,6 +25,7 @@ var PdfAnnotationCollection = /** @class */ (function () {
25
25
  * @param {PdfPage} page PDF page object.
26
26
  */
27
27
  function PdfAnnotationCollection(array, xref, page) {
28
+ this._isExport = false;
28
29
  this._annotations = array;
29
30
  this._page = page;
30
31
  this._crossReference = xref;
@@ -418,6 +419,7 @@ var PdfAnnotationCollection = /** @class */ (function () {
418
419
  for (var i = this.count - 1; i >= 0; i--) {
419
420
  var annotation = this.at(i);
420
421
  if (annotation) {
422
+ annotation._isExport = this._isExport;
421
423
  annotation._doPostProcess(annotation.flatten || isFlatten);
422
424
  }
423
425
  }
@@ -34,6 +34,7 @@ export declare abstract class PdfAnnotation {
34
34
  _page: PdfPage;
35
35
  _isLoaded: boolean;
36
36
  _setAppearance: boolean;
37
+ _isExport: boolean;
37
38
  _color: number[];
38
39
  _annotFlags: PdfAnnotationFlag;
39
40
  _bounds: {
@@ -44,6 +44,7 @@ var PdfAnnotation = /** @class */ (function () {
44
44
  this._isImported = false;
45
45
  this._isLoaded = false;
46
46
  this._setAppearance = false;
47
+ this._isExport = false;
47
48
  this._opacity = 1;
48
49
  this._isAllRotation = true;
49
50
  this._flatten = false;
@@ -8107,12 +8108,17 @@ var PdfDocumentLinkAnnotation = /** @class */ (function (_super) {
8107
8108
  else if (this._dictionary.has('A') && !this._destination) {
8108
8109
  var action = this._dictionary.get('A');
8109
8110
  if (action.has('D')) {
8110
- var reference = action.get('D');
8111
- if (reference) {
8112
- var referenceValue = this._crossReference._fetch(reference); // eslint-disable-line
8111
+ var reference = action.get('D'); // eslint-disable-line
8112
+ if (reference !== null && typeof reference !== 'undefined') {
8113
8113
  var referenceArray = void 0; // eslint-disable-line
8114
- if (Array.isArray(referenceValue)) {
8115
- referenceArray = referenceValue;
8114
+ if (Array.isArray(reference)) {
8115
+ referenceArray = reference;
8116
+ }
8117
+ else if (reference instanceof _PdfReference) {
8118
+ var referenceValue = this._crossReference._fetch(reference); // eslint-disable-line
8119
+ if (Array.isArray(referenceValue)) {
8120
+ referenceArray = referenceValue;
8121
+ }
8116
8122
  }
8117
8123
  if (referenceArray) {
8118
8124
  if (referenceArray[0] instanceof _PdfReference) {
@@ -9663,11 +9669,11 @@ var PdfRubberStampAnnotation = /** @class */ (function (_super) {
9663
9669
  PdfRubberStampAnnotation.prototype._doPostProcess = function (isFlatten) {
9664
9670
  if (isFlatten === void 0) { isFlatten = false; }
9665
9671
  var isTransformBBox = false;
9666
- if (this._isLoaded && (this._setAppearance || isFlatten)) {
9667
- if (!isFlatten) {
9672
+ if (this._isLoaded && (this._setAppearance || isFlatten || this._isExport)) {
9673
+ if ((!isFlatten && !this._isExport) || this._setAppearance) {
9668
9674
  this._appearanceTemplate = this._createRubberStampAppearance();
9669
9675
  }
9670
- if (!this._appearanceTemplate && isFlatten && this._dictionary.has('AP')) {
9676
+ if (!this._appearanceTemplate && (this._isExport || isFlatten) && this._dictionary.has('AP')) {
9671
9677
  var dictionary = this._dictionary.get('AP');
9672
9678
  if (dictionary && dictionary.has('N')) {
9673
9679
  var appearanceStream = dictionary.get('N');
@@ -9724,8 +9730,10 @@ var PdfRubberStampAnnotation = /** @class */ (function (_super) {
9724
9730
  }
9725
9731
  }
9726
9732
  else {
9727
- this._postProcess();
9728
- if ((!this._appearanceTemplate) && isFlatten) {
9733
+ if (!(this._isImported && this._dictionary.has('AP'))) {
9734
+ this._postProcess();
9735
+ }
9736
+ if ((!this._appearanceTemplate) && (isFlatten || this._isImported)) {
9729
9737
  if (!this._dictionary.has('AP')) {
9730
9738
  this._appearanceTemplate = this._createRubberStampAppearance();
9731
9739
  }
@@ -472,6 +472,7 @@ var _JsonDocument = /** @class */ (function (_super) {
472
472
  case 'MeasurementTypes':
473
473
  case 'GroupNesting':
474
474
  case 'ITEx':
475
+ case 'TextMarkupContent':
475
476
  break;
476
477
  case 'Border':
477
478
  case 'A':
@@ -16,7 +16,7 @@ import { PdfAnnotation, PdfFileLinkAnnotation, PdfTextWebLinkAnnotation, PdfDocu
16
16
  import { PdfAnnotationFlag } from './../enumerator';
17
17
  import { _PdfDictionary, _PdfName, _PdfReference } from './../pdf-primitives';
18
18
  import { _PdfBaseStream, _PdfContentStream } from './../base-stream';
19
- import { _hexStringToByteArray, _stringToAnnotationFlags, _convertToColor, _bytesToString, _hexStringToString, _getSpecialCharacter, _getLatinCharacter, _getInheritableProperty, _getNewGuidString, _byteArrayToHexString, _stringToBytes, _annotationFlagsToString, _encode, _decode } from './../utils';
19
+ import { _hexStringToByteArray, _stringToAnnotationFlags, _convertToColor, _bytesToString, _hexStringToString, _getSpecialCharacter, _getLatinCharacter, _getInheritableProperty, _getNewGuidString, _byteArrayToHexString, _stringToBytes, _annotationFlagsToString, _encode } from './../utils';
20
20
  import { PdfCheckBoxField, PdfComboBoxField, PdfListBoxField, PdfRadioButtonListField, PdfTextBoxField, PdfListField } from './../form/field';
21
21
  var _ExportHelper = /** @class */ (function () {
22
22
  function _ExportHelper() {
@@ -1303,7 +1303,7 @@ var _XfdfDocument = /** @class */ (function (_super) {
1303
1303
  }
1304
1304
  };
1305
1305
  _XfdfDocument.prototype._writeObject = function (writer, primitive, dictionary, key) {
1306
- if (primitive) {
1306
+ if (primitive !== null && typeof primitive !== 'undefined') {
1307
1307
  if (primitive instanceof _PdfName) {
1308
1308
  this._writePrefix(writer, 'NAME', key);
1309
1309
  writer._writeAttributeString('VAL', primitive.name);
@@ -1530,6 +1530,7 @@ var _XfdfDocument = /** @class */ (function (_super) {
1530
1530
  case 'Vertices':
1531
1531
  case 'GroupNesting':
1532
1532
  case 'ITEx':
1533
+ case 'TextMarkupContent':
1533
1534
  break;
1534
1535
  default:
1535
1536
  this._writeAttributeString(writer, key.toLowerCase(), primitive);
@@ -1847,6 +1848,7 @@ var _XfdfDocument = /** @class */ (function (_super) {
1847
1848
  var annotations = page.annotations;
1848
1849
  var annotation = annotations._parseAnnotation(annotationDictionary);
1849
1850
  if (annotation) {
1851
+ annotation._isImported = true;
1850
1852
  var reference = this._crossReference._getNextReference();
1851
1853
  this._crossReference._cacheMap.set(reference, annotationDictionary);
1852
1854
  if (annotationDictionary.has('NM') || annotationDictionary.has('IRT')) {
@@ -2367,26 +2369,23 @@ var _XfdfDocument = /** @class */ (function (_super) {
2367
2369
  _XfdfDocument.prototype._addAppearanceData = function (element, dictionary) {
2368
2370
  var innerText = element.textContent;
2369
2371
  if (innerText && innerText !== '') {
2370
- var appearanceArray = _decode(innerText);
2371
- if (appearanceArray && appearanceArray.length > 0) {
2372
- var document_1 = (new DOMParser()).parseFromString(_bytesToString(appearanceArray), 'text/xml');
2373
- if (document_1 && document_1.hasChildNodes) {
2374
- var childNodes = document_1.childNodes;
2375
- if (childNodes && childNodes.length === 1) {
2376
- var rootNode = childNodes[0];
2377
- if (rootNode && rootNode.nodeType === 1) {
2378
- var rootElement = rootNode;
2379
- if (rootElement.nodeName.toLowerCase() === 'DICT' && rootElement.hasAttribute('KEY')) {
2380
- var key = rootElement.getAttribute('KEY');
2381
- if (key && key === 'AP' && rootElement.hasChildNodes) {
2382
- var appearance = new _PdfDictionary(this._crossReference);
2383
- childNodes = rootElement.childNodes;
2384
- for (var i = 0; i < childNodes.length; i++) {
2385
- this._getAppearance(appearance, childNodes[Number.parseInt(i.toString(), 10)]);
2386
- }
2387
- if (appearance.size > 0) {
2388
- dictionary.update('AP', appearance);
2389
- }
2372
+ var document_1 = (new DOMParser()).parseFromString(atob(innerText), 'text/xml');
2373
+ if (document_1 && document_1.hasChildNodes) {
2374
+ var childNodes = document_1.childNodes;
2375
+ if (childNodes && childNodes.length === 1) {
2376
+ var rootNode = childNodes[0];
2377
+ if (rootNode && rootNode.nodeType === 1) {
2378
+ var rootElement = rootNode;
2379
+ if (rootElement.nodeName.toUpperCase() === 'DICT' && rootElement.hasAttribute('KEY')) {
2380
+ var key = rootElement.getAttribute('KEY');
2381
+ if (key && key === 'AP' && rootElement.hasChildNodes) {
2382
+ var appearance = new _PdfDictionary(this._crossReference);
2383
+ childNodes = rootElement.childNodes;
2384
+ for (var i = 0; i < childNodes.length; i++) {
2385
+ this._getAppearance(appearance, childNodes[Number.parseInt(i.toString(), 10)]);
2386
+ }
2387
+ if (appearance.size > 0) {
2388
+ dictionary.update('AP', appearance);
2390
2389
  }
2391
2390
  }
2392
2391
  }
@@ -2416,7 +2415,7 @@ var _XfdfDocument = /** @class */ (function (_super) {
2416
2415
  dictionary = this._getDictionary(element);
2417
2416
  if (dictionary) {
2418
2417
  var reference = this._crossReference._getNextReference();
2419
- this._crossReference._cacheMap.set(reference, stream);
2418
+ this._crossReference._cacheMap.set(reference, dictionary);
2420
2419
  this._addKey(reference, appearance, element);
2421
2420
  }
2422
2421
  break;
@@ -10,6 +10,7 @@ export declare class _PdfCatalog {
10
10
  readonly version: string;
11
11
  readonly pageCount: number;
12
12
  readonly acroForm: _PdfDictionary;
13
+ _createForm(): _PdfDictionary;
13
14
  getPageDictionary(pageIndex: number): {
14
15
  dictionary: _PdfDictionary;
15
16
  reference: _PdfReference;
@@ -45,12 +45,8 @@ var _PdfCatalog = /** @class */ (function () {
45
45
  if (this._catalogDictionary.has('AcroForm')) {
46
46
  form = this._catalogDictionary.get('AcroForm');
47
47
  }
48
- else {
49
- form = new _PdfDictionary(this._crossReference);
50
- var ref = this._crossReference._getNextReference();
51
- this._crossReference._cacheMap.set(ref, form);
52
- this._catalogDictionary.set('AcroForm', ref);
53
- this._catalogDictionary._updated = true;
48
+ if (form === null || typeof form === 'undefined') {
49
+ form = this._createForm();
54
50
  }
55
51
  return form;
56
52
  },
@@ -58,6 +54,14 @@ var _PdfCatalog = /** @class */ (function () {
58
54
  configurable: true
59
55
  });
60
56
  /* eslint-disable */
57
+ _PdfCatalog.prototype._createForm = function () {
58
+ var form = new _PdfDictionary(this._crossReference);
59
+ var ref = this._crossReference._getNextReference();
60
+ this._crossReference._cacheMap.set(ref, form);
61
+ this._catalogDictionary.set('AcroForm', ref);
62
+ this._catalogDictionary._updated = true;
63
+ return form;
64
+ };
61
65
  _PdfCatalog.prototype.getPageDictionary = function (pageIndex) {
62
66
  var nodesToVisit = [this._topPagesDictionary];
63
67
  var visitedNodes = new _PdfReferenceSet();
@@ -8,7 +8,7 @@ export declare class _PdfCrossReference {
8
8
  _stream: _PdfStream;
9
9
  _pendingRefs: _PdfReferenceSet;
10
10
  _entries: _PdfObjectInformation[];
11
- _crossReferencePosition: Object;
11
+ _crossReferencePosition: any;
12
12
  _cacheMap: Map<_PdfReference, any>;
13
13
  _startXRefQueue: number[];
14
14
  _trailer: _PdfDictionary;
@@ -45,6 +45,7 @@ export declare class PdfDocument {
45
45
  _hasUserPasswordOnly: boolean;
46
46
  _encryptOnlyAttachment: boolean;
47
47
  _encryptMetaData: boolean;
48
+ _isExport: boolean;
48
49
  private _allowCustomData;
49
50
  /**
50
51
  * Initializes a new instance of the `PdfDocument` class.
@@ -44,6 +44,7 @@ var PdfDocument = /** @class */ (function () {
44
44
  this._hasUserPasswordOnly = false;
45
45
  this._encryptOnlyAttachment = false;
46
46
  this._encryptMetaData = false;
47
+ this._isExport = false;
47
48
  this._allowCustomData = false;
48
49
  if (!data) {
49
50
  throw new Error('PDF data cannot be undefined or null');
@@ -418,6 +419,7 @@ var PdfDocument = /** @class */ (function () {
418
419
  });
419
420
  };
420
421
  PdfDocument.prototype.exportAnnotations = function (arg1, arg2) {
422
+ this._isExport = true;
421
423
  this._doPostProcessOnAnnotations();
422
424
  var helper;
423
425
  var settings;
@@ -693,6 +695,7 @@ var PdfDocument = /** @class */ (function () {
693
695
  if (isFlatten === void 0) { isFlatten = false; }
694
696
  for (var i = 0; i < this.pageCount; i++) {
695
697
  var page = this.getPage(i);
698
+ page.annotations._isExport = this._isExport;
696
699
  page.annotations._doPostProcess(isFlatten);
697
700
  if (isFlatten) {
698
701
  if (page._pageDictionary.has('Annots')) {
@@ -763,7 +763,7 @@ var _PdfParser = /** @class */ (function () {
763
763
  var dictBytes = stream.getBytes(dictLength);
764
764
  stream.position = initialStreamPos;
765
765
  cacheKey = this._computeMaxNumber(imageBytes) + '_' + this._computeMaxNumber(dictBytes);
766
- var cacheEntry = this.imageCache[cacheKey]; // eslint-disable-line
766
+ var cacheEntry = this.imageCache.get(cacheKey);
767
767
  if (cacheEntry !== undefined) {
768
768
  this.second = _PdfCommand.get('EI');
769
769
  this.shift();
@@ -777,7 +777,7 @@ var _PdfParser = /** @class */ (function () {
777
777
  imageStream = this.filter(imageStream, dictionary, length);
778
778
  imageStream.dictionary = dictionary;
779
779
  if (cacheKey !== undefined) {
780
- this.imageCache[cacheKey] = imageStream; // eslint-disable-line
780
+ this.imageCache.set(cacheKey, imageStream);
781
781
  }
782
782
  this.second = _PdfCommand.get('EI');
783
783
  this.shift();