@syncfusion/ej2-pdf 25.1.37 → 25.1.39
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.
- package/CHANGELOG.md +14 -0
- package/dist/ej2-pdf.umd.min.js +2 -2
- package/dist/ej2-pdf.umd.min.js.map +1 -1
- package/dist/es6/ej2-pdf.es2015.js +119 -63
- package/dist/es6/ej2-pdf.es2015.js.map +1 -1
- package/dist/es6/ej2-pdf.es5.js +117 -61
- package/dist/es6/ej2-pdf.es5.js.map +1 -1
- package/dist/global/ej2-pdf.min.js +2 -2
- package/dist/global/ej2-pdf.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +5 -5
- package/src/pdf/core/annotations/annotation.js +64 -25
- package/src/pdf/core/base-stream.d.ts +1 -1
- package/src/pdf/core/base-stream.js +5 -15
- package/src/pdf/core/form/field.js +1 -2
- package/src/pdf/core/import-export/json-document.js +14 -2
- package/src/pdf/core/pdf-cross-reference.d.ts +1 -0
- package/src/pdf/core/pdf-cross-reference.js +4 -1
- package/src/pdf/core/pdf-parser.js +3 -18
- package/src/pdf/core/utils.d.ts +9 -0
- package/src/pdf/core/utils.js +28 -0
package/dist/global/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: index.d.ts
|
|
3
|
-
* version : 25.1.
|
|
3
|
+
* version : 25.1.39
|
|
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@25.1.
|
|
3
|
+
"_id": "@syncfusion/ej2-pdf@25.1.38",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "sha512-
|
|
5
|
+
"_integrity": "sha512-TYJhAacgyrKDDVj7GWxuYlc0QGj2PNnrvIVbpejaNGPocfERK/mZZ2KdJ7RsyEVXNF6MrFaV4iOf/Mc0rX9jgg==",
|
|
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.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-pdf/-/ej2-pdf-25.1.
|
|
25
|
-
"_shasum": "
|
|
24
|
+
"_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-pdf/-/ej2-pdf-25.1.38.tgz",
|
|
25
|
+
"_shasum": "ddd7622e294ff5ce770faa3bd555dfc6d274ae6f",
|
|
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.
|
|
58
|
+
"version": "25.1.39",
|
|
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
|
|
4730
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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;
|
|
@@ -8118,33 +8136,53 @@ var PdfDocumentLinkAnnotation = /** @class */ (function (_super) {
|
|
|
8118
8136
|
}
|
|
8119
8137
|
if (holder) {
|
|
8120
8138
|
var index = _getPageIndex(this._crossReference._document, this._crossReference._fetch(holder));
|
|
8121
|
-
|
|
8122
|
-
|
|
8123
|
-
|
|
8124
|
-
|
|
8125
|
-
if (mode
|
|
8126
|
-
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
|
|
8130
|
-
|
|
8131
|
-
|
|
8132
|
-
|
|
8133
|
-
|
|
8134
|
-
|
|
8135
|
-
|
|
8136
|
-
|| (typeof
|
|
8137
|
-
|
|
8139
|
+
if (index >= 0) {
|
|
8140
|
+
var page = this._crossReference._document.getPage(index);
|
|
8141
|
+
if (page && array[1] instanceof _PdfName) {
|
|
8142
|
+
var mode = array[1];
|
|
8143
|
+
if (mode) {
|
|
8144
|
+
if (mode.name === 'XYZ') {
|
|
8145
|
+
var left = array[2];
|
|
8146
|
+
var top_4 = array[3];
|
|
8147
|
+
var zoom = array[4];
|
|
8148
|
+
var topValue = (typeof top_4 !== 'undefined' && top_4 !== null) ? (page.size[1] - top_4) : 0;
|
|
8149
|
+
var leftValue = (typeof left !== 'undefined' && left !== null) ? left : 0;
|
|
8150
|
+
this._destination = new PdfDestination(page, [leftValue, topValue]);
|
|
8151
|
+
if (typeof zoom !== 'undefined' && zoom !== null) {
|
|
8152
|
+
this._destination.zoom = zoom;
|
|
8153
|
+
}
|
|
8154
|
+
if ((typeof left === 'undefined' && left === null) || (typeof top_4 === 'undefined' && top_4 === null)
|
|
8155
|
+
|| (typeof zoom === 'undefined' && zoom === null)) {
|
|
8156
|
+
this._destination._setValidation(false);
|
|
8157
|
+
}
|
|
8138
8158
|
}
|
|
8139
|
-
|
|
8140
|
-
else {
|
|
8141
|
-
if (page && mode.name === 'Fit') {
|
|
8159
|
+
else if (mode.name === 'Fit') {
|
|
8142
8160
|
this._destination = new PdfDestination(page);
|
|
8143
8161
|
this._destination.mode = PdfDestinationMode.fitToPage;
|
|
8144
8162
|
}
|
|
8145
8163
|
}
|
|
8146
8164
|
}
|
|
8147
8165
|
}
|
|
8166
|
+
else {
|
|
8167
|
+
this._destination = new PdfDestination();
|
|
8168
|
+
var zoom = array[4];
|
|
8169
|
+
var mode = array[1];
|
|
8170
|
+
if (typeof zoom !== 'undefined' && zoom !== null) {
|
|
8171
|
+
this._destination.zoom = zoom;
|
|
8172
|
+
}
|
|
8173
|
+
if (mode.name === 'Fit') {
|
|
8174
|
+
this._destination.mode = PdfDestinationMode.fitToPage;
|
|
8175
|
+
}
|
|
8176
|
+
else if (mode.name === 'XYZ') {
|
|
8177
|
+
var left = array[2];
|
|
8178
|
+
var topValue = array[3];
|
|
8179
|
+
if ((typeof left === 'undefined' && left === null) || (typeof topValue === 'undefined' && topValue === null)
|
|
8180
|
+
|| (typeof zoom === 'undefined' && zoom === null)) {
|
|
8181
|
+
this._destination._setValidation(false);
|
|
8182
|
+
}
|
|
8183
|
+
}
|
|
8184
|
+
this._destination._index = index;
|
|
8185
|
+
}
|
|
8148
8186
|
}
|
|
8149
8187
|
}
|
|
8150
8188
|
else if (this._dictionary.has('A') && !this._destination) {
|
|
@@ -9669,6 +9707,7 @@ var PdfRubberStampAnnotation = /** @class */ (function (_super) {
|
|
|
9669
9707
|
}
|
|
9670
9708
|
else if (bounds) {
|
|
9671
9709
|
templateDictionary.update('Matrix', [1, 0, 0, 1, -bounds[0], -bounds[1]]);
|
|
9710
|
+
template._size = [bounds[2], bounds[3]];
|
|
9672
9711
|
}
|
|
9673
9712
|
template._exportStream(dictionary, this._crossReference);
|
|
9674
9713
|
}
|
|
@@ -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
|
-
|
|
92
|
-
|
|
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
|
-
|
|
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) {
|
|
@@ -3101,8 +3101,7 @@ var PdfTextBoxField = /** @class */ (function (_super) {
|
|
|
3101
3101
|
}
|
|
3102
3102
|
}
|
|
3103
3103
|
parameter.bounds[2] = width;
|
|
3104
|
-
|
|
3105
|
-
this._drawTextBox(g, parameter, text, font, format, multiline, scroll);
|
|
3104
|
+
this._drawTextBox(g, parameter, text, font, new PdfStringFormat(PdfTextAlignment.center), multiline, scroll);
|
|
3106
3105
|
parameter.bounds[0] = parameter.bounds[0] + width;
|
|
3107
3106
|
if (parameter.borderWidth) {
|
|
3108
3107
|
g.drawLine(parameter.borderPen, parameter.bounds[0], parameter.bounds[1], parameter.bounds[0], parameter.bounds[1] + parameter.bounds[3]);
|
|
@@ -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 =
|
|
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.
|
|
830
|
+
newXref.set('Prev', this._prevXRefOffset);
|
|
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);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _PdfCommand, _PdfName, _PdfDictionary, _isCommand, _PdfReference, _isName } from './pdf-primitives';
|
|
2
|
-
import { _isWhiteSpace,
|
|
2
|
+
import { _isWhiteSpace, FormatError, ParserEndOfFileException, _decodeText } from './utils';
|
|
3
3
|
import { _PdfNullStream } from './base-stream';
|
|
4
4
|
import { PdfPredictorStream } from './predictor-stream';
|
|
5
5
|
import { _PdfFlateStream } from './flate-stream';
|
|
@@ -500,6 +500,7 @@ var _PdfParser = /** @class */ (function () {
|
|
|
500
500
|
if (array.length === 0 && _isName(entry, 'Indexed')) {
|
|
501
501
|
this._isColorSpace = true;
|
|
502
502
|
}
|
|
503
|
+
entry = _decodeText(entry, this._isColorSpace, this._isPassword);
|
|
503
504
|
array.push(entry);
|
|
504
505
|
}
|
|
505
506
|
if (this.first === endOfFile) {
|
|
@@ -528,23 +529,7 @@ var _PdfParser = /** @class */ (function () {
|
|
|
528
529
|
break;
|
|
529
530
|
}
|
|
530
531
|
var value = this.getObject(cipherTransform); // eslint-disable-line
|
|
531
|
-
|
|
532
|
-
if (value.startsWith('þÿ')) {
|
|
533
|
-
value = value.substring(2);
|
|
534
|
-
if (value.endsWith('ÿý')) {
|
|
535
|
-
value = value.substring(0, value.length - 2);
|
|
536
|
-
}
|
|
537
|
-
var bytes = _stringToBytes(value);
|
|
538
|
-
var result = '';
|
|
539
|
-
for (var i = 0; i < bytes.length; i += 2) {
|
|
540
|
-
var x = bytes[Number.parseInt(i.toString(), 10)] << 8;
|
|
541
|
-
var y = bytes[Number.parseInt((i + 1).toString(), 10)];
|
|
542
|
-
var codeUnit = x | y;
|
|
543
|
-
result += String.fromCharCode(codeUnit);
|
|
544
|
-
}
|
|
545
|
-
value = result;
|
|
546
|
-
}
|
|
547
|
-
}
|
|
532
|
+
value = _decodeText(value, this._isColorSpace, this._isPassword);
|
|
548
533
|
this._isPassword = false;
|
|
549
534
|
dictionary.set(key, value);
|
|
550
535
|
}
|
package/src/pdf/core/utils.d.ts
CHANGED
|
@@ -749,3 +749,12 @@ export declare function _obtainDestination(dictionary: _PdfDictionary, key: stri
|
|
|
749
749
|
* @returns {number[]} bounds.
|
|
750
750
|
*/
|
|
751
751
|
export declare function _updateBounds(annotation: PdfAnnotation, bounds?: number[]): number[];
|
|
752
|
+
/**
|
|
753
|
+
* Decode text.
|
|
754
|
+
*
|
|
755
|
+
* @param {string} text Text to decode.
|
|
756
|
+
* @param {boolean} isColorSpace Color space or not
|
|
757
|
+
* @param {boolean} isPassword Password or not
|
|
758
|
+
* @returns {string} Decoded text.
|
|
759
|
+
*/
|
|
760
|
+
export declare function _decodeText(text: string, isColorSpace: boolean, isPassword: boolean): string;
|
package/src/pdf/core/utils.js
CHANGED
|
@@ -3929,3 +3929,31 @@ export function _updateBounds(annotation, bounds) {
|
|
|
3929
3929
|
}
|
|
3930
3930
|
return rect;
|
|
3931
3931
|
}
|
|
3932
|
+
/**
|
|
3933
|
+
* Decode text.
|
|
3934
|
+
*
|
|
3935
|
+
* @param {string} text Text to decode.
|
|
3936
|
+
* @param {boolean} isColorSpace Color space or not
|
|
3937
|
+
* @param {boolean} isPassword Password or not
|
|
3938
|
+
* @returns {string} Decoded text.
|
|
3939
|
+
*/
|
|
3940
|
+
export function _decodeText(text, isColorSpace, isPassword) {
|
|
3941
|
+
if (text && typeof text === 'string' && !isColorSpace && !isPassword) {
|
|
3942
|
+
if (text.startsWith('þÿ')) {
|
|
3943
|
+
text = text.substring(2);
|
|
3944
|
+
if (text.endsWith('ÿý')) {
|
|
3945
|
+
text = text.substring(0, text.length - 2);
|
|
3946
|
+
}
|
|
3947
|
+
var bytes = _stringToBytes(text);
|
|
3948
|
+
var result = '';
|
|
3949
|
+
for (var i = 0; i < bytes.length; i += 2) {
|
|
3950
|
+
var x = bytes[Number.parseInt(i.toString(), 10)] << 8;
|
|
3951
|
+
var y = bytes[Number.parseInt((i + 1).toString(), 10)];
|
|
3952
|
+
var codeUnit = x | y;
|
|
3953
|
+
result += String.fromCharCode(codeUnit);
|
|
3954
|
+
}
|
|
3955
|
+
text = result;
|
|
3956
|
+
}
|
|
3957
|
+
}
|
|
3958
|
+
return text;
|
|
3959
|
+
}
|