@syncfusion/ej2-pdf 25.1.37 → 25.1.38

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 : 25.1.37
3
+ * version : 25.1.38
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
@@ -2,7 +2,7 @@
2
2
  "_from": "@syncfusion/ej2-pdf@*",
3
3
  "_id": "@syncfusion/ej2-pdf@25.1.35",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-Xc7M7OB3Ky2RaFsvufVzgwyt8wV+lDbN2w/gUJ2U/qgvtDEbO25mGId3FdTfuB+W7jACrSg/v7Q32XzcKwKvsA==",
5
+ "_integrity": "sha512-iBGhkTWsEumkoXouPSj9/1bChb4oyYYnNtgj/vx6+oCHzKHwfJ4hWivcSghHRklm5bMfRtjKzkIT69U0W9k6nw==",
6
6
  "_location": "/@syncfusion/ej2-pdf",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
@@ -22,7 +22,7 @@
22
22
  "/@syncfusion/ej2-pdfviewer"
23
23
  ],
24
24
  "_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-pdf/-/ej2-pdf-25.1.35.tgz",
25
- "_shasum": "4200e860c764ae3e2ecfff9460bf964404f6d9cc",
25
+ "_shasum": "569d9e8c30a75a1f8403aecab1ac5626a9b1ef40",
26
26
  "_spec": "@syncfusion/ej2-pdf@*",
27
27
  "_where": "/jenkins/workspace/elease-automation_release_25.1.1/packages/included",
28
28
  "author": {
@@ -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": "25.1.37",
58
+ "version": "25.1.38",
59
59
  "sideEffects": false,
60
60
  "homepage": "https://www.syncfusion.com/javascript-ui-controls"
61
61
  }
@@ -4726,8 +4726,26 @@ var PdfSquareAnnotation = /** @class */ (function (_super) {
4726
4726
  }
4727
4727
  }
4728
4728
  if (isFlatten && this._appearanceTemplate) {
4729
- var isNormalMatrix = this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);
4730
- this._flattenAnnotationTemplate(this._appearanceTemplate, isNormalMatrix);
4729
+ var appearanceDictionary = this._appearanceTemplate._content.dictionary;
4730
+ var isValid = appearanceDictionary && appearanceDictionary.has('BBox') && !appearanceDictionary.has('CropBox') && !appearanceDictionary.has('MediaBox');
4731
+ if (isValid && this.measure) {
4732
+ var graphics = this._page.graphics;
4733
+ var state = graphics.save();
4734
+ if (typeof this.opacity !== 'undefined' && this._opacity < 1) {
4735
+ graphics.setTransparency(this._opacity);
4736
+ }
4737
+ var point = this.bounds;
4738
+ var box = this._appearanceTemplate._content.dictionary.getArray('BBox');
4739
+ point.x -= box[0];
4740
+ point.y += box[1];
4741
+ graphics.drawTemplate(this._appearanceTemplate, point);
4742
+ graphics.restore(state);
4743
+ this._removeAnnotationFromPage(this._page, this);
4744
+ }
4745
+ else {
4746
+ var isNormalMatrix = this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);
4747
+ this._flattenAnnotationTemplate(this._appearanceTemplate, isNormalMatrix);
4748
+ }
4731
4749
  }
