@syncfusion/ej2-pdf 25.1.40 → 25.1.42
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 +16 -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 +174 -46
- package/dist/es6/ej2-pdf.es2015.js.map +1 -1
- package/dist/es6/ej2-pdf.es5.js +176 -45
- 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/import-export/json-document.d.ts +1 -0
- package/src/pdf/core/import-export/json-document.js +32 -8
- package/src/pdf/core/import-export/xfdf-document.js +2 -2
- package/src/pdf/core/pdf-cross-reference.d.ts +1 -0
- package/src/pdf/core/pdf-cross-reference.js +46 -3
- package/src/pdf/core/security/encryptor.js +10 -10
- package/src/pdf/core/utils.d.ts +20 -13
- package/src/pdf/core/utils.js +87 -23
package/dist/es6/ej2-pdf.es5.js
CHANGED
|
@@ -11678,7 +11678,7 @@ var _XfdfDocument = /** @__PURE__ @class */ (function (_super) {
|
|
|
11678
11678
|
this._document = document;
|
|
11679
11679
|
this._crossReference = document._crossReference;
|
|
11680
11680
|
this._isAnnotationExport = false;
|
|
11681
|
-
var xml = _bytesToString(data);
|
|
11681
|
+
var xml = _bytesToString(data, true);
|
|
11682
11682
|
this._xmlDocument = (new DOMParser()).parseFromString(xml, 'text/xml');
|
|
11683
11683
|
this._isAnnotationImport = true;
|
|
11684
11684
|
this._readXmlData(this._xmlDocument.documentElement);
|
|
@@ -11687,7 +11687,7 @@ var _XfdfDocument = /** @__PURE__ @class */ (function (_super) {
|
|
|
11687
11687
|
this._document = document;
|
|
11688
11688
|
this._crossReference = document._crossReference;
|
|
11689
11689
|
this._isAnnotationExport = false;
|
|
11690
|
-
this._xmlDocument = (new DOMParser()).parseFromString(_bytesToString(data), 'text/xml');
|
|
11690
|
+
this._xmlDocument = (new DOMParser()).parseFromString(_bytesToString(data, true), 'text/xml');
|
|
11691
11691
|
this._readXmlData(this._xmlDocument.documentElement);
|
|
11692
11692
|
};
|
|
11693
11693
|
_XfdfDocument.prototype._readXmlData = function (root) {
|
|
@@ -13002,6 +13002,7 @@ var _JsonDocument = /** @__PURE__ @class */ (function (_super) {
|
|
|
13002
13002
|
function _JsonDocument(fileName) {
|
|
13003
13003
|
var _this = _super.call(this) || this;
|
|
13004
13004
|
_this._isImport = false;
|
|
13005
|
+
_this._isColorSpace = false;
|
|
13005
13006
|
if (fileName !== null && typeof fileName !== 'undefined') {
|
|
13006
13007
|
_this._fileName = fileName;
|
|
13007
13008
|
}
|
|
@@ -13049,9 +13050,7 @@ var _JsonDocument = /** @__PURE__ @class */ (function (_super) {
|
|
|
13049
13050
|
if (typeof value === 'string' || (Array.isArray(value) && value.length === 1)) {
|
|
13050
13051
|
value = _this._getValidString(typeof value === 'string' ? value : value[0]);
|
|
13051
13052
|
_this._jsonData.push(_this._doubleQuotes, _this._colon, _this._doubleQuotes);
|
|
13052
|
-
|
|
13053
|
-
_this._jsonData.push(value.charCodeAt(i));
|
|
13054
|
-
}
|
|
13053
|
+
_this._jsonData = _stringToBytes(value, true, false, _this._jsonData);
|
|
13055
13054
|
_this._jsonData.push(_this._doubleQuotes);
|
|
13056
13055
|
}
|
|
13057
13056
|
else {
|
|
@@ -13084,7 +13083,7 @@ var _JsonDocument = /** @__PURE__ @class */ (function (_super) {
|
|
|
13084
13083
|
var page = document.getPage(i);
|
|
13085
13084
|
if (page && page.annotations.count > 0) {
|
|
13086
13085
|
this._jsonData.push(i !== 0 && isAnnotationAdded ? this._comma : this._space, this._doubleQuotes);
|
|
13087
|
-
var pageNumber =
|
|
13086
|
+
var pageNumber = _stringToBytes(i.toString(), true, false, []);
|
|
13088
13087
|
pageNumber.forEach(function (entry) {
|
|
13089
13088
|
_this._jsonData.push(entry);
|
|
13090
13089
|
});
|
|
@@ -13100,7 +13099,7 @@ var _JsonDocument = /** @__PURE__ @class */ (function (_super) {
|
|
|
13100
13099
|
}
|
|
13101
13100
|
count++;
|
|
13102
13101
|
this._exportAnnotation(annotation, i);
|
|
13103
|
-
this._jsonData =
|
|
13102
|
+
this._jsonData = _stringToBytes(this._convertToJson(this._table), true, false, this._jsonData);
|
|
13104
13103
|
this._table.clear();
|
|
13105
13104
|
}
|
|
13106
13105
|
}
|
|
@@ -13587,16 +13586,31 @@ var _JsonDocument = /** @__PURE__ @class */ (function (_super) {
|
|
|
13587
13586
|
}
|
|
13588
13587
|
};
|
|
13589
13588
|
_JsonDocument.prototype._writeObject = function (table, value, dictionary, key, array) {
|
|
13589
|
+
var _this = this;
|
|
13590
13590
|
if (value instanceof _PdfName) {
|
|
13591
13591
|
this._writeTable('name', value.name, table, key, array);
|
|
13592
13592
|
}
|
|
13593
13593
|
else if (Array.isArray(value)) {
|
|
13594
13594
|
var list = [];
|
|
13595
|
+
if (key === 'ColorSpace') {
|
|
13596
|
+
value.forEach(function (element) {
|
|
13597
|
+
if (typeof element === 'string') {
|
|
13598
|
+
_this._isColorSpace = true;
|
|
13599
|
+
}
|
|
13600
|
+
});
|
|
13601
|
+
}
|
|
13595
13602
|
this._writeArray(list, value, dictionary);
|
|
13603
|
+
this._isColorSpace = false;
|
|
13596
13604
|
this._writeTable('array', this._convertToJsonArray(list), table, key, array);
|
|
13597
13605
|
}
|
|
13598
13606
|
else if (typeof value === 'string') {
|
|
13599
|
-
this.
|
|
13607
|
+
if (this._isColorSpace) {
|
|
13608
|
+
var bytes = _stringToBytes(value);
|
|
13609
|
+
this._writeTable('unicodeData', _byteArrayToHexString(bytes), table, key, array);
|
|
13610
|
+
}
|
|
13611
|
+
else {
|
|
13612
|
+
this._writeTable('string', value, table, key, array);
|
|
13613
|
+
}
|
|
13600
13614
|
}
|
|
13601
13615
|
else if (typeof value === 'number') {
|
|
13602
13616
|
this._writeTable(Number.isInteger(value) ? 'int' : 'fixed', value.toString(), table, key, array);
|
|
@@ -13623,6 +13637,13 @@ var _JsonDocument = /** @__PURE__ @class */ (function (_super) {
|
|
|
13623
13637
|
var stream = baseStream.stream;
|
|
13624
13638
|
data = baseStream.getString(true, stream.getByteRange(stream.start, stream.end));
|
|
13625
13639
|
}
|
|
13640
|
+
else if (baseStream.stream && baseStream.stream.stream) {
|
|
13641
|
+
var flateStream = baseStream.stream; // eslint-disable-line
|
|
13642
|
+
if (flateStream.stream && flateStream.stream instanceof _PdfStream) {
|
|
13643
|
+
var stream = flateStream.stream;
|
|
13644
|
+
data = flateStream.getString(true, stream.getByteRange(stream.start, stream.end));
|
|
13645
|
+
}
|
|
13646
|
+
}
|
|
13626
13647
|
else {
|
|
13627
13648
|
data = value.getString(true);
|
|
13628
13649
|
}
|
|
@@ -13711,7 +13732,7 @@ var _JsonDocument = /** @__PURE__ @class */ (function (_super) {
|
|
|
13711
13732
|
_JsonDocument.prototype._parseJson = function (document, data) {
|
|
13712
13733
|
this._document = document;
|
|
13713
13734
|
this._crossReference = document._crossReference;
|
|
13714
|
-
var stringData = _bytesToString(data);
|
|
13735
|
+
var stringData = _bytesToString(data, true);
|
|
13715
13736
|
if (stringData.startsWith('{') && !stringData.endsWith('}')) {
|
|
13716
13737
|
while (stringData.length > 0 && !stringData.endsWith('}')) {
|
|
13717
13738
|
stringData = stringData.substring(0, stringData.length - 1);
|
|
@@ -14467,6 +14488,9 @@ var _JsonDocument = /** @__PURE__ @class */ (function (_super) {
|
|
|
14467
14488
|
stream.dictionary.objId = value.objectNumber + ' ' + value.generationNumber;
|
|
14468
14489
|
this._crossReference._cacheMap.set(value, stream);
|
|
14469
14490
|
}
|
|
14491
|
+
else if (keys.indexOf('unicodeData') !== -1) {
|
|
14492
|
+
value = _bytesToString(_hexStringToByteArray(element.unicodeData, false));
|
|
14493
|
+
}
|
|
14470
14494
|
else {
|
|
14471
14495
|
value = null;
|
|
14472
14496
|
}
|
|
@@ -41116,30 +41140,48 @@ function _stringToPdfString(value) {
|
|
|
41116
41140
|
*
|
|
41117
41141
|
* @private
|
|
41118
41142
|
* @param {string} value string value.
|
|
41119
|
-
* @param {boolean} isDirect Whether to return
|
|
41120
|
-
* @
|
|
41143
|
+
* @param {boolean} isDirect Whether to return a number[] or Uint8Array.
|
|
41144
|
+
* @param {boolean} isPassword Whether the string is a password.
|
|
41145
|
+
* @returns {number[] | Uint8Array} Byte array
|
|
41121
41146
|
*/
|
|
41122
|
-
function _stringToBytes(value, isDirect) {
|
|
41147
|
+
function _stringToBytes(value, isDirect, isPassword, destination) {
|
|
41123
41148
|
if (isDirect === void 0) { isDirect = false; }
|
|
41149
|
+
if (isPassword === void 0) { isPassword = false; }
|
|
41124
41150
|
var bytes = [];
|
|
41125
|
-
|
|
41126
|
-
bytes
|
|
41151
|
+
if (destination) {
|
|
41152
|
+
bytes = destination;
|
|
41127
41153
|
}
|
|
41128
|
-
|
|
41129
|
-
|
|
41130
|
-
|
|
41131
|
-
|
|
41132
|
-
*
|
|
41133
|
-
* @private
|
|
41134
|
-
* @param {string} value string value.
|
|
41135
|
-
* @param {number[]} destination byte array.
|
|
41136
|
-
* @returns {number[]} Byte array
|
|
41137
|
-
*/
|
|
41138
|
-
function _convertStringToBytes(value, destination) {
|
|
41139
|
-
for (var i = 0; i < value.length; ++i) {
|
|
41140
|
-
destination.push(value.charCodeAt(i) & 0xff);
|
|
41154
|
+
if (isPassword) {
|
|
41155
|
+
for (var i = 0; i < value.length; i++) {
|
|
41156
|
+
bytes.push(value.charCodeAt(i));
|
|
41157
|
+
}
|
|
41141
41158
|
}
|
|
41142
|
-
|
|
41159
|
+
else {
|
|
41160
|
+
for (var i = 0; i < value.length; i++) {
|
|
41161
|
+
var charCode = value.charCodeAt(i);
|
|
41162
|
+
if (charCode < 0x80) {
|
|
41163
|
+
bytes.push(charCode);
|
|
41164
|
+
}
|
|
41165
|
+
else if (charCode < 0x800) {
|
|
41166
|
+
bytes.push((charCode >> 6) | 0xC0);
|
|
41167
|
+
bytes.push((charCode & 0x3F) | 0x80);
|
|
41168
|
+
}
|
|
41169
|
+
else if (charCode < 0xD800 || charCode >= 0xE000) {
|
|
41170
|
+
bytes.push((charCode >> 12) | 0xE0);
|
|
41171
|
+
bytes.push(((charCode >> 6) & 0x3F) | 0x80);
|
|
41172
|
+
bytes.push((charCode & 0x3F) | 0x80);
|
|
41173
|
+
}
|
|
41174
|
+
else {
|
|
41175
|
+
i++;
|
|
41176
|
+
charCode = 0x10000 + (((charCode & 0x3FF) << 10) | (value.charCodeAt(i) & 0x3FF));
|
|
41177
|
+
bytes.push((charCode >> 18) | 0xF0);
|
|
41178
|
+
bytes.push(((charCode >> 12) & 0x3F) | 0x80);
|
|
41179
|
+
bytes.push(((charCode >> 6) & 0x3F) | 0x80);
|
|
41180
|
+
bytes.push((charCode & 0x3F) | 0x80);
|
|
41181
|
+
}
|
|
41182
|
+
}
|
|
41183
|
+
}
|
|
41184
|
+
return isDirect ? bytes : new Uint8Array(bytes);
|
|
41143
41185
|
}
|
|
41144
41186
|
/**
|
|
41145
41187
|
* Check equal or not.
|
|
@@ -41201,20 +41243,49 @@ function _areNotEqual(value, current) {
|
|
|
41201
41243
|
* @param {Uint8Array} bytes Input data.
|
|
41202
41244
|
* @returns {string} String value processed from input bytes.
|
|
41203
41245
|
*/
|
|
41204
|
-
function _bytesToString(bytes) {
|
|
41246
|
+
function _bytesToString(bytes, isJson) {
|
|
41247
|
+
if (isJson === void 0) { isJson = false; }
|
|
41205
41248
|
var length = bytes.length;
|
|
41206
41249
|
var max = 8192;
|
|
41250
|
+
var stringBuffer = [];
|
|
41207
41251
|
if (length < max) {
|
|
41208
|
-
return String.fromCharCode.apply(null, bytes);
|
|
41252
|
+
return (isJson ? _decodeUTF8(bytes) : String.fromCharCode.apply(null, bytes));
|
|
41209
41253
|
}
|
|
41210
|
-
var stringBuffer = [];
|
|
41211
41254
|
for (var i = 0; i < length; i += max) {
|
|
41212
41255
|
var chunkEnd = Math.min(i + max, length);
|
|
41213
41256
|
var chunk = bytes.subarray(i, chunkEnd);
|
|
41214
|
-
stringBuffer.push(String.fromCharCode.apply(null, chunk));
|
|
41257
|
+
stringBuffer.push(isJson ? _decodeUTF8(chunk) : String.fromCharCode.apply(null, chunk));
|
|
41215
41258
|
}
|
|
41216
41259
|
return stringBuffer.join('');
|
|
41217
41260
|
}
|
|
41261
|
+
/**
|
|
41262
|
+
* Decode unicode string.
|
|
41263
|
+
*
|
|
41264
|
+
* @private
|
|
41265
|
+
* @param {Uint8Array} bytes Input data.
|
|
41266
|
+
* @returns {string} String value processed from input bytes.
|
|
41267
|
+
*/
|
|
41268
|
+
function _decodeUTF8(bytes) {
|
|
41269
|
+
var result = '';
|
|
41270
|
+
var i = 0;
|
|
41271
|
+
while (i < bytes.length) {
|
|
41272
|
+
var byte = bytes[i++];
|
|
41273
|
+
if (byte < 0x80) {
|
|
41274
|
+
result += String.fromCharCode(byte);
|
|
41275
|
+
}
|
|
41276
|
+
else if (byte < 0xE0) {
|
|
41277
|
+
result += String.fromCharCode(((byte & 0x1F) << 6) | (bytes[i++] & 0x3F));
|
|
41278
|
+
}
|
|
41279
|
+
else if (byte < 0xF0) {
|
|
41280
|
+
result += String.fromCharCode(((byte & 0x0F) << 12) | ((bytes[i++] & 0x3F) << 6) | (bytes[i++] & 0x3F));
|
|
41281
|
+
}
|
|
41282
|
+
else {
|
|
41283
|
+
var codePoint = ((byte & 0x07) << 18) | ((bytes[i++] & 0x3F) << 12) | ((bytes[i++] & 0x3F) << 6) | (bytes[i++] & 0x3F) - 0x10000;
|
|
41284
|
+
result += String.fromCharCode((codePoint >> 10) + 0xD800, (codePoint & 0x03FF) + 0xDC00);
|
|
41285
|
+
}
|
|
41286
|
+
}
|
|
41287
|
+
return result;
|
|
41288
|
+
}
|
|
41218
41289
|
/**
|
|
41219
41290
|
* Convert string to unicode array.
|
|
41220
41291
|
*
|
|
@@ -44834,6 +44905,23 @@ function _getSize(input) {
|
|
|
44834
44905
|
}
|
|
44835
44906
|
return size;
|
|
44836
44907
|
}
|
|
44908
|
+
/**
|
|
44909
|
+
* Convert the string to big endian bytes.
|
|
44910
|
+
*
|
|
44911
|
+
* @param {string} input string.
|
|
44912
|
+
* @returns {number[]} bytes.
|
|
44913
|
+
*/
|
|
44914
|
+
function _stringToBigEndianBytes(input) {
|
|
44915
|
+
var bytes = [];
|
|
44916
|
+
for (var i = 0; i < input.length; i++) {
|
|
44917
|
+
var charCode = input.charCodeAt(Number.parseInt(i.toString(), 10));
|
|
44918
|
+
if (charCode <= 0xFFFF) {
|
|
44919
|
+
bytes.push((charCode >> 8) & 0xFF);
|
|
44920
|
+
bytes.push(charCode & 0xFF);
|
|
44921
|
+
}
|
|
44922
|
+
}
|
|
44923
|
+
return bytes;
|
|
44924
|
+
}
|
|
44837
44925
|
|
|
44838
44926
|
/* eslint-disable */
|
|
44839
44927
|
var nameCache = Object.create(null);
|
|
@@ -47781,12 +47869,12 @@ var _PdfEncryptor = /** @__PURE__ @class */ (function () {
|
|
|
47781
47869
|
if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
|
|
47782
47870
|
throw new FormatError('invalid key length');
|
|
47783
47871
|
}
|
|
47784
|
-
var ownerPassword = _stringToBytes(dictionary.get('O')).subarray(0, 32);
|
|
47785
|
-
var userPassword = _stringToBytes(dictionary.get('U')).subarray(0, 32);
|
|
47872
|
+
var ownerPassword = _stringToBytes(dictionary.get('O'), false, true).subarray(0, 32);
|
|
47873
|
+
var userPassword = _stringToBytes(dictionary.get('U'), false, true).subarray(0, 32);
|
|
47786
47874
|
var flag = dictionary.get('P');
|
|
47787
47875
|
var revision = dictionary.get('R');
|
|
47788
47876
|
this._encryptMetaData = (algorithm === 4 || algorithm === 5) && dictionary.get('EncryptMetadata') !== false;
|
|
47789
|
-
var fileIdBytes = _stringToBytes(id);
|
|
47877
|
+
var fileIdBytes = _stringToBytes(id, false, true);
|
|
47790
47878
|
var passwordBytes;
|
|
47791
47879
|
if (password) {
|
|
47792
47880
|
if (revision === 6) {
|
|
@@ -47809,15 +47897,15 @@ var _PdfEncryptor = /** @__PURE__ @class */ (function () {
|
|
|
47809
47897
|
}
|
|
47810
47898
|
}
|
|
47811
47899
|
else {
|
|
47812
|
-
var ownerValidationKey = _stringToBytes(dictionary.get('O'));
|
|
47900
|
+
var ownerValidationKey = _stringToBytes(dictionary.get('O'), false, true);
|
|
47813
47901
|
var ownerValidationSalt = ownerValidationKey.subarray(32, 40);
|
|
47814
47902
|
var ownerKeySalt = ownerValidationKey.subarray(40, 48);
|
|
47815
|
-
var userValidationKey = _stringToBytes(dictionary.get('U'));
|
|
47903
|
+
var userValidationKey = _stringToBytes(dictionary.get('U'), false, true);
|
|
47816
47904
|
var uBytes = userValidationKey.subarray(0, 48);
|
|
47817
47905
|
var userValidationSalt = userValidationKey.subarray(32, 40);
|
|
47818
47906
|
var userKeySalt = userValidationKey.subarray(40, 48);
|
|
47819
|
-
var ownerEncryption = _stringToBytes(dictionary.get('OE'));
|
|
47820
|
-
var userEncryption = _stringToBytes(dictionary.get('UE'));
|
|
47907
|
+
var ownerEncryption = _stringToBytes(dictionary.get('OE'), false, true);
|
|
47908
|
+
var userEncryption = _stringToBytes(dictionary.get('UE'), false, true);
|
|
47821
47909
|
var algorithm_1;
|
|
47822
47910
|
if (revision === 6) {
|
|
47823
47911
|
algorithm_1 = new _AdvancedEncryption();
|
|
@@ -49302,7 +49390,7 @@ var _CipherTransform = /** @__PURE__ @class */ (function () {
|
|
|
49302
49390
|
return new _PdfDecryptStream(stream, length, this._streamCipher);
|
|
49303
49391
|
};
|
|
49304
49392
|
_CipherTransform.prototype.decryptString = function (s) {
|
|
49305
|
-
return _bytesToString(this._stringCipher._decryptBlock(_stringToBytes(s), true));
|
|
49393
|
+
return _bytesToString(this._stringCipher._decryptBlock(_stringToBytes(s, false, true), true));
|
|
49306
49394
|
};
|
|
49307
49395
|
_CipherTransform.prototype.encryptString = function (s) {
|
|
49308
49396
|
if (this._stringCipher instanceof _AdvancedEncryptionBaseCipher) {
|
|
@@ -49318,13 +49406,13 @@ var _CipherTransform = /** @__PURE__ @class */ (function () {
|
|
|
49318
49406
|
iv[Number.parseInt(i.toString(), 10)] = Math.floor(256 * Math.random());
|
|
49319
49407
|
}
|
|
49320
49408
|
}
|
|
49321
|
-
var data = this._stringCipher._encrypt(_stringToBytes(s), iv);
|
|
49409
|
+
var data = this._stringCipher._encrypt(_stringToBytes(s, false, true), iv);
|
|
49322
49410
|
var buffer = new Uint8Array(16 + data.length);
|
|
49323
49411
|
buffer.set(iv);
|
|
49324
49412
|
buffer.set(data, 16);
|
|
49325
49413
|
return _bytesToString(buffer);
|
|
49326
49414
|
}
|
|
49327
|
-
return _bytesToString(this._stringCipher._encrypt(_stringToBytes(s)));
|
|
49415
|
+
return _bytesToString(this._stringCipher._encrypt(_stringToBytes(s, false, true)));
|
|
49328
49416
|
};
|
|
49329
49417
|
return _CipherTransform;
|
|
49330
49418
|
}());
|
|
@@ -50065,7 +50153,7 @@ var _PdfCrossReference = /** @__PURE__ @class */ (function () {
|
|
|
50065
50153
|
}
|
|
50066
50154
|
this._writeObject(archiveStream, buffer, archiveRef, cipher_2);
|
|
50067
50155
|
}
|
|
50068
|
-
var formatValue = Math.max(_getSize(this._stream.bytes.length), _getSize(this._nextReferenceNumber));
|
|
50156
|
+
var formatValue = Math.max(_getSize(this._stream.bytes.length + buffer.length), _getSize(this._nextReferenceNumber));
|
|
50069
50157
|
var newRef = this._getNextReference();
|
|
50070
50158
|
var newStartXref = currentLength + buffer.length;
|
|
50071
50159
|
var newXref = new _PdfDictionary(this);
|
|
@@ -50302,7 +50390,19 @@ var _PdfCrossReference = /** @__PURE__ @class */ (function () {
|
|
|
50302
50390
|
if (!isCrossReference && transform) {
|
|
50303
50391
|
value = transform.encryptString(value);
|
|
50304
50392
|
}
|
|
50305
|
-
|
|
50393
|
+
var isUnicode = false;
|
|
50394
|
+
for (var i = 0; i < value.length; i++) {
|
|
50395
|
+
if (value.charCodeAt([i]) > 255) {
|
|
50396
|
+
isUnicode = true;
|
|
50397
|
+
break;
|
|
50398
|
+
}
|
|
50399
|
+
}
|
|
50400
|
+
if (isUnicode) {
|
|
50401
|
+
this._writeUnicodeString(value, buffer);
|
|
50402
|
+
}
|
|
50403
|
+
else {
|
|
50404
|
+
this._writeString("(" + this._escapeString(value) + ")", buffer);
|
|
50405
|
+
}
|
|
50306
50406
|
}
|
|
50307
50407
|
else if (typeof value === 'number') {
|
|
50308
50408
|
this._writeString(_numberToString(value), buffer);
|
|
@@ -50320,6 +50420,37 @@ var _PdfCrossReference = /** @__PURE__ @class */ (function () {
|
|
|
50320
50420
|
this._writeString('null', buffer);
|
|
50321
50421
|
}
|
|
50322
50422
|
};
|
|
50423
|
+
_PdfCrossReference.prototype._writeUnicodeString = function (value, buffer) {
|
|
50424
|
+
var byteValues = _stringToBigEndianBytes(value);
|
|
50425
|
+
byteValues.unshift(254, 255);
|
|
50426
|
+
var data = [];
|
|
50427
|
+
for (var i = 0; i < byteValues.length; i++) {
|
|
50428
|
+
var byte = byteValues[Number.parseInt(i.toString(), 10)];
|
|
50429
|
+
switch (byte) {
|
|
50430
|
+
case 40:
|
|
50431
|
+
case 41:
|
|
50432
|
+
data.push(92);
|
|
50433
|
+
data.push(byte);
|
|
50434
|
+
break;
|
|
50435
|
+
case 13:
|
|
50436
|
+
data.push(92);
|
|
50437
|
+
data.push(114);
|
|
50438
|
+
break;
|
|
50439
|
+
case 92:
|
|
50440
|
+
data.push(92);
|
|
50441
|
+
data.push(byte);
|
|
50442
|
+
break;
|
|
50443
|
+
default:
|
|
50444
|
+
data.push(byte);
|
|
50445
|
+
break;
|
|
50446
|
+
}
|
|
50447
|
+
}
|
|
50448
|
+
buffer.push('('.charCodeAt(0) & 0xff);
|
|
50449
|
+
for (var i = 0; i < data.length; i++) {
|
|
50450
|
+
buffer.push(data[Number.parseInt(i.toString(), 10)] & 0xff);
|
|
50451
|
+
}
|
|
50452
|
+
buffer.push(')'.charCodeAt(0) & 0xff);
|
|
50453
|
+
};
|
|
50323
50454
|
_PdfCrossReference.prototype._writeString = function (value, buffer) {
|
|
50324
50455
|
for (var i = 0; i < value.length; i++) {
|
|
50325
50456
|
buffer.push(value.charCodeAt(i) & 0xff);
|
|
@@ -54961,5 +55092,5 @@ var PdfBitmap = /** @__PURE__ @class */ (function (_super) {
|
|
|
54961
55092
|
return PdfBitmap;
|
|
54962
55093
|
}(PdfImage));
|
|
54963
55094
|
|
|
54964
|
-
export { _PdfBaseStream, _PdfStream, _PdfContentStream, _PdfNullStream, _ContentParser, _ContentLexer, _PdfRecord, _PdfDecodeStream, _PdfDecryptStream, PdfAnnotationFlag, PdfLineEndingStyle, PdfLineIntent, PdfLineCaptionType, PdfBorderStyle, PdfBorderEffectStyle, PdfRotationAngle, PdfCrossReferenceType, PdfHighlightMode, PdfTextAlignment, PdfFormFieldVisibility, PdfMeasurementUnit, PdfCircleMeasurementType, PdfRubberStampAnnotationIcon, PdfCheckBoxStyle, PdfTextMarkupAnnotationType, PdfPopupIcon, PdfAnnotationState, PdfAnnotationStateModel, PdfAttachmentIcon, PdfAnnotationIntent, PdfDestinationMode, DataFormat, PdfFormFieldsTabOrder, _PdfAnnotationType, _PdfGraphicsUnit, _FieldFlag, _SignatureFlag, _PdfCheckFieldState, PdfPermissionFlag, PdfPageOrientation, PdfTextDirection, PdfSubSuperScript, PdfBlendMode, PdfFillMode, PdfDashStyle, PdfLineCap, PdfLineJoin, _PdfWordWrapType, _FontDescriptorFlag, _TrueTypeCmapFormat, _TrueTypeCmapEncoding, _TrueTypePlatformID, _TrueTypeMicrosoftEncodingID, _TrueTypeMacintoshEncodingID, _TrueTypeCompositeGlyphFlag, _ImageFormat, _TokenType, PdfTextStyle, _PdfColorSpace, _PdfFlateStream, _PdfCatalog, _PdfCrossReference, PdfDocument, PdfAnnotationExportSettings, PdfFormFieldExportSettings, PdfPageSettings, PdfMargins, PdfFileStructure, PdfPage, PdfDestination, PdfBookmarkBase, PdfBookmark, PdfNamedDestination, _PdfNamedDestinationCollection, _PdfLexicalOperator, _PdfParser, _Linearization, _PdfName, _PdfCommand, _PdfReference, _PdfReferenceSet, _PdfReferenceSetCache, Dictionary, _PdfDictionary, _PdfNull, _clearPrimitiveCaches, _isName, _isCommand, PdfPredictorStream, _toUnsigned, _toSigned16, _toSigned32, _copyRange, _checkType, _getDecoder, _checkRotation, _getPageIndex, _annotationFlagsToString, _stringToAnnotationFlags, _stringToPdfString, _stringToBytes,
|
|
55095
|
+
export { _PdfBaseStream, _PdfStream, _PdfContentStream, _PdfNullStream, _ContentParser, _ContentLexer, _PdfRecord, _PdfDecodeStream, _PdfDecryptStream, PdfAnnotationFlag, PdfLineEndingStyle, PdfLineIntent, PdfLineCaptionType, PdfBorderStyle, PdfBorderEffectStyle, PdfRotationAngle, PdfCrossReferenceType, PdfHighlightMode, PdfTextAlignment, PdfFormFieldVisibility, PdfMeasurementUnit, PdfCircleMeasurementType, PdfRubberStampAnnotationIcon, PdfCheckBoxStyle, PdfTextMarkupAnnotationType, PdfPopupIcon, PdfAnnotationState, PdfAnnotationStateModel, PdfAttachmentIcon, PdfAnnotationIntent, PdfDestinationMode, DataFormat, PdfFormFieldsTabOrder, _PdfAnnotationType, _PdfGraphicsUnit, _FieldFlag, _SignatureFlag, _PdfCheckFieldState, PdfPermissionFlag, PdfPageOrientation, PdfTextDirection, PdfSubSuperScript, PdfBlendMode, PdfFillMode, PdfDashStyle, PdfLineCap, PdfLineJoin, _PdfWordWrapType, _FontDescriptorFlag, _TrueTypeCmapFormat, _TrueTypeCmapEncoding, _TrueTypePlatformID, _TrueTypeMicrosoftEncodingID, _TrueTypeMacintoshEncodingID, _TrueTypeCompositeGlyphFlag, _ImageFormat, _TokenType, PdfTextStyle, _PdfColorSpace, _PdfFlateStream, _PdfCatalog, _PdfCrossReference, PdfDocument, PdfAnnotationExportSettings, PdfFormFieldExportSettings, PdfPageSettings, PdfMargins, PdfFileStructure, PdfPage, PdfDestination, PdfBookmarkBase, PdfBookmark, PdfNamedDestination, _PdfNamedDestinationCollection, _PdfLexicalOperator, _PdfParser, _Linearization, _PdfName, _PdfCommand, _PdfReference, _PdfReferenceSet, _PdfReferenceSetCache, Dictionary, _PdfDictionary, _PdfNull, _clearPrimitiveCaches, _isName, _isCommand, PdfPredictorStream, _toUnsigned, _toSigned16, _toSigned32, _copyRange, _checkType, _getDecoder, _checkRotation, _getPageIndex, _annotationFlagsToString, _stringToAnnotationFlags, _stringToPdfString, _stringToBytes, _areArrayEqual, _numberToString, _areNotEqual, _bytesToString, _decodeUTF8, _stringToUnicodeArray, _byteArrayToHexString, _hexStringToByteArray, _hexStringToString, _isWhiteSpace, _decode, _encode, _getInheritableProperty, _parseRectangle, _calculateBounds, _toRectangle, _fromRectangle, _getUpdatedBounds, _convertToColor, _parseColor, _mapBorderStyle, _mapBorderEffectStyle, _reverseMapEndingStyle, _mapLineEndingStyle, _mapHighlightMode, _reverseMapHighlightMode, _reverseMapBlendMode, _mapBlendMode, _floatToString, _addProcSet, _getNewGuidString, _escapePdfName, _getBezierArc, _findPage, _checkField, _getItemValue, _getStateTemplate, _getColorValue, _setMatrix, _styleToString, _stringToStyle, _mapMeasurementUnit, _mapMarkupAnnotationType, _reverseMarkupAnnotationType, _mapGraphicsUnit, _mapRubberStampIcon, _mapPopupIcon, _reverseMapAnnotationState, _mapAnnotationState, _reverseMapAnnotationStateModel, _mapAnnotationStateModel, _mapAttachmentIcon, _mapAnnotationIntent, _reverseMapPdfFontStyle, _getSpecialCharacter, _getLatinCharacter, _encodeValue, _getCommentsOrReview, _checkReview, _checkComment, _updateVisibility, _removeDuplicateReference, _removeDuplicateFromResources, _removeReferences, BaseException, FormatError, ParserEndOfFileException, _defaultToString, _obtainFontDetails, _getFontStyle, _mapFont, _tryParseFontStream, _checkInkPoints, _obtainDestination, _updateBounds, _decodeText, _getSize, _stringToBigEndianBytes, PdfAnnotationCollection, PdfPopupAnnotationCollection, PdfAnnotation, PdfComment, PdfLineAnnotation, PdfCircleAnnotation, PdfEllipseAnnotation, PdfSquareAnnotation, PdfRectangleAnnotation, PdfPolygonAnnotation, PdfPolyLineAnnotation, PdfAngleMeasurementAnnotation, PdfInkAnnotation, PdfPopupAnnotation, PdfFileLinkAnnotation, PdfUriAnnotation, PdfDocumentLinkAnnotation, PdfTextWebLinkAnnotation, PdfAttachmentAnnotation, Pdf3DAnnotation, PdfTextMarkupAnnotation, PdfWatermarkAnnotation, PdfRubberStampAnnotation, PdfSoundAnnotation, PdfFreeTextAnnotation, PdfRedactionAnnotation, PdfRichMediaAnnotation, PdfWidgetAnnotation, PdfStateItem, PdfRadioButtonListItem, PdfListFieldItem, PdfAnnotationCaption, PdfAnnotationLineEndingStyle, PdfInteractiveBorder, PdfAnnotationBorder, PdfBorderEffect, _PaintParameter, PdfAppearance, _PdfPaddings, _DecompressedOutput, _DeflateStream, _Inflater, _HuffmanTree, _InBuffer, _InflaterState, _BlockType, _PdfFontMetrics, _WidthTable, _StandardWidthTable, _CjkWidthTable, _CjkWidth, _CjkSameWidth, _CjkDifferentWidth, PdfFont, PdfStandardFont, PdfCjkStandardFont, PdfTrueTypeFont, _PdfStandardFontMetricsFactory, _PdfCjkStandardFontMetricsFactory, _PdfCjkFontDescriptorFactory, PdfFontStyle, PdfFontFamily, PdfCjkFontFamily, _UnicodeLine, PdfStringFormat, PdfVerticalAlignment, _PdfStringLayouter, _PdfStringLayoutResult, _LineInfo, _LineType, _StringTokenizer, _TrueTypeReader, _TrueTypeNameRecord, _TrueTypeMetrics, _TrueTypeLongHorMetric, _TrueTypeGlyph, _TrueTypeLocaTable, _TrueTypeGlyphHeader, _BigEndianWriter, _TrueTypeTableInfo, _TrueTypeOS2Table, _TrueTypePostTable, _TrueTypeNameTable, _TrueTypeMicrosoftCmapSubTable, _TrueTypeHorizontalHeaderTable, _TrueTypeHeadTable, _TrueTypeCmapTable, _TrueTypeCmapSubTable, _TrueTypeAppleCmapSubTable, _TrueTypeTrimmedCmapSubTable, _UnicodeTrueTypeFont, PdfField, PdfTextBoxField, PdfButtonField, PdfCheckBoxField, PdfRadioButtonListField, PdfListField, PdfComboBoxField, PdfListBoxField, PdfSignatureField, _PdfDefaultAppearance, PdfForm, PdfGraphics, _PdfTransformationMatrix, _Matrix, PdfGraphicsState, _TextRenderingMode, PdfBrush, PdfPen, _PdfUnitConvertor, _PdfPath, _PathPointType, _PdfStreamWriter, PdfTemplate, _Bidirectional, _RtlCharacters, _ArabicShapeRenderer, _ArabicShape, _RtlRenderer, _ImageDecoder, PdfBitmap, PdfImage, _PngDecoder, _JpegDecoder, _PdfEncryptor, _MD5, _Sha256, _Sha512, _Word64, _EncryptionKey, _BasicEncryption, _AdvancedEncryption, _Cipher, _NormalCipherFour, _AdvancedEncryptionBaseCipher, _AdvancedEncryption128Cipher, _AdvancedEncryption256Cipher, _NullCipher, _CipherTransform, _ExportHelper, _XfdfDocument, _FontStructure, _XmlWriter, _Namespace, _XmlElement, _XmlAttribute, _FdfDocument, _FdfHelper, _JsonDocument, _XmlDocument };
|
|
54965
55096
|
//# sourceMappingURL=ej2-pdf.es5.js.map
|