4732
4750
  if (!isFlatten && this._setAppearance && !this.measure) {
4733
4751
  var appearance = void 0;
@@ -4862,16 +4880,16 @@ var PdfSquareAnnotation = /** @class */ (function (_super) {
4862
4880
  var converter = new _PdfUnitConvertor();
4863
4881
  var value;
4864
4882
  if (this.bounds.width === this.bounds.height) {
4865
- value = this._getEqualPdfGraphicsUnit(this._unit, this._unitString);
4883
+ value = this._getEqualPdfGraphicsUnit(this.unit, this._unitString);
4866
4884
  this._unitString = value.unitString;
4867
4885
  var width = converter._convertUnits(this.bounds.width, _PdfGraphicsUnit.point, value.graphicsUnit);
4868
4886
  area = width * width;
4869
4887
  }
4870
4888
  else {
4871
- value = this._getEqualPdfGraphicsUnit(this._unit, this._unitString);
4889
+ value = this._getEqualPdfGraphicsUnit(this.unit, this._unitString);
4872
4890
  this._unitString = value.unitString;
4873
4891
  var width = converter._convertUnits(this.bounds.width, _PdfGraphicsUnit.point, value.graphicsUnit);
4874
- value = this._getEqualPdfGraphicsUnit(this._unit, this._unitString);
4892
+ value = this._getEqualPdfGraphicsUnit(this.unit, this._unitString);
4875
4893
  this._unitString = value.unitString;
4876
4894
  var height = converter._convertUnits(this.bounds.height, _PdfGraphicsUnit.point, value.graphicsUnit);
4877
4895
  area = width * height;
@@ -18,7 +18,7 @@ export declare abstract class _PdfBaseStream {
18
18
  readBlock(): void;
19
19
  reset(): void;
20
20
  moveStart(): void;
21
- getString(isHex?: boolean): string;
21
+ getString(isHex?: boolean, bytes?: Uint8Array): string;
22
22
  skip(n?: number): void;
23
23
  getBaseStreams(): _PdfBaseStream[];
24
24
  }
@@ -12,7 +12,7 @@ var __extends = (this && this.__extends) || (function () {
12
12
  };
13
13
  })();
14
14
  import { _PdfDictionary } from './pdf-primitives';
15
- import { _byteArrayToHexString } from './utils';
15
+ import { _byteArrayToHexString, _bytesToString } from './utils';
16
16
  var _PdfBaseStream = /** @class */ (function () {
17
17
  function _PdfBaseStream() {
18
18
  this._isCompress = true;
@@ -86,26 +86,16 @@ var _PdfBaseStream = /** @class */ (function () {
86
86
  _PdfBaseStream.prototype.moveStart = function () {
87
87
  return null;
88
88
  };
89
- _PdfBaseStream.prototype.getString = function (isHex) {
89
+ _PdfBaseStream.prototype.getString = function (isHex, bytes) {
90
90
  if (isHex === void 0) { isHex = false; }
91
- var bytes = this.getBytes();
92
- if (typeof bytes === 'undefined' || bytes === null || typeof bytes.length === 'undefined') {
93
- throw new Error('Invalid argument for bytesToString');
91
+ if (typeof bytes === 'undefined' || bytes === null) {
92
+ bytes = this.getBytes();
94
93
  }
95
94
  if (isHex) {
96
95
  return _byteArrayToHexString(bytes);
97
96
  }
98
97
  else {
99
- var len = bytes.length;
100
- var max = 8192;
101
- if (len < max) {
102
- return String.fromCharCode.apply(null, bytes);
103
- }
104
- var stringBuffer = [];
105
- for (var i = 0; i < len; i += max) {
106
- stringBuffer.push(String.fromCharCode.apply(null, bytes.subarray(i, Math.min(i + max, len))));
107
- }
108
- return stringBuffer.join('');
98
+ return _bytesToString(bytes);
109
99
  }
110
100
  };
111
101
  _PdfBaseStream.prototype.skip = function (n) {
@@ -14,7 +14,7 @@ var __extends = (this && this.__extends) || (function () {
14
14
  import { _ExportHelper } from './xfdf-document';
15
15
  import { _stringToAnnotationFlags, _convertToColor, _encode, _byteArrayToHexString, _stringToBytes, _annotationFlagsToString, _convertStringToBytes, _bytesToString, _hexStringToByteArray, _decode } from './../utils';
16
16
  import { _PdfDictionary, _PdfName, _PdfReference } from './../pdf-primitives';
17
- import { _PdfBaseStream, _PdfContentStream } from './../base-stream';
17
+ import { _PdfBaseStream, _PdfContentStream, _PdfStream } from './../base-stream';
18
18
  import { PdfAnnotationFlag } from './../enumerator';
19
19
  var _JsonDocument = /** @class */ (function (_super) {
20
20
  __extends(_JsonDocument, _super);
@@ -632,7 +632,19 @@ var _JsonDocument = /** @class */ (function (_super) {
632
632
  var dataTable = new Map(); // eslint-disable-line
633
633
  var streamTable = new Map(); // eslint-disable-line
634
634
  var streamDictionary = value.dictionary;
635
- var data = value.getString(true);
635
+ var data = void 0;
636
+ var baseStream = value; // eslint-disable-line
637
+ var isImageStream = false;
638
+ if (streamDictionary.has('Subtype') && streamDictionary.get('Subtype').name === 'Image') {
639
+ isImageStream = true;
640
+ }
641
+ if (isImageStream && baseStream.stream && baseStream.stream instanceof _PdfStream) {
642
+ var stream = baseStream.stream;
643
+ data = baseStream.getString(true, stream.getByteRange(stream.start, stream.end));
644
+ }
645
+ else {
646
+ data = value.getString(true);
647
+ }
636
648
  if (!streamDictionary.has('Length') && data && data !== '') {
637
649
  streamDictionary.update('Length', value.length);
638
650
  }
@@ -26,6 +26,7 @@ export declare class _PdfCrossReference {
26
26
  _encrypt: _PdfEncryptor;
27
27
  _ids: string[];
28
28
  _permissionFlags: number;
29
+ _prevXRefOffset: number;
29
30
  constructor(document: PdfDocument, password?: string);
30
31
  _setStartXRef(startXRef: number): void;
31
32
  _parse(recoveryMode: boolean): void;
@@ -21,6 +21,9 @@ var _PdfCrossReference = /** @class */ (function () {
21
21
  _PdfCrossReference.prototype._setStartXRef = function (startXRef) {
22
22
  this._startXRefQueue = [startXRef];
23
23
  this._prevStartXref = startXRef;
24
+ if (typeof this._prevXRefOffset === 'undefined' || this._prevXRefOffset === null) {
25
+ this._prevXRefOffset = startXRef;
26
+ }
24
27
  };
25
28
  _PdfCrossReference.prototype._parse = function (recoveryMode) {
26
29
  var trailerDictionary;
@@ -824,7 +827,7 @@ var _PdfCrossReference = /** @class */ (function () {
824
827
  };
825
828
  _PdfCrossReference.prototype._copyTrailer = function (newXref) {
826
829
  newXref.set('Size', this._nextReferenceNumber);
827
- newXref.set('Prev', this._prevStartXref);
830
+ this._document._isEncrypted ? newXref.set('Prev', this._prevXRefOffset) : newXref.set('Prev', this._prevStartXref);
828
831
  var root = this._trailer.getRaw('Root'); // eslint-disable-line
829
832
  if (typeof root !== 'undefined' && root !== null) {
830
833
  newXref.set('Root', root);