@syncfusion/ej2-pdf-data-extract 35.1.42 → 35.1.46
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/dist/ej2-pdf-data-extract.umd.min.js +2 -2
- package/dist/ej2-pdf-data-extract.umd.min.js.map +1 -1
- package/dist/ej2-pdf-lib/openjpeg.js +1 -1
- package/dist/ej2-pdf-lib/openjpeg.wasm +0 -0
- package/dist/ej2-pdf-lib/qcms.js +1 -1
- package/dist/ej2-pdf-lib/qcms_bg.wasm +0 -0
- package/dist/es6/ej2-pdf-data-extract.es2015.js +1700 -4
- package/dist/es6/ej2-pdf-data-extract.es2015.js.map +1 -1
- package/dist/es6/ej2-pdf-data-extract.es5.js +1719 -11
- package/dist/es6/ej2-pdf-data-extract.es5.js.map +1 -1
- package/dist/global/ej2-pdf-data-extract.min.js +2 -2
- package/dist/global/ej2-pdf-data-extract.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +2 -2
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/pdf-data-extract/core/pdf-data-extractor.d.ts +83 -0
- package/src/pdf-data-extract/core/pdf-data-extractor.js +332 -8
- package/src/pdf-data-extract/core/redaction/pdf-redaction-processor.js +6 -2
- package/src/pdf-data-extract/core/rtl-utils.d.ts +186 -0
- package/src/pdf-data-extract/core/rtl-utils.js +1380 -0
- package/src/pdf-data-extract/index.d.ts +1 -0
- package/src/pdf-data-extract/index.js +1 -0
|
@@ -28185,8 +28185,12 @@ var _PdfRedactionProcessor = /** @__PURE__ @class */ (function () {
|
|
|
28185
28185
|
var inkAnnotation = annotation;
|
|
28186
28186
|
var inkList = inkAnnotation.inkPointsCollection;
|
|
28187
28187
|
var inkPointsToNumberArray = _convertPointsToNumberArrays(inkList);
|
|
28188
|
-
|
|
28189
|
-
|
|
28188
|
+
var inkStrokePoints = [];
|
|
28189
|
+
for (var stroke = 0; stroke < inkPointsToNumberArray.length; stroke++) {
|
|
28190
|
+
inkStrokePoints = inkStrokePoints.concat(inkPointsToNumberArray[Number.parseInt(stroke.toString(), 10)]);
|
|
28191
|
+
}
|
|
28192
|
+
inkBounds = this._getBoundsFromPoints(inkStrokePoints, page);
|
|
28193
|
+
bounds = inkPointsToNumberArray.length > 0 ? inkBounds.bounds : inkAnnotation.bounds;
|
|
28190
28194
|
if (!inkAnnotation._isLoaded) {
|
|
28191
28195
|
inkBounds.isValidAnnotation = true;
|
|
28192
28196
|
}
|
|
@@ -29988,6 +29992,1387 @@ var ScopeType;
|
|
|
29988
29992
|
ScopeType[ScopeType["none"] = 3] = "none";
|
|
29989
29993
|
})(ScopeType || (ScopeType = {}));
|
|
29990
29994
|
|
|
29995
|
+
/**
|
|
29996
|
+
* Utilities for converting visually ordered RTL text (as stored inside PDF content
|
|
29997
|
+
* streams) into logical Unicode reading order, and for normalizing Arabic
|
|
29998
|
+
* presentation forms back to their base Unicode code points.
|
|
29999
|
+
*
|
|
30000
|
+
* @private
|
|
30001
|
+
*/
|
|
30002
|
+
/**
|
|
30003
|
+
* Checks whether the character is an Arabic presentation form (isolated, final,
|
|
30004
|
+
* initial or medial shape) in the Arabic Presentation Forms A/B blocks.
|
|
30005
|
+
*
|
|
30006
|
+
* @param {string} ch - Character to check.
|
|
30007
|
+
* @returns {boolean} True when the character is an Arabic presentation form.
|
|
30008
|
+
* @private
|
|
30009
|
+
*/
|
|
30010
|
+
function _isArabicPresentationForm(ch) {
|
|
30011
|
+
var code = ch.charCodeAt(0);
|
|
30012
|
+
return (code >= 0xFB50 && code <= 0xFDFF) || (code >= 0xFE70 && code <= 0xFEFF);
|
|
30013
|
+
}
|
|
30014
|
+
/**
|
|
30015
|
+
* Checks whether the character belongs to a right-to-left script (Arabic, Hebrew,
|
|
30016
|
+
* Syriac, Thaana and related presentation blocks).
|
|
30017
|
+
*
|
|
30018
|
+
* @param {string} ch - Character to check.
|
|
30019
|
+
* @returns {boolean} True when the character is an RTL character.
|
|
30020
|
+
* @private
|
|
30021
|
+
*/
|
|
30022
|
+
function _isRtlCharacter(ch) {
|
|
30023
|
+
var code = ch.charCodeAt(0);
|
|
30024
|
+
if (code < 0x0590 || code > 0x08FF) {
|
|
30025
|
+
if (code < 0xFB1D || code > 0xFEFF) {
|
|
30026
|
+
return false;
|
|
30027
|
+
}
|
|
30028
|
+
}
|
|
30029
|
+
if (code >= 0x0600 && code <= 0x0605) {
|
|
30030
|
+
return false;
|
|
30031
|
+
}
|
|
30032
|
+
if (code >= 0x0660 && code <= 0x0669) {
|
|
30033
|
+
return false;
|
|
30034
|
+
}
|
|
30035
|
+
if (code >= 0x06F0 && code <= 0x06F9) {
|
|
30036
|
+
return false;
|
|
30037
|
+
}
|
|
30038
|
+
if (code >= 0x064B && code <= 0x065F) {
|
|
30039
|
+
return false;
|
|
30040
|
+
}
|
|
30041
|
+
if (code === 0x0640) {
|
|
30042
|
+
return false;
|
|
30043
|
+
}
|
|
30044
|
+
return true;
|
|
30045
|
+
}
|
|
30046
|
+
/**
|
|
30047
|
+
* Checks whether the character is a neutral character (space, punctuation) that
|
|
30048
|
+
* takes its direction from surrounding strong characters.
|
|
30049
|
+
*
|
|
30050
|
+
* @param {string} ch - Character to check.
|
|
30051
|
+
* @returns {boolean} True when the character is directionally neutral.
|
|
30052
|
+
* @private
|
|
30053
|
+
*/
|
|
30054
|
+
function _isNeutralCharacter(ch) {
|
|
30055
|
+
var code = ch.charCodeAt(0);
|
|
30056
|
+
if (code < 0x20) {
|
|
30057
|
+
return true;
|
|
30058
|
+
}
|
|
30059
|
+
if (code === 0x20 || code === 0xA0) {
|
|
30060
|
+
return true;
|
|
30061
|
+
}
|
|
30062
|
+
if (code >= 0x2000 && code <= 0x200F) {
|
|
30063
|
+
return true;
|
|
30064
|
+
}
|
|
30065
|
+
if (code >= 0x060C && code <= 0x060C) {
|
|
30066
|
+
return true;
|
|
30067
|
+
}
|
|
30068
|
+
if (code === 0x061B || code === 0x061F || code === 0x06D4) {
|
|
30069
|
+
return true;
|
|
30070
|
+
}
|
|
30071
|
+
if (code >= 0x066A && code <= 0x066D) {
|
|
30072
|
+
return true;
|
|
30073
|
+
}
|
|
30074
|
+
if (code >= 0x21 && code <= 0x2F) {
|
|
30075
|
+
return true;
|
|
30076
|
+
}
|
|
30077
|
+
if (code >= 0x3A && code <= 0x3F) {
|
|
30078
|
+
return true;
|
|
30079
|
+
}
|
|
30080
|
+
if (code >= 0x5B && code <= 0x60) {
|
|
30081
|
+
return true;
|
|
30082
|
+
}
|
|
30083
|
+
if (code >= 0x7B && code <= 0x7E) {
|
|
30084
|
+
return true;
|
|
30085
|
+
}
|
|
30086
|
+
if (code === 0x2013 || code === 0x2014 || code === 0x2026 || code === 0xAB || code === 0xBB) {
|
|
30087
|
+
return true;
|
|
30088
|
+
}
|
|
30089
|
+
return false;
|
|
30090
|
+
}
|
|
30091
|
+
/**
|
|
30092
|
+
* Checks whether the character is a left-to-right character (Latin letters,
|
|
30093
|
+
* digits and other common LTR characters).
|
|
30094
|
+
*
|
|
30095
|
+
* @param {string} ch - Character to check.
|
|
30096
|
+
* @returns {boolean} True when the character is an LTR character.
|
|
30097
|
+
* @private
|
|
30098
|
+
*/
|
|
30099
|
+
function _isLtrCharacter(ch) {
|
|
30100
|
+
var code = ch.charCodeAt(0);
|
|
30101
|
+
if (code >= 0x41 && code <= 0x5A) {
|
|
30102
|
+
return true;
|
|
30103
|
+
}
|
|
30104
|
+
if (code >= 0x61 && code <= 0x7A) {
|
|
30105
|
+
return true;
|
|
30106
|
+
}
|
|
30107
|
+
if (code >= 0x30 && code <= 0x39) {
|
|
30108
|
+
return true;
|
|
30109
|
+
}
|
|
30110
|
+
if (code >= 0x0660 && code <= 0x0669) {
|
|
30111
|
+
return true;
|
|
30112
|
+
}
|
|
30113
|
+
if (code >= 0x06F0 && code <= 0x06F9) {
|
|
30114
|
+
return true;
|
|
30115
|
+
}
|
|
30116
|
+
return (code >= 0xC0 && code <= 0x24F) && !((code >= 0x0590 && code <= 0x08FF));
|
|
30117
|
+
}
|
|
30118
|
+
/**
|
|
30119
|
+
* Maps Arabic presentation form characters (U+FB50–U+FDFF, U+FE70–U+FEFF) to their
|
|
30120
|
+
* base Arabic code points (U+0600–U+06FF and supplement ranges). Ligature
|
|
30121
|
+
* presentation forms are mapped to their multi-character logical equivalents.
|
|
30122
|
+
*
|
|
30123
|
+
* @param {string} ch - Character to normalize.
|
|
30124
|
+
* @returns {string} The base (logical) Unicode representation of the character.
|
|
30125
|
+
* @private
|
|
30126
|
+
*/
|
|
30127
|
+
function _normalizeArabicCharacter(ch) {
|
|
30128
|
+
var code = ch.charCodeAt(0);
|
|
30129
|
+
var mapped = Object.prototype.hasOwnProperty.call(arabicPresentationForms, code)
|
|
30130
|
+
? arabicPresentationForms[code] : undefined;
|
|
30131
|
+
if (typeof (mapped) === 'string') {
|
|
30132
|
+
return mapped;
|
|
30133
|
+
}
|
|
30134
|
+
return ch;
|
|
30135
|
+
}
|
|
30136
|
+
/**
|
|
30137
|
+
* Reverses a copy of the given array between the specified bounds (inclusive).
|
|
30138
|
+
*
|
|
30139
|
+
* @param {string[]} items - Array to reverse a portion of.
|
|
30140
|
+
* @param {number} start - Start index.
|
|
30141
|
+
* @param {number} end - End index (inclusive).
|
|
30142
|
+
* @returns {void}
|
|
30143
|
+
* @private
|
|
30144
|
+
*/
|
|
30145
|
+
function _reverseRange(items, start, end) {
|
|
30146
|
+
while (start < end) {
|
|
30147
|
+
var temp = items[start];
|
|
30148
|
+
items[start] = items[end];
|
|
30149
|
+
items[end] = temp;
|
|
30150
|
+
start++;
|
|
30151
|
+
end--;
|
|
30152
|
+
}
|
|
30153
|
+
}
|
|
30154
|
+
/**
|
|
30155
|
+
* Converts visually ordered text containing RTL content into logical Unicode order.
|
|
30156
|
+
* LTR runs are left untouched, so mixed RTL/LTR text is preserved. Characters are
|
|
30157
|
+
* handled as UTF-16 code units to match the rest of the extraction pipeline.
|
|
30158
|
+
*
|
|
30159
|
+
* @param {string} text - Text in visual order as extracted from the PDF content stream.
|
|
30160
|
+
* @returns {string} Text in logical reading order.
|
|
30161
|
+
* @private
|
|
30162
|
+
*/
|
|
30163
|
+
function _convertVisualToLogicalOrder(text) {
|
|
30164
|
+
if (typeof (text) !== 'string' || text.length === 0) {
|
|
30165
|
+
return text;
|
|
30166
|
+
}
|
|
30167
|
+
if (text.indexOf('\r') !== -1 || text.indexOf('\n') !== -1) {
|
|
30168
|
+
var lines = text.split(/(\r\n|\r|\n)/);
|
|
30169
|
+
var result = '';
|
|
30170
|
+
for (var i = 0; i < lines.length; i++) {
|
|
30171
|
+
var part = lines[Number.parseInt(i.toString(), 10)];
|
|
30172
|
+
if (part === '\r\n' || part === '\r' || part === '\n') {
|
|
30173
|
+
result += part;
|
|
30174
|
+
}
|
|
30175
|
+
else {
|
|
30176
|
+
result += _convertVisualToLogicalOrder(part);
|
|
30177
|
+
}
|
|
30178
|
+
}
|
|
30179
|
+
return result;
|
|
30180
|
+
}
|
|
30181
|
+
var characters = [];
|
|
30182
|
+
for (var i = 0; i < text.length; i++) {
|
|
30183
|
+
characters.push(text[Number.parseInt(i.toString(), 10)]);
|
|
30184
|
+
}
|
|
30185
|
+
if (!_containsRtlCharacter(text)) {
|
|
30186
|
+
return characters.join('');
|
|
30187
|
+
}
|
|
30188
|
+
var length = characters.length;
|
|
30189
|
+
_reverseRange(characters, 0, length - 1);
|
|
30190
|
+
if (_isWholeLineReversalStorage(text)) {
|
|
30191
|
+
return characters.join('');
|
|
30192
|
+
}
|
|
30193
|
+
var index = 0;
|
|
30194
|
+
while (index < length) {
|
|
30195
|
+
var character = characters[Number.parseInt(index.toString(), 10)];
|
|
30196
|
+
if (!_isRtlCharacter(character) && !_isNeutralCharacter(character)) {
|
|
30197
|
+
var runEnd = index;
|
|
30198
|
+
for (var j = index + 1; j < length; j++) {
|
|
30199
|
+
var next = characters[Number.parseInt(j.toString(), 10)];
|
|
30200
|
+
if (_isRtlCharacter(next)) {
|
|
30201
|
+
break;
|
|
30202
|
+
}
|
|
30203
|
+
if (_isNeutralCharacter(next)) {
|
|
30204
|
+
var after = j + 1;
|
|
30205
|
+
while (after < length && _isNeutralCharacter(characters[Number.parseInt(after.toString(), 10)])) {
|
|
30206
|
+
after++;
|
|
30207
|
+
}
|
|
30208
|
+
if (after < length && !_isRtlCharacter(characters[Number.parseInt(after.toString(), 10)])) {
|
|
30209
|
+
runEnd = after - 1;
|
|
30210
|
+
j = after - 1;
|
|
30211
|
+
}
|
|
30212
|
+
else {
|
|
30213
|
+
break;
|
|
30214
|
+
}
|
|
30215
|
+
}
|
|
30216
|
+
else {
|
|
30217
|
+
runEnd = j;
|
|
30218
|
+
}
|
|
30219
|
+
}
|
|
30220
|
+
_reverseRange(characters, index, runEnd);
|
|
30221
|
+
index = runEnd + 1;
|
|
30222
|
+
}
|
|
30223
|
+
else {
|
|
30224
|
+
index++;
|
|
30225
|
+
}
|
|
30226
|
+
}
|
|
30227
|
+
return characters.join('');
|
|
30228
|
+
}
|
|
30229
|
+
/**
|
|
30230
|
+
* Mirrored (swapped) forms of the paired bracket characters. RTL visual
|
|
30231
|
+
* layout stores these glyphs mirrored (Unicode BiDi rule L4), so converting
|
|
30232
|
+
* a visual fragment back to logical order must swap the pair members.
|
|
30233
|
+
*
|
|
30234
|
+
* @private
|
|
30235
|
+
*/
|
|
30236
|
+
var mirroredBrackets = {
|
|
30237
|
+
'(': ')', ')': '(',
|
|
30238
|
+
'[': ']', ']': '[',
|
|
30239
|
+
'{': '}', '}': '{',
|
|
30240
|
+
'\u00AB': '\u00BB', '\u00BB': '\u00AB'
|
|
30241
|
+
};
|
|
30242
|
+
/**
|
|
30243
|
+
* Swaps mirrored paired bracket characters (parentheses, square brackets, curly
|
|
30244
|
+
* braces, angle quotes) back to their logical pair member. RTL visual layout
|
|
30245
|
+
* paints these glyphs mirrored (Unicode BiDi rule L4), so a visual-order line
|
|
30246
|
+
* must be un-mirrored to yield the logical text Adobe extracts.
|
|
30247
|
+
*
|
|
30248
|
+
* @param {string} text - Text containing mirrored bracket glyphs.
|
|
30249
|
+
* @returns {string} Text with pair members swapped back.
|
|
30250
|
+
* @private
|
|
30251
|
+
*/
|
|
30252
|
+
function _unmirrorPairedBrackets(text) {
|
|
30253
|
+
if (typeof (text) !== 'string' || text.length === 0) {
|
|
30254
|
+
return text;
|
|
30255
|
+
}
|
|
30256
|
+
var result = '';
|
|
30257
|
+
for (var i = 0; i < text.length; i++) {
|
|
30258
|
+
var ch = text[Number.parseInt(i.toString(), 10)];
|
|
30259
|
+
if (Object.prototype.hasOwnProperty.call(mirroredBrackets, ch)) {
|
|
30260
|
+
result += mirroredBrackets[ch]; // eslint-disable-line
|
|
30261
|
+
}
|
|
30262
|
+
else {
|
|
30263
|
+
result += ch;
|
|
30264
|
+
}
|
|
30265
|
+
}
|
|
30266
|
+
return result;
|
|
30267
|
+
}
|
|
30268
|
+
/**
|
|
30269
|
+
* Converts a visual-order fragment that contains no RTL characters (Latin
|
|
30270
|
+
* tokens, digits, neutral punctuation) into logical order for an RTL line.
|
|
30271
|
+
*
|
|
30272
|
+
* @param {string} text - Fragment in visual order.
|
|
30273
|
+
* @returns {string} Fragment in logical order (bracket glyphs unchanged).
|
|
30274
|
+
* @private
|
|
30275
|
+
*/
|
|
30276
|
+
function _invertVisualLtrFragment(text) {
|
|
30277
|
+
if (typeof (text) !== 'string' || text.length === 0) {
|
|
30278
|
+
return text;
|
|
30279
|
+
}
|
|
30280
|
+
var characters = text.split('');
|
|
30281
|
+
_reverseRange(characters, 0, characters.length - 1);
|
|
30282
|
+
var index = 0;
|
|
30283
|
+
while (index < characters.length) {
|
|
30284
|
+
if (_isLtrCharacter(characters[Number.parseInt(index.toString(), 10)])) {
|
|
30285
|
+
var runEnd = index;
|
|
30286
|
+
while (runEnd + 1 < characters.length &&
|
|
30287
|
+
_isLtrCharacter(characters[Number.parseInt((runEnd + 1).toString(), 10)])) {
|
|
30288
|
+
runEnd++;
|
|
30289
|
+
}
|
|
30290
|
+
_reverseRange(characters, index, runEnd);
|
|
30291
|
+
index = runEnd + 1;
|
|
30292
|
+
}
|
|
30293
|
+
else {
|
|
30294
|
+
index++;
|
|
30295
|
+
}
|
|
30296
|
+
}
|
|
30297
|
+
return characters.join('');
|
|
30298
|
+
}
|
|
30299
|
+
/**
|
|
30300
|
+
* Checks whether the paired brackets in the given text form a balanced
|
|
30301
|
+
* sequence (every closing bracket is preceded by a matching opener and no
|
|
30302
|
+
* depth underflow). Text without brackets is balanced by definition.
|
|
30303
|
+
*
|
|
30304
|
+
* @param {string} text - Text to inspect.
|
|
30305
|
+
* @returns {boolean} True when the bracket sequence is balanced.
|
|
30306
|
+
* @private
|
|
30307
|
+
*/
|
|
30308
|
+
function _isBracketSequenceBalanced(text) {
|
|
30309
|
+
if (typeof (text) !== 'string' || text.length === 0) {
|
|
30310
|
+
return true;
|
|
30311
|
+
}
|
|
30312
|
+
var openers = { '(': ')', '[': ']', '{': '}', '\u00AB': '\u00BB' };
|
|
30313
|
+
var closers = { ')': '(', ']': '[', '}': '{', '\u00BB': '\u00AB' };
|
|
30314
|
+
var stack = [];
|
|
30315
|
+
for (var i = 0; i < text.length; i++) {
|
|
30316
|
+
var ch = text[Number.parseInt(i.toString(), 10)];
|
|
30317
|
+
if (Object.prototype.hasOwnProperty.call(openers, ch)) {
|
|
30318
|
+
stack.push(openers[ch]); // eslint-disable-line
|
|
30319
|
+
}
|
|
30320
|
+
else if (Object.prototype.hasOwnProperty.call(closers, ch)) {
|
|
30321
|
+
var expected = stack.length > 0 ? stack.pop() : undefined;
|
|
30322
|
+
if (expected !== undefined && expected !== ch) {
|
|
30323
|
+
return false;
|
|
30324
|
+
}
|
|
30325
|
+
if (expected === undefined) {
|
|
30326
|
+
return false;
|
|
30327
|
+
}
|
|
30328
|
+
}
|
|
30329
|
+
}
|
|
30330
|
+
return stack.length === 0;
|
|
30331
|
+
}
|
|
30332
|
+
/**
|
|
30333
|
+
* Resolves paired-bracket glyph mirroring for a logical-order RTL line.
|
|
30334
|
+
*
|
|
30335
|
+
* @param {string} text - Line text in logical order.
|
|
30336
|
+
* @returns {string} Text with mirrored bracket glyphs restored when needed.
|
|
30337
|
+
* @private
|
|
30338
|
+
*/
|
|
30339
|
+
function _resolveMirroredBrackets(text) {
|
|
30340
|
+
if (typeof (text) !== 'string' || text.length === 0) {
|
|
30341
|
+
return text;
|
|
30342
|
+
}
|
|
30343
|
+
if (_isBracketSequenceBalanced(text)) {
|
|
30344
|
+
return text;
|
|
30345
|
+
}
|
|
30346
|
+
var unmirrored = _unmirrorPairedBrackets(text);
|
|
30347
|
+
return _isBracketSequenceBalanced(unmirrored) ? unmirrored : text;
|
|
30348
|
+
}
|
|
30349
|
+
/**
|
|
30350
|
+
* Detects the naive whole-line-reversal storage convention using digit runs
|
|
30351
|
+
* embedded in RTL text. In canonical visual storage digit runs read
|
|
30352
|
+
* left-to-right in ascending significance order ("2010"); if a stored digit
|
|
30353
|
+
* run instead reads like a plain reversal of an ascending run ("0102"), the
|
|
30354
|
+
* producer wrote the whole logical string reversed (convention B).
|
|
30355
|
+
*
|
|
30356
|
+
* @param {string} text - Text in visual order as extracted from the PDF.
|
|
30357
|
+
* @returns {boolean} True when the text appears whole-line-reversal stored.
|
|
30358
|
+
* @private
|
|
30359
|
+
*/
|
|
30360
|
+
function _isWholeLineReversalStorage(text) {
|
|
30361
|
+
var runs = [];
|
|
30362
|
+
var current = '';
|
|
30363
|
+
for (var i = 0; i < text.length; i++) {
|
|
30364
|
+
var code = text.charCodeAt(i);
|
|
30365
|
+
var isDigit = (code >= 0x30 && code <= 0x39) || (code >= 0x0660 && code <= 0x0669);
|
|
30366
|
+
if (isDigit) {
|
|
30367
|
+
current += text[i];
|
|
30368
|
+
}
|
|
30369
|
+
else if (current.length > 0) {
|
|
30370
|
+
runs.push(current);
|
|
30371
|
+
current = '';
|
|
30372
|
+
}
|
|
30373
|
+
}
|
|
30374
|
+
if (current.length > 0) {
|
|
30375
|
+
runs.push(current);
|
|
30376
|
+
}
|
|
30377
|
+
var reversedCount = 0;
|
|
30378
|
+
var total = 0;
|
|
30379
|
+
for (var i = 0; i < runs.length; i++) {
|
|
30380
|
+
var run = runs[Number.parseInt(i.toString(), 10)];
|
|
30381
|
+
if (run.length < 2) {
|
|
30382
|
+
continue;
|
|
30383
|
+
}
|
|
30384
|
+
total++;
|
|
30385
|
+
if (run === run.split('').reverse().join('')) {
|
|
30386
|
+
if (run.length >= 2 && new Set(run).size === 1) {
|
|
30387
|
+
total--;
|
|
30388
|
+
}
|
|
30389
|
+
continue;
|
|
30390
|
+
}
|
|
30391
|
+
if (run[0] === '0' || run[0] === String.fromCharCode(0x0660)) {
|
|
30392
|
+
reversedCount++;
|
|
30393
|
+
}
|
|
30394
|
+
}
|
|
30395
|
+
if (total === 0) {
|
|
30396
|
+
return false;
|
|
30397
|
+
}
|
|
30398
|
+
return reversedCount / total >= 0.5;
|
|
30399
|
+
}
|
|
30400
|
+
/**
|
|
30401
|
+
* Converts visually ordered RTL text into logical order and normalizes Arabic
|
|
30402
|
+
* presentation forms to their base Unicode code points. This produces text
|
|
30403
|
+
* comparable to Adobe text extraction for Arabic, Hebrew, Persian and Urdu.
|
|
30404
|
+
*
|
|
30405
|
+
* @param {string} text - Text in visual order as extracted from the PDF.
|
|
30406
|
+
* @returns {string} Normalized text in logical reading order.
|
|
30407
|
+
* @private
|
|
30408
|
+
*/
|
|
30409
|
+
function _normalizeRtlText(text) {
|
|
30410
|
+
if (typeof (text) !== 'string' || text.length === 0) {
|
|
30411
|
+
return text;
|
|
30412
|
+
}
|
|
30413
|
+
var reordered = _convertVisualToLogicalOrder(text);
|
|
30414
|
+
if (!_containsRtlCharacter(reordered)) {
|
|
30415
|
+
return reordered;
|
|
30416
|
+
}
|
|
30417
|
+
var normalized = '';
|
|
30418
|
+
for (var i = 0; i < reordered.length; i++) {
|
|
30419
|
+
normalized += _normalizeArabicCharacter(reordered[Number.parseInt(i.toString(), 10)]);
|
|
30420
|
+
}
|
|
30421
|
+
return normalized;
|
|
30422
|
+
}
|
|
30423
|
+
/**
|
|
30424
|
+
* Checks whether the given string contains any RTL script character.
|
|
30425
|
+
*
|
|
30426
|
+
* @param {string} text - Text to inspect.
|
|
30427
|
+
* @returns {boolean} True when the text contains an RTL character.
|
|
30428
|
+
* @private
|
|
30429
|
+
*/
|
|
30430
|
+
function _containsRtlCharacter(text) {
|
|
30431
|
+
if (typeof (text) !== 'string') {
|
|
30432
|
+
return false;
|
|
30433
|
+
}
|
|
30434
|
+
for (var i = 0; i < text.length; i++) {
|
|
30435
|
+
if (_isRtlCharacter(text[Number.parseInt(i.toString(), 10)])) {
|
|
30436
|
+
return true;
|
|
30437
|
+
}
|
|
30438
|
+
}
|
|
30439
|
+
return false;
|
|
30440
|
+
}
|
|
30441
|
+
/**
|
|
30442
|
+
* Checks whether the given text contains at least one Arabic presentation form
|
|
30443
|
+
* character. Producers that store text in visual glyph order typically emit
|
|
30444
|
+
* presentation forms, so this is used as a visual-order signal.
|
|
30445
|
+
*
|
|
30446
|
+
* @param {string} text - Text to inspect.
|
|
30447
|
+
* @returns {boolean} True when a presentation form character is present.
|
|
30448
|
+
* @private
|
|
30449
|
+
*/
|
|
30450
|
+
function _containsArabicPresentationForm(text) {
|
|
30451
|
+
if (typeof (text) !== 'string') {
|
|
30452
|
+
return false;
|
|
30453
|
+
}
|
|
30454
|
+
for (var i = 0; i < text.length; i++) {
|
|
30455
|
+
if (_isArabicPresentationForm(text[Number.parseInt(i.toString(), 10)])) {
|
|
30456
|
+
return true;
|
|
30457
|
+
}
|
|
30458
|
+
}
|
|
30459
|
+
return false;
|
|
30460
|
+
}
|
|
30461
|
+
/**
|
|
30462
|
+
* Maps Arabic presentation form characters in the given text to their base
|
|
30463
|
+
* Unicode code points WITHOUT any reordering. Used when the text is already
|
|
30464
|
+
* in logical order and only character normalization is needed.
|
|
30465
|
+
*
|
|
30466
|
+
* @param {string} text - Text to map.
|
|
30467
|
+
* @returns {string} Text with presentation forms replaced by base characters.
|
|
30468
|
+
* @private
|
|
30469
|
+
*/
|
|
30470
|
+
function _mapArabicPresentationForms(text) {
|
|
30471
|
+
if (typeof (text) !== 'string' || text.length === 0) {
|
|
30472
|
+
return text;
|
|
30473
|
+
}
|
|
30474
|
+
if (!_containsRtlCharacter(text)) {
|
|
30475
|
+
return text;
|
|
30476
|
+
}
|
|
30477
|
+
var mapped = '';
|
|
30478
|
+
for (var i = 0; i < text.length; i++) {
|
|
30479
|
+
var ch = text[Number.parseInt(i.toString(), 10)];
|
|
30480
|
+
if (_isArabicPresentationForm(ch)) {
|
|
30481
|
+
mapped += _normalizeArabicCharacter(ch);
|
|
30482
|
+
}
|
|
30483
|
+
else {
|
|
30484
|
+
mapped += ch;
|
|
30485
|
+
}
|
|
30486
|
+
}
|
|
30487
|
+
return mapped;
|
|
30488
|
+
}
|
|
30489
|
+
/**
|
|
30490
|
+
* Determines whether the given RTL text is stored in visual (right-to-left
|
|
30491
|
+
* glyph) order rather than logical order, using the horizontal position of
|
|
30492
|
+
* consecutive glyphs/words. When the second fragment is placed to the RIGHT of
|
|
30493
|
+
* the first fragment, the text advances leftward and is visual-ordered RTL.
|
|
30494
|
+
*
|
|
30495
|
+
* @param {{ x: number, width: number }} firstBounds - Bounds of the earlier extracted fragment.
|
|
30496
|
+
* @param {number} firstBounds.x - X-coordinate of the first fragment.
|
|
30497
|
+
* @param {number} firstBounds.width - Width of the first fragment.
|
|
30498
|
+
* @param {{ x: number, width: number }} secondBounds - Bounds of the next extracted fragment.
|
|
30499
|
+
* @param {number} secondBounds.x - X-coordinate of the second fragment.
|
|
30500
|
+
* @param {number} secondBounds.width - Width of the second fragment.
|
|
30501
|
+
* @returns {boolean} True when the fragments indicate visual RTL ordering.
|
|
30502
|
+
* @private
|
|
30503
|
+
*/
|
|
30504
|
+
function _isVisualOrderRtl(firstBounds, secondBounds) {
|
|
30505
|
+
if (!firstBounds || !secondBounds) {
|
|
30506
|
+
return false;
|
|
30507
|
+
}
|
|
30508
|
+
return secondBounds.x > firstBounds.x + firstBounds.width * 0.5;
|
|
30509
|
+
}
|
|
30510
|
+
/**
|
|
30511
|
+
* Normalizes a search input string for comparison. Search input is expected in
|
|
30512
|
+
* logical order; Arabic presentation forms are mapped to base code points so a
|
|
30513
|
+
* search value typed in logical Arabic matches extracted logical text.
|
|
30514
|
+
*
|
|
30515
|
+
* @param {string} text - Search text to normalize.
|
|
30516
|
+
* @returns {string} Normalized search text.
|
|
30517
|
+
* @private
|
|
30518
|
+
*/
|
|
30519
|
+
function _normalizeSearchText(text) {
|
|
30520
|
+
if (typeof (text) !== 'string' || text.length === 0) {
|
|
30521
|
+
return text;
|
|
30522
|
+
}
|
|
30523
|
+
if (!_containsRtlCharacter(text)) {
|
|
30524
|
+
return text;
|
|
30525
|
+
}
|
|
30526
|
+
var normalized = '';
|
|
30527
|
+
for (var i = 0; i < text.length; i++) {
|
|
30528
|
+
var ch = text[Number.parseInt(i.toString(), 10)];
|
|
30529
|
+
if (_isArabicPresentationForm(ch)) {
|
|
30530
|
+
normalized += _normalizeArabicCharacter(ch);
|
|
30531
|
+
}
|
|
30532
|
+
else {
|
|
30533
|
+
normalized += ch;
|
|
30534
|
+
}
|
|
30535
|
+
}
|
|
30536
|
+
return normalized;
|
|
30537
|
+
}
|
|
30538
|
+
/**
|
|
30539
|
+
* Rebuilds reading order for extracted fragments: groups fragments that share
|
|
30540
|
+
* the same baseline (row) and, for rows containing RTL content, emits the
|
|
30541
|
+
* right-most fragment first (Adobe-style RTL line reconstruction). LTR-only
|
|
30542
|
+
* rows keep the original (left-to-right) order.
|
|
30543
|
+
*
|
|
30544
|
+
* @param {_TextFragment[]} fragments - Fragments in content stream order.
|
|
30545
|
+
* @returns {_TextFragment[]} Fragments in reading order.
|
|
30546
|
+
* @private
|
|
30547
|
+
*/
|
|
30548
|
+
function _reorderFragmentsForRtlReading(fragments) {
|
|
30549
|
+
if (!fragments || fragments.length < 2) {
|
|
30550
|
+
return fragments;
|
|
30551
|
+
}
|
|
30552
|
+
var hasRtl = false;
|
|
30553
|
+
for (var i = 0; i < fragments.length; i++) {
|
|
30554
|
+
var fragment = fragments[Number.parseInt(i.toString(), 10)];
|
|
30555
|
+
if (fragment && _containsRtlCharacter(fragment.text)) {
|
|
30556
|
+
hasRtl = true;
|
|
30557
|
+
break;
|
|
30558
|
+
}
|
|
30559
|
+
}
|
|
30560
|
+
if (!hasRtl) {
|
|
30561
|
+
return fragments;
|
|
30562
|
+
}
|
|
30563
|
+
var tolerance = _getRtlRowTolerance(fragments);
|
|
30564
|
+
var rows = [];
|
|
30565
|
+
for (var i = 0; i < fragments.length; i++) {
|
|
30566
|
+
var fragment = fragments[Number.parseInt(i.toString(), 10)];
|
|
30567
|
+
if (!fragment || !fragment.bounds) {
|
|
30568
|
+
continue;
|
|
30569
|
+
}
|
|
30570
|
+
var placed = false;
|
|
30571
|
+
for (var r = 0; r < rows.length; r++) {
|
|
30572
|
+
var row = rows[Number.parseInt(r.toString(), 10)];
|
|
30573
|
+
var reference = row[0];
|
|
30574
|
+
if (_isSameRtlRow(reference.bounds, fragment.bounds, tolerance)) {
|
|
30575
|
+
row.push(fragment);
|
|
30576
|
+
placed = true;
|
|
30577
|
+
break;
|
|
30578
|
+
}
|
|
30579
|
+
}
|
|
30580
|
+
if (!placed) {
|
|
30581
|
+
rows.push([fragment]);
|
|
30582
|
+
}
|
|
30583
|
+
}
|
|
30584
|
+
var ordered = [];
|
|
30585
|
+
rows.sort(function (a, b) { return a[0].bounds.y - b[0].bounds.y; });
|
|
30586
|
+
for (var r = 0; r < rows.length; r++) {
|
|
30587
|
+
var row = rows[Number.parseInt(r.toString(), 10)];
|
|
30588
|
+
var rowHasRtl = row.some(function (fragment) { return _containsRtlCharacter(fragment.text); });
|
|
30589
|
+
if (rowHasRtl) {
|
|
30590
|
+
row.sort(function (a, b) { return b.bounds.x - a.bounds.x; });
|
|
30591
|
+
}
|
|
30592
|
+
else {
|
|
30593
|
+
row.sort(function (a, b) { return a.bounds.x - b.bounds.x; });
|
|
30594
|
+
}
|
|
30595
|
+
for (var i = 0; i < row.length; i++) {
|
|
30596
|
+
ordered.push(row[Number.parseInt(i.toString(), 10)]);
|
|
30597
|
+
}
|
|
30598
|
+
}
|
|
30599
|
+
return ordered;
|
|
30600
|
+
}
|
|
30601
|
+
/**
|
|
30602
|
+
* Computes the vertical tolerance used to decide whether two fragments share
|
|
30603
|
+
* the same text row (fraction of the dominant fragment height).
|
|
30604
|
+
*
|
|
30605
|
+
* @param {_TextFragment[]} fragments - Fragments being grouped.
|
|
30606
|
+
* @returns {number} Row-grouping tolerance in page units.
|
|
30607
|
+
* @private
|
|
30608
|
+
*/
|
|
30609
|
+
function _getRtlRowTolerance(fragments) {
|
|
30610
|
+
var totalHeight = 0;
|
|
30611
|
+
var count = 0;
|
|
30612
|
+
for (var i = 0; i < fragments.length; i++) {
|
|
30613
|
+
var fragment = fragments[Number.parseInt(i.toString(), 10)];
|
|
30614
|
+
if (fragment && fragment.bounds && fragment.bounds.height > 0) {
|
|
30615
|
+
totalHeight += fragment.bounds.height;
|
|
30616
|
+
count++;
|
|
30617
|
+
}
|
|
30618
|
+
}
|
|
30619
|
+
if (count === 0) {
|
|
30620
|
+
return 2;
|
|
30621
|
+
}
|
|
30622
|
+
return Math.max(2, (totalHeight / count) * 0.5);
|
|
30623
|
+
}
|
|
30624
|
+
/**
|
|
30625
|
+
* Determines whether two fragment bounds belong to the same text row.
|
|
30626
|
+
*
|
|
30627
|
+
* @param {{ y: number, height: number }} first - First fragment bounds.
|
|
30628
|
+
* @param {number} first.y - Y-coordinate of the first fragment.
|
|
30629
|
+
* @param {number} first.height - Height of the first fragment.
|
|
30630
|
+
* @param {{ y: number, height: number }} second - Second fragment bounds.
|
|
30631
|
+
* @param {number} second.y - Y-coordinate of the second fragment.
|
|
30632
|
+
* @param {number} second.height - Height of the second fragment.
|
|
30633
|
+
* @param {number} tolerance - Vertical tolerance for row grouping.
|
|
30634
|
+
* @returns {boolean} True when both fragments are on the same row.
|
|
30635
|
+
* @private
|
|
30636
|
+
*/
|
|
30637
|
+
function _isSameRtlRow(first, second, tolerance) {
|
|
30638
|
+
var firstCenter = first.y + first.height / 2;
|
|
30639
|
+
var secondCenter = second.y + second.height / 2;
|
|
30640
|
+
return Math.abs(firstCenter - secondCenter) <= tolerance;
|
|
30641
|
+
}
|
|
30642
|
+
var arabicPresentationForms = {
|
|
30643
|
+
0xFB50: '\u0671',
|
|
30644
|
+
0xFB51: '\u0671',
|
|
30645
|
+
0xFB52: '\u067b',
|
|
30646
|
+
0xFB53: '\u067b',
|
|
30647
|
+
0xFB54: '\u067b',
|
|
30648
|
+
0xFB55: '\u067b',
|
|
30649
|
+
0xFB56: '\u067e',
|
|
30650
|
+
0xFB57: '\u067e',
|
|
30651
|
+
0xFB58: '\u067e',
|
|
30652
|
+
0xFB59: '\u067e',
|
|
30653
|
+
0xFB5A: '\u0680',
|
|
30654
|
+
0xFB5B: '\u0680',
|
|
30655
|
+
0xFB5C: '\u0680',
|
|
30656
|
+
0xFB5D: '\u0680',
|
|
30657
|
+
0xFB5E: '\u067a',
|
|
30658
|
+
0xFB5F: '\u067a',
|
|
30659
|
+
0xFB60: '\u067a',
|
|
30660
|
+
0xFB61: '\u067a',
|
|
30661
|
+
0xFB62: '\u067f',
|
|
30662
|
+
0xFB63: '\u067f',
|
|
30663
|
+
0xFB64: '\u067f',
|
|
30664
|
+
0xFB65: '\u067f',
|
|
30665
|
+
0xFB66: '\u0679',
|
|
30666
|
+
0xFB67: '\u0679',
|
|
30667
|
+
0xFB68: '\u0679',
|
|
30668
|
+
0xFB69: '\u0679',
|
|
30669
|
+
0xFB6A: '\u06a4',
|
|
30670
|
+
0xFB6B: '\u06a4',
|
|
30671
|
+
0xFB6C: '\u06a4',
|
|
30672
|
+
0xFB6D: '\u06a4',
|
|
30673
|
+
0xFB6E: '\u06a6',
|
|
30674
|
+
0xFB6F: '\u06a6',
|
|
30675
|
+
0xFB70: '\u06a6',
|
|
30676
|
+
0xFB71: '\u06a6',
|
|
30677
|
+
0xFB72: '\u0684',
|
|
30678
|
+
0xFB73: '\u0684',
|
|
30679
|
+
0xFB74: '\u0684',
|
|
30680
|
+
0xFB75: '\u0684',
|
|
30681
|
+
0xFB76: '\u0683',
|
|
30682
|
+
0xFB77: '\u0683',
|
|
30683
|
+
0xFB78: '\u0683',
|
|
30684
|
+
0xFB79: '\u0683',
|
|
30685
|
+
0xFB7A: '\u0686',
|
|
30686
|
+
0xFB7B: '\u0686',
|
|
30687
|
+
0xFB7C: '\u0686',
|
|
30688
|
+
0xFB7D: '\u0686',
|
|
30689
|
+
0xFB7E: '\u0687',
|
|
30690
|
+
0xFB7F: '\u0687',
|
|
30691
|
+
0xFB80: '\u0687',
|
|
30692
|
+
0xFB81: '\u0687',
|
|
30693
|
+
0xFB82: '\u068d',
|
|
30694
|
+
0xFB83: '\u068d',
|
|
30695
|
+
0xFB84: '\u068c',
|
|
30696
|
+
0xFB85: '\u068c',
|
|
30697
|
+
0xFB86: '\u068e',
|
|
30698
|
+
0xFB87: '\u068e',
|
|
30699
|
+
0xFB88: '\u0688',
|
|
30700
|
+
0xFB89: '\u0688',
|
|
30701
|
+
0xFB8A: '\u0698',
|
|
30702
|
+
0xFB8B: '\u0698',
|
|
30703
|
+
0xFB8C: '\u0691',
|
|
30704
|
+
0xFB8D: '\u0691',
|
|
30705
|
+
0xFB8E: '\u06a9',
|
|
30706
|
+
0xFB8F: '\u06a9',
|
|
30707
|
+
0xFB90: '\u06a9',
|
|
30708
|
+
0xFB91: '\u06a9',
|
|
30709
|
+
0xFB92: '\u06af',
|
|
30710
|
+
0xFB93: '\u06af',
|
|
30711
|
+
0xFB94: '\u06af',
|
|
30712
|
+
0xFB95: '\u06af',
|
|
30713
|
+
0xFB96: '\u06b3',
|
|
30714
|
+
0xFB97: '\u06b3',
|
|
30715
|
+
0xFB98: '\u06b3',
|
|
30716
|
+
0xFB99: '\u06b3',
|
|
30717
|
+
0xFB9A: '\u06b1',
|
|
30718
|
+
0xFB9B: '\u06b1',
|
|
30719
|
+
0xFB9C: '\u06b1',
|
|
30720
|
+
0xFB9D: '\u06b1',
|
|
30721
|
+
0xFB9E: '\u06ba',
|
|
30722
|
+
0xFB9F: '\u06ba',
|
|
30723
|
+
0xFBA0: '\u06bb',
|
|
30724
|
+
0xFBA1: '\u06bb',
|
|
30725
|
+
0xFBA2: '\u06bb',
|
|
30726
|
+
0xFBA3: '\u06bb',
|
|
30727
|
+
0xFBA4: '\u06c0',
|
|
30728
|
+
0xFBA5: '\u06c0',
|
|
30729
|
+
0xFBA6: '\u06c1',
|
|
30730
|
+
0xFBA7: '\u06c1',
|
|
30731
|
+
0xFBA8: '\u06c1',
|
|
30732
|
+
0xFBA9: '\u06c1',
|
|
30733
|
+
0xFBAA: '\u06be',
|
|
30734
|
+
0xFBAB: '\u06be',
|
|
30735
|
+
0xFBAC: '\u06be',
|
|
30736
|
+
0xFBAD: '\u06be',
|
|
30737
|
+
0xFBAE: '\u06d2',
|
|
30738
|
+
0xFBAF: '\u06d2',
|
|
30739
|
+
0xFBB0: '\u06d3',
|
|
30740
|
+
0xFBB1: '\u06d3',
|
|
30741
|
+
0xFBD3: '\u06ad',
|
|
30742
|
+
0xFBD4: '\u06ad',
|
|
30743
|
+
0xFBD5: '\u06ad',
|
|
30744
|
+
0xFBD6: '\u06ad',
|
|
30745
|
+
0xFBD7: '\u06c7',
|
|
30746
|
+
0xFBD8: '\u06c7',
|
|
30747
|
+
0xFBD9: '\u06c6',
|
|
30748
|
+
0xFBDA: '\u06c6',
|
|
30749
|
+
0xFBDB: '\u06c8',
|
|
30750
|
+
0xFBDC: '\u06c8',
|
|
30751
|
+
0xFBDD: '\u06c7\u0674',
|
|
30752
|
+
0xFBDE: '\u06cb',
|
|
30753
|
+
0xFBDF: '\u06cb',
|
|
30754
|
+
0xFBE0: '\u06c5',
|
|
30755
|
+
0xFBE1: '\u06c5',
|
|
30756
|
+
0xFBE2: '\u06c9',
|
|
30757
|
+
0xFBE3: '\u06c9',
|
|
30758
|
+
0xFBE4: '\u06d0',
|
|
30759
|
+
0xFBE5: '\u06d0',
|
|
30760
|
+
0xFBE6: '\u06d0',
|
|
30761
|
+
0xFBE7: '\u06d0',
|
|
30762
|
+
0xFBE8: '\u0649',
|
|
30763
|
+
0xFBE9: '\u0649',
|
|
30764
|
+
0xFBEA: '\u0626\u0627',
|
|
30765
|
+
0xFBEB: '\u0626\u0627',
|
|
30766
|
+
0xFBEC: '\u0626\u06d5',
|
|
30767
|
+
0xFBED: '\u0626\u06d5',
|
|
30768
|
+
0xFBEE: '\u0626\u0648',
|
|
30769
|
+
0xFBEF: '\u0626\u0648',
|
|
30770
|
+
0xFBF0: '\u0626\u06c7',
|
|
30771
|
+
0xFBF1: '\u0626\u06c7',
|
|
30772
|
+
0xFBF2: '\u0626\u06c6',
|
|
30773
|
+
0xFBF3: '\u0626\u06c6',
|
|
30774
|
+
0xFBF4: '\u0626\u06c8',
|
|
30775
|
+
0xFBF5: '\u0626\u06c8',
|
|
30776
|
+
0xFBF6: '\u0626\u06d0',
|
|
30777
|
+
0xFBF7: '\u0626\u06d0',
|
|
30778
|
+
0xFBF8: '\u0626\u06d0',
|
|
30779
|
+
0xFBF9: '\u0626\u0649',
|
|
30780
|
+
0xFBFA: '\u0626\u0649',
|
|
30781
|
+
0xFBFB: '\u0626\u0649',
|
|
30782
|
+
0xFBFC: '\u06cc',
|
|
30783
|
+
0xFBFD: '\u06cc',
|
|
30784
|
+
0xFBFE: '\u06cc',
|
|
30785
|
+
0xFBFF: '\u06cc',
|
|
30786
|
+
0xFC00: '\u0626\u062c',
|
|
30787
|
+
0xFC01: '\u0626\u062d',
|
|
30788
|
+
0xFC02: '\u0626\u0645',
|
|
30789
|
+
0xFC03: '\u0626\u0649',
|
|
30790
|
+
0xFC04: '\u0626\u064a',
|
|
30791
|
+
0xFC05: '\u0628\u062c',
|
|
30792
|
+
0xFC06: '\u0628\u062d',
|
|
30793
|
+
0xFC07: '\u0628\u062e',
|
|
30794
|
+
0xFC08: '\u0628\u0645',
|
|
30795
|
+
0xFC09: '\u0628\u0649',
|
|
30796
|
+
0xFC0A: '\u0628\u064a',
|
|
30797
|
+
0xFC0B: '\u062a\u062c',
|
|
30798
|
+
0xFC0C: '\u062a\u062d',
|
|
30799
|
+
0xFC0D: '\u062a\u062e',
|
|
30800
|
+
0xFC0E: '\u062a\u0645',
|
|
30801
|
+
0xFC0F: '\u062a\u0649',
|
|
30802
|
+
0xFC10: '\u062a\u064a',
|
|
30803
|
+
0xFC11: '\u062b\u062c',
|
|
30804
|
+
0xFC12: '\u062b\u0645',
|
|
30805
|
+
0xFC13: '\u062b\u0649',
|
|
30806
|
+
0xFC14: '\u062b\u064a',
|
|
30807
|
+
0xFC15: '\u062c\u062d',
|
|
30808
|
+
0xFC16: '\u062c\u0645',
|
|
30809
|
+
0xFC17: '\u062d\u062c',
|
|
30810
|
+
0xFC18: '\u062d\u0645',
|
|
30811
|
+
0xFC19: '\u062e\u062c',
|
|
30812
|
+
0xFC1A: '\u062e\u062d',
|
|
30813
|
+
0xFC1B: '\u062e\u0645',
|
|
30814
|
+
0xFC1C: '\u0633\u062c',
|
|
30815
|
+
0xFC1D: '\u0633\u062d',
|
|
30816
|
+
0xFC1E: '\u0633\u062e',
|
|
30817
|
+
0xFC1F: '\u0633\u0645',
|
|
30818
|
+
0xFC20: '\u0635\u062d',
|
|
30819
|
+
0xFC21: '\u0635\u0645',
|
|
30820
|
+
0xFC22: '\u0636\u062c',
|
|
30821
|
+
0xFC23: '\u0636\u062d',
|
|
30822
|
+
0xFC24: '\u0636\u062e',
|
|
30823
|
+
0xFC25: '\u0636\u0645',
|
|
30824
|
+
0xFC26: '\u0637\u062d',
|
|
30825
|
+
0xFC27: '\u0637\u0645',
|
|
30826
|
+
0xFC28: '\u0638\u0645',
|
|
30827
|
+
0xFC29: '\u0639\u062c',
|
|
30828
|
+
0xFC2A: '\u0639\u0645',
|
|
30829
|
+
0xFC2B: '\u063a\u062c',
|
|
30830
|
+
0xFC2C: '\u063a\u0645',
|
|
30831
|
+
0xFC2D: '\u0641\u062c',
|
|
30832
|
+
0xFC2E: '\u0641\u062d',
|
|
30833
|
+
0xFC2F: '\u0641\u062e',
|
|
30834
|
+
0xFC30: '\u0641\u0645',
|
|
30835
|
+
0xFC31: '\u0641\u0649',
|
|
30836
|
+
0xFC32: '\u0641\u064a',
|
|
30837
|
+
0xFC33: '\u0642\u062d',
|
|
30838
|
+
0xFC34: '\u0642\u0645',
|
|
30839
|
+
0xFC35: '\u0642\u0649',
|
|
30840
|
+
0xFC36: '\u0642\u064a',
|
|
30841
|
+
0xFC37: '\u0643\u0627',
|
|
30842
|
+
0xFC38: '\u0643\u062c',
|
|
30843
|
+
0xFC39: '\u0643\u062d',
|
|
30844
|
+
0xFC3A: '\u0643\u062e',
|
|
30845
|
+
0xFC3B: '\u0643\u0644',
|
|
30846
|
+
0xFC3C: '\u0643\u0645',
|
|
30847
|
+
0xFC3D: '\u0643\u0649',
|
|
30848
|
+
0xFC3E: '\u0643\u064a',
|
|
30849
|
+
0xFC3F: '\u0644\u062c',
|
|
30850
|
+
0xFC40: '\u0644\u062d',
|
|
30851
|
+
0xFC41: '\u0644\u062e',
|
|
30852
|
+
0xFC42: '\u0644\u0645',
|
|
30853
|
+
0xFC43: '\u0644\u0649',
|
|
30854
|
+
0xFC44: '\u0644\u064a',
|
|
30855
|
+
0xFC45: '\u0645\u062c',
|
|
30856
|
+
0xFC46: '\u0645\u062d',
|
|
30857
|
+
0xFC47: '\u0645\u062e',
|
|
30858
|
+
0xFC48: '\u0645\u0645',
|
|
30859
|
+
0xFC49: '\u0645\u0649',
|
|
30860
|
+
0xFC4A: '\u0645\u064a',
|
|
30861
|
+
0xFC4B: '\u0646\u062c',
|
|
30862
|
+
0xFC4C: '\u0646\u062d',
|
|
30863
|
+
0xFC4D: '\u0646\u062e',
|
|
30864
|
+
0xFC4E: '\u0646\u0645',
|
|
30865
|
+
0xFC4F: '\u0646\u0649',
|
|
30866
|
+
0xFC50: '\u0646\u064a',
|
|
30867
|
+
0xFC51: '\u0647\u062c',
|
|
30868
|
+
0xFC52: '\u0647\u0645',
|
|
30869
|
+
0xFC53: '\u0647\u0649',
|
|
30870
|
+
0xFC54: '\u0647\u064a',
|
|
30871
|
+
0xFC55: '\u064a\u062c',
|
|
30872
|
+
0xFC56: '\u064a\u062d',
|
|
30873
|
+
0xFC57: '\u064a\u062e',
|
|
30874
|
+
0xFC58: '\u064a\u0645',
|
|
30875
|
+
0xFC59: '\u064a\u0649',
|
|
30876
|
+
0xFC5A: '\u064a\u064a',
|
|
30877
|
+
0xFC5B: '\u0630\u0670',
|
|
30878
|
+
0xFC5C: '\u0631\u0670',
|
|
30879
|
+
0xFC5D: '\u0649\u0670',
|
|
30880
|
+
0xFC5E: '\u064c\u0651',
|
|
30881
|
+
0xFC5F: '\u064d\u0651',
|
|
30882
|
+
0xFC60: '\u064e\u0651',
|
|
30883
|
+
0xFC61: '\u064f\u0651',
|
|
30884
|
+
0xFC62: '\u0650\u0651',
|
|
30885
|
+
0xFC63: '\u0651\u0670',
|
|
30886
|
+
0xFC64: '\u0626\u0631',
|
|
30887
|
+
0xFC65: '\u0626\u0632',
|
|
30888
|
+
0xFC66: '\u0626\u0645',
|
|
30889
|
+
0xFC67: '\u0626\u0646',
|
|
30890
|
+
0xFC68: '\u0626\u0649',
|
|
30891
|
+
0xFC69: '\u0626\u064a',
|
|
30892
|
+
0xFC6A: '\u0628\u0631',
|
|
30893
|
+
0xFC6B: '\u0628\u0632',
|
|
30894
|
+
0xFC6C: '\u0628\u0645',
|
|
30895
|
+
0xFC6D: '\u0628\u0646',
|
|
30896
|
+
0xFC6E: '\u0628\u0649',
|
|
30897
|
+
0xFC6F: '\u0628\u064a',
|
|
30898
|
+
0xFC70: '\u062a\u0631',
|
|
30899
|
+
0xFC71: '\u062a\u0632',
|
|
30900
|
+
0xFC72: '\u062a\u0645',
|
|
30901
|
+
0xFC73: '\u062a\u0646',
|
|
30902
|
+
0xFC74: '\u062a\u0649',
|
|
30903
|
+
0xFC75: '\u062a\u064a',
|
|
30904
|
+
0xFC76: '\u062b\u0631',
|
|
30905
|
+
0xFC77: '\u062b\u0632',
|
|
30906
|
+
0xFC78: '\u062b\u0645',
|
|
30907
|
+
0xFC79: '\u062b\u0646',
|
|
30908
|
+
0xFC7A: '\u062b\u0649',
|
|
30909
|
+
0xFC7B: '\u062b\u064a',
|
|
30910
|
+
0xFC7C: '\u0641\u0649',
|
|
30911
|
+
0xFC7D: '\u0641\u064a',
|
|
30912
|
+
0xFC7E: '\u0642\u0649',
|
|
30913
|
+
0xFC7F: '\u0642\u064a',
|
|
30914
|
+
0xFC80: '\u0643\u0627',
|
|
30915
|
+
0xFC81: '\u0643\u0644',
|
|
30916
|
+
0xFC82: '\u0643\u0645',
|
|
30917
|
+
0xFC83: '\u0643\u0649',
|
|
30918
|
+
0xFC84: '\u0643\u064a',
|
|
30919
|
+
0xFC85: '\u0644\u0645',
|
|
30920
|
+
0xFC86: '\u0644\u0649',
|
|
30921
|
+
0xFC87: '\u0644\u064a',
|
|
30922
|
+
0xFC88: '\u0645\u0627',
|
|
30923
|
+
0xFC89: '\u0645\u0645',
|
|
30924
|
+
0xFC8A: '\u0646\u0631',
|
|
30925
|
+
0xFC8B: '\u0646\u0632',
|
|
30926
|
+
0xFC8C: '\u0646\u0645',
|
|
30927
|
+
0xFC8D: '\u0646\u0646',
|
|
30928
|
+
0xFC8E: '\u0646\u0649',
|
|
30929
|
+
0xFC8F: '\u0646\u064a',
|
|
30930
|
+
0xFC90: '\u0649\u0670',
|
|
30931
|
+
0xFC91: '\u064a\u0631',
|
|
30932
|
+
0xFC92: '\u064a\u0632',
|
|
30933
|
+
0xFC93: '\u064a\u0645',
|
|
30934
|
+
0xFC94: '\u064a\u0646',
|
|
30935
|
+
0xFC95: '\u064a\u0649',
|
|
30936
|
+
0xFC96: '\u064a\u064a',
|
|
30937
|
+
0xFC97: '\u0626\u062c',
|
|
30938
|
+
0xFC98: '\u0626\u062d',
|
|
30939
|
+
0xFC99: '\u0626\u062e',
|
|
30940
|
+
0xFC9A: '\u0626\u0645',
|
|
30941
|
+
0xFC9B: '\u0626\u0647',
|
|
30942
|
+
0xFC9C: '\u0628\u062c',
|
|
30943
|
+
0xFC9D: '\u0628\u062d',
|
|
30944
|
+
0xFC9E: '\u0628\u062e',
|
|
30945
|
+
0xFC9F: '\u0628\u0645',
|
|
30946
|
+
0xFCA0: '\u0628\u0647',
|
|
30947
|
+
0xFCA1: '\u062a\u062c',
|
|
30948
|
+
0xFCA2: '\u062a\u062d',
|
|
30949
|
+
0xFCA3: '\u062a\u062e',
|
|
30950
|
+
0xFCA4: '\u062a\u0645',
|
|
30951
|
+
0xFCA5: '\u062a\u0647',
|
|
30952
|
+
0xFCA6: '\u062b\u0645',
|
|
30953
|
+
0xFCA7: '\u062c\u062d',
|
|
30954
|
+
0xFCA8: '\u062c\u0645',
|
|
30955
|
+
0xFCA9: '\u062d\u062c',
|
|
30956
|
+
0xFCAA: '\u062d\u0645',
|
|
30957
|
+
0xFCAB: '\u062e\u062c',
|
|
30958
|
+
0xFCAC: '\u062e\u0645',
|
|
30959
|
+
0xFCAD: '\u0633\u062c',
|
|
30960
|
+
0xFCAE: '\u0633\u062d',
|
|
30961
|
+
0xFCAF: '\u0633\u062e',
|
|
30962
|
+
0xFCB0: '\u0633\u0645',
|
|
30963
|
+
0xFCB1: '\u0635\u062d',
|
|
30964
|
+
0xFCB2: '\u0635\u062e',
|
|
30965
|
+
0xFCB3: '\u0635\u0645',
|
|
30966
|
+
0xFCB4: '\u0636\u062c',
|
|
30967
|
+
0xFCB5: '\u0636\u062d',
|
|
30968
|
+
0xFCB6: '\u0636\u062e',
|
|
30969
|
+
0xFCB7: '\u0636\u0645',
|
|
30970
|
+
0xFCB8: '\u0637\u062d',
|
|
30971
|
+
0xFCB9: '\u0638\u0645',
|
|
30972
|
+
0xFCBA: '\u0639\u062c',
|
|
30973
|
+
0xFCBB: '\u0639\u0645',
|
|
30974
|
+
0xFCBC: '\u063a\u062c',
|
|
30975
|
+
0xFCBD: '\u063a\u0645',
|
|
30976
|
+
0xFCBE: '\u0641\u062c',
|
|
30977
|
+
0xFCBF: '\u0641\u062d',
|
|
30978
|
+
0xFCC0: '\u0641\u062e',
|
|
30979
|
+
0xFCC1: '\u0641\u0645',
|
|
30980
|
+
0xFCC2: '\u0642\u062d',
|
|
30981
|
+
0xFCC3: '\u0642\u0645',
|
|
30982
|
+
0xFCC4: '\u0643\u062c',
|
|
30983
|
+
0xFCC5: '\u0643\u062d',
|
|
30984
|
+
0xFCC6: '\u0643\u062e',
|
|
30985
|
+
0xFCC7: '\u0643\u0644',
|
|
30986
|
+
0xFCC8: '\u0643\u0645',
|
|
30987
|
+
0xFCC9: '\u0644\u062c',
|
|
30988
|
+
0xFCCA: '\u0644\u062d',
|
|
30989
|
+
0xFCCB: '\u0644\u062e',
|
|
30990
|
+
0xFCCC: '\u0644\u0645',
|
|
30991
|
+
0xFCCD: '\u0644\u0647',
|
|
30992
|
+
0xFCCE: '\u0645\u062c',
|
|
30993
|
+
0xFCCF: '\u0645\u062d',
|
|
30994
|
+
0xFCD0: '\u0645\u062e',
|
|
30995
|
+
0xFCD1: '\u0645\u0645',
|
|
30996
|
+
0xFCD2: '\u0646\u062c',
|
|
30997
|
+
0xFCD3: '\u0646\u062d',
|
|
30998
|
+
0xFCD4: '\u0646\u062e',
|
|
30999
|
+
0xFCD5: '\u0646\u0645',
|
|
31000
|
+
0xFCD6: '\u0646\u0647',
|
|
31001
|
+
0xFCD7: '\u0647\u062c',
|
|
31002
|
+
0xFCD8: '\u0647\u0645',
|
|
31003
|
+
0xFCD9: '\u0647\u0670',
|
|
31004
|
+
0xFCDA: '\u064a\u062c',
|
|
31005
|
+
0xFCDB: '\u064a\u062d',
|
|
31006
|
+
0xFCDC: '\u064a\u062e',
|
|
31007
|
+
0xFCDD: '\u064a\u0645',
|
|
31008
|
+
0xFCDE: '\u064a\u0647',
|
|
31009
|
+
0xFCDF: '\u0626\u0645',
|
|
31010
|
+
0xFCE0: '\u0626\u0647',
|
|
31011
|
+
0xFCE1: '\u0628\u0645',
|
|
31012
|
+
0xFCE2: '\u0628\u0647',
|
|
31013
|
+
0xFCE3: '\u062a\u0645',
|
|
31014
|
+
0xFCE4: '\u062a\u0647',
|
|
31015
|
+
0xFCE5: '\u062b\u0645',
|
|
31016
|
+
0xFCE6: '\u062b\u0647',
|
|
31017
|
+
0xFCE7: '\u0633\u0645',
|
|
31018
|
+
0xFCE8: '\u0633\u0647',
|
|
31019
|
+
0xFCE9: '\u0634\u0645',
|
|
31020
|
+
0xFCEA: '\u0634\u0647',
|
|
31021
|
+
0xFCEB: '\u0643\u0644',
|
|
31022
|
+
0xFCEC: '\u0643\u0645',
|
|
31023
|
+
0xFCED: '\u0644\u0645',
|
|
31024
|
+
0xFCEE: '\u0646\u0645',
|
|
31025
|
+
0xFCEF: '\u0646\u0647',
|
|
31026
|
+
0xFCF0: '\u064a\u0645',
|
|
31027
|
+
0xFCF1: '\u064a\u0647',
|
|
31028
|
+
0xFCF2: '\u0640\u064e\u0651',
|
|
31029
|
+
0xFCF3: '\u0640\u064f\u0651',
|
|
31030
|
+
0xFCF4: '\u0640\u0650\u0651',
|
|
31031
|
+
0xFCF5: '\u0637\u0649',
|
|
31032
|
+
0xFCF6: '\u0637\u064a',
|
|
31033
|
+
0xFCF7: '\u0639\u0649',
|
|
31034
|
+
0xFCF8: '\u0639\u064a',
|
|
31035
|
+
0xFCF9: '\u063a\u0649',
|
|
31036
|
+
0xFCFA: '\u063a\u064a',
|
|
31037
|
+
0xFCFB: '\u0633\u0649',
|
|
31038
|
+
0xFCFC: '\u0633\u064a',
|
|
31039
|
+
0xFCFD: '\u0634\u0649',
|
|
31040
|
+
0xFCFE: '\u0634\u064a',
|
|
31041
|
+
0xFCFF: '\u062d\u0649',
|
|
31042
|
+
0xFD00: '\u062d\u064a',
|
|
31043
|
+
0xFD01: '\u062c\u0649',
|
|
31044
|
+
0xFD02: '\u062c\u064a',
|
|
31045
|
+
0xFD03: '\u062e\u0649',
|
|
31046
|
+
0xFD04: '\u062e\u064a',
|
|
31047
|
+
0xFD05: '\u0635\u0649',
|
|
31048
|
+
0xFD06: '\u0635\u064a',
|
|
31049
|
+
0xFD07: '\u0636\u0649',
|
|
31050
|
+
0xFD08: '\u0636\u064a',
|
|
31051
|
+
0xFD09: '\u0634\u062c',
|
|
31052
|
+
0xFD0A: '\u0634\u062d',
|
|
31053
|
+
0xFD0B: '\u0634\u062e',
|
|
31054
|
+
0xFD0C: '\u0634\u0645',
|
|
31055
|
+
0xFD0D: '\u0634\u0631',
|
|
31056
|
+
0xFD0E: '\u0633\u0631',
|
|
31057
|
+
0xFD0F: '\u0635\u0631',
|
|
31058
|
+
0xFD10: '\u0636\u0631',
|
|
31059
|
+
0xFD11: '\u0637\u0649',
|
|
31060
|
+
0xFD12: '\u0637\u064a',
|
|
31061
|
+
0xFD13: '\u0639\u0649',
|
|
31062
|
+
0xFD14: '\u0639\u064a',
|
|
31063
|
+
0xFD15: '\u063a\u0649',
|
|
31064
|
+
0xFD16: '\u063a\u064a',
|
|
31065
|
+
0xFD17: '\u0633\u0649',
|
|
31066
|
+
0xFD18: '\u0633\u064a',
|
|
31067
|
+
0xFD19: '\u0634\u0649',
|
|
31068
|
+
0xFD1A: '\u0634\u064a',
|
|
31069
|
+
0xFD1B: '\u062d\u0649',
|
|
31070
|
+
0xFD1C: '\u062d\u064a',
|
|
31071
|
+
0xFD1D: '\u062c\u0649',
|
|
31072
|
+
0xFD1E: '\u062c\u064a',
|
|
31073
|
+
0xFD1F: '\u062e\u0649',
|
|
31074
|
+
0xFD20: '\u062e\u064a',
|
|
31075
|
+
0xFD21: '\u0635\u0649',
|
|
31076
|
+
0xFD22: '\u0635\u064a',
|
|
31077
|
+
0xFD23: '\u0636\u0649',
|
|
31078
|
+
0xFD24: '\u0636\u064a',
|
|
31079
|
+
0xFD25: '\u0634\u062c',
|
|
31080
|
+
0xFD26: '\u0634\u062d',
|
|
31081
|
+
0xFD27: '\u0634\u062e',
|
|
31082
|
+
0xFD28: '\u0634\u0645',
|
|
31083
|
+
0xFD29: '\u0634\u0631',
|
|
31084
|
+
0xFD2A: '\u0633\u0631',
|
|
31085
|
+
0xFD2B: '\u0635\u0631',
|
|
31086
|
+
0xFD2C: '\u0636\u0631',
|
|
31087
|
+
0xFD2D: '\u0634\u062c',
|
|
31088
|
+
0xFD2E: '\u0634\u062d',
|
|
31089
|
+
0xFD2F: '\u0634\u062e',
|
|
31090
|
+
0xFD30: '\u0634\u0645',
|
|
31091
|
+
0xFD31: '\u0633\u0647',
|
|
31092
|
+
0xFD32: '\u0634\u0647',
|
|
31093
|
+
0xFD33: '\u0637\u0645',
|
|
31094
|
+
0xFD34: '\u0633\u062c',
|
|
31095
|
+
0xFD35: '\u0633\u062d',
|
|
31096
|
+
0xFD36: '\u0633\u062e',
|
|
31097
|
+
0xFD37: '\u0634\u062c',
|
|
31098
|
+
0xFD38: '\u0634\u062d',
|
|
31099
|
+
0xFD39: '\u0634\u062e',
|
|
31100
|
+
0xFD3A: '\u0637\u0645',
|
|
31101
|
+
0xFD3B: '\u0638\u0645',
|
|
31102
|
+
0xFD3C: '\u0627\u064b',
|
|
31103
|
+
0xFD3D: '\u0627\u064b',
|
|
31104
|
+
0xFD50: '\u062a\u062c\u0645',
|
|
31105
|
+
0xFD51: '\u062a\u062d\u062c',
|
|
31106
|
+
0xFD52: '\u062a\u062d\u062c',
|
|
31107
|
+
0xFD53: '\u062a\u062d\u0645',
|
|
31108
|
+
0xFD54: '\u062a\u062e\u0645',
|
|
31109
|
+
0xFD55: '\u062a\u0645\u062c',
|
|
31110
|
+
0xFD56: '\u062a\u0645\u062d',
|
|
31111
|
+
0xFD57: '\u062a\u0645\u062e',
|
|
31112
|
+
0xFD58: '\u062c\u0645\u062d',
|
|
31113
|
+
0xFD59: '\u062c\u0645\u062d',
|
|
31114
|
+
0xFD5A: '\u062d\u0645\u064a',
|
|
31115
|
+
0xFD5B: '\u062d\u0645\u0649',
|
|
31116
|
+
0xFD5C: '\u0633\u062d\u062c',
|
|
31117
|
+
0xFD5D: '\u0633\u062c\u062d',
|
|
31118
|
+
0xFD5E: '\u0633\u062c\u0649',
|
|
31119
|
+
0xFD5F: '\u0633\u0645\u062d',
|
|
31120
|
+
0xFD60: '\u0633\u0645\u062d',
|
|
31121
|
+
0xFD61: '\u0633\u0645\u062c',
|
|
31122
|
+
0xFD62: '\u0633\u0645\u0645',
|
|
31123
|
+
0xFD63: '\u0633\u0645\u0645',
|
|
31124
|
+
0xFD64: '\u0635\u062d\u062d',
|
|
31125
|
+
0xFD65: '\u0635\u062d\u062d',
|
|
31126
|
+
0xFD66: '\u0635\u0645\u0645',
|
|
31127
|
+
0xFD67: '\u0634\u062d\u0645',
|
|
31128
|
+
0xFD68: '\u0634\u062d\u0645',
|
|
31129
|
+
0xFD69: '\u0634\u062c\u064a',
|
|
31130
|
+
0xFD6A: '\u0634\u0645\u062e',
|
|
31131
|
+
0xFD6B: '\u0634\u0645\u062e',
|
|
31132
|
+
0xFD6C: '\u0634\u0645\u0645',
|
|
31133
|
+
0xFD6D: '\u0634\u0645\u0645',
|
|
31134
|
+
0xFD6E: '\u0636\u062d\u0649',
|
|
31135
|
+
0xFD6F: '\u0636\u062e\u0645',
|
|
31136
|
+
0xFD70: '\u0636\u062e\u0645',
|
|
31137
|
+
0xFD71: '\u0637\u0645\u062d',
|
|
31138
|
+
0xFD72: '\u0637\u0645\u062d',
|
|
31139
|
+
0xFD73: '\u0637\u0645\u0645',
|
|
31140
|
+
0xFD74: '\u0637\u0645\u064a',
|
|
31141
|
+
0xFD75: '\u0639\u062c\u0645',
|
|
31142
|
+
0xFD76: '\u0639\u0645\u0645',
|
|
31143
|
+
0xFD77: '\u0639\u0645\u0645',
|
|
31144
|
+
0xFD78: '\u0639\u0645\u0649',
|
|
31145
|
+
0xFD79: '\u063a\u0645\u0645',
|
|
31146
|
+
0xFD7A: '\u063a\u0645\u064a',
|
|
31147
|
+
0xFD7B: '\u063a\u0645\u0649',
|
|
31148
|
+
0xFD7C: '\u0641\u062e\u0645',
|
|
31149
|
+
0xFD7D: '\u0641\u062e\u0645',
|
|
31150
|
+
0xFD7E: '\u0642\u0645\u062d',
|
|
31151
|
+
0xFD7F: '\u0642\u0645\u0645',
|
|
31152
|
+
0xFD80: '\u0644\u062d\u0645',
|
|
31153
|
+
0xFD81: '\u0644\u062d\u064a',
|
|
31154
|
+
0xFD82: '\u0644\u062d\u0649',
|
|
31155
|
+
0xFD83: '\u0644\u062c\u062c',
|
|
31156
|
+
0xFD84: '\u0644\u062c\u062c',
|
|
31157
|
+
0xFD85: '\u0644\u062e\u0645',
|
|
31158
|
+
0xFD86: '\u0644\u062e\u0645',
|
|
31159
|
+
0xFD87: '\u0644\u0645\u062d',
|
|
31160
|
+
0xFD88: '\u0644\u0645\u062d',
|
|
31161
|
+
0xFD89: '\u0645\u062d\u062c',
|
|
31162
|
+
0xFD8A: '\u0645\u062d\u0645',
|
|
31163
|
+
0xFD8B: '\u0645\u062d\u064a',
|
|
31164
|
+
0xFD8C: '\u0645\u062c\u062d',
|
|
31165
|
+
0xFD8D: '\u0645\u062c\u0645',
|
|
31166
|
+
0xFD8E: '\u0645\u062e\u062c',
|
|
31167
|
+
0xFD8F: '\u0645\u062e\u0645',
|
|
31168
|
+
0xFD92: '\u0645\u062c\u062e',
|
|
31169
|
+
0xFD93: '\u0647\u0645\u062c',
|
|
31170
|
+
0xFD94: '\u0647\u0645\u0645',
|
|
31171
|
+
0xFD95: '\u0646\u062d\u0645',
|
|
31172
|
+
0xFD96: '\u0646\u062d\u0649',
|
|
31173
|
+
0xFD97: '\u0646\u062c\u0645',
|
|
31174
|
+
0xFD98: '\u0646\u062c\u0645',
|
|
31175
|
+
0xFD99: '\u0646\u062c\u0649',
|
|
31176
|
+
0xFD9A: '\u0646\u0645\u064a',
|
|
31177
|
+
0xFD9B: '\u0646\u0645\u0649',
|
|
31178
|
+
0xFD9C: '\u064a\u0645\u0645',
|
|
31179
|
+
0xFD9D: '\u064a\u0645\u0645',
|
|
31180
|
+
0xFD9E: '\u0628\u062e\u064a',
|
|
31181
|
+
0xFD9F: '\u062a\u062c\u064a',
|
|
31182
|
+
0xFDA0: '\u062a\u062c\u0649',
|
|
31183
|
+
0xFDA1: '\u062a\u062e\u064a',
|
|
31184
|
+
0xFDA2: '\u062a\u062e\u0649',
|
|
31185
|
+
0xFDA3: '\u062a\u0645\u064a',
|
|
31186
|
+
0xFDA4: '\u062a\u0645\u0649',
|
|
31187
|
+
0xFDA5: '\u062c\u0645\u064a',
|
|
31188
|
+
0xFDA6: '\u062c\u062d\u0649',
|
|
31189
|
+
0xFDA7: '\u062c\u0645\u0649',
|
|
31190
|
+
0xFDA8: '\u0633\u062e\u0649',
|
|
31191
|
+
0xFDA9: '\u0635\u062d\u064a',
|
|
31192
|
+
0xFDAA: '\u0634\u062d\u064a',
|
|
31193
|
+
0xFDAB: '\u0636\u062d\u064a',
|
|
31194
|
+
0xFDAC: '\u0644\u062c\u064a',
|
|
31195
|
+
0xFDAD: '\u0644\u0645\u064a',
|
|
31196
|
+
0xFDAE: '\u064a\u062d\u064a',
|
|
31197
|
+
0xFDAF: '\u064a\u062c\u064a',
|
|
31198
|
+
0xFDB0: '\u064a\u0645\u064a',
|
|
31199
|
+
0xFDB1: '\u0645\u0645\u064a',
|
|
31200
|
+
0xFDB2: '\u0642\u0645\u064a',
|
|
31201
|
+
0xFDB3: '\u0646\u062d\u064a',
|
|
31202
|
+
0xFDB4: '\u0642\u0645\u062d',
|
|
31203
|
+
0xFDB5: '\u0644\u062d\u0645',
|
|
31204
|
+
0xFDB6: '\u0639\u0645\u064a',
|
|
31205
|
+
0xFDB7: '\u0643\u0645\u064a',
|
|
31206
|
+
0xFDB8: '\u0646\u062c\u062d',
|
|
31207
|
+
0xFDB9: '\u0645\u062e\u064a',
|
|
31208
|
+
0xFDBA: '\u0644\u062c\u0645',
|
|
31209
|
+
0xFDBB: '\u0643\u0645\u0645',
|
|
31210
|
+
0xFDBC: '\u0644\u062c\u0645',
|
|
31211
|
+
0xFDBD: '\u0646\u062c\u062d',
|
|
31212
|
+
0xFDBE: '\u062c\u062d\u064a',
|
|
31213
|
+
0xFDBF: '\u062d\u062c\u064a',
|
|
31214
|
+
0xFDC0: '\u0645\u062c\u064a',
|
|
31215
|
+
0xFDC1: '\u0641\u0645\u064a',
|
|
31216
|
+
0xFDC2: '\u0628\u062d\u064a',
|
|
31217
|
+
0xFDC3: '\u0643\u0645\u0645',
|
|
31218
|
+
0xFDC4: '\u0639\u062c\u0645',
|
|
31219
|
+
0xFDC5: '\u0635\u0645\u0645',
|
|
31220
|
+
0xFDC6: '\u0633\u062e\u064a',
|
|
31221
|
+
0xFDC7: '\u0646\u062c\u064a',
|
|
31222
|
+
0xFDF0: '\u0635\u0644\u06d2',
|
|
31223
|
+
0xFDF1: '\u0642\u0644\u06d2',
|
|
31224
|
+
0xFDF2: '\u0627\u0644\u0644\u0647',
|
|
31225
|
+
0xFDF3: '\u0627\u0643\u0628\u0631',
|
|
31226
|
+
0xFDF4: '\u0645\u062d\u0645\u062f',
|
|
31227
|
+
0xFDF5: '\u0635\u0644\u0639\u0645',
|
|
31228
|
+
0xFDF6: '\u0631\u0633\u0648\u0644',
|
|
31229
|
+
0xFDF7: '\u0639\u0644\u064a\u0647',
|
|
31230
|
+
0xFDF8: '\u0648\u0633\u0644\u0645',
|
|
31231
|
+
0xFDF9: '\u0635\u0644\u0649',
|
|
31232
|
+
0xFDFA: '\u0635\u0644\u0649\u0627\u0644\u0644\u0647\u0639\u0644\u064a\u0647\u0648\u0633\u0644\u0645',
|
|
31233
|
+
0xFDFB: '\u062c\u0644\u062c\u0644\u0627\u0644\u0647',
|
|
31234
|
+
0xFDFC: '\u0631\u06cc\u0627\u0644',
|
|
31235
|
+
0xFE70: '\u064b',
|
|
31236
|
+
0xFE71: '\u0640\u064b',
|
|
31237
|
+
0xFE72: '\u064c',
|
|
31238
|
+
0xFE74: '\u064d',
|
|
31239
|
+
0xFE76: '\u064e',
|
|
31240
|
+
0xFE77: '\u0640\u064e',
|
|
31241
|
+
0xFE78: '\u064f',
|
|
31242
|
+
0xFE79: '\u0640\u064f',
|
|
31243
|
+
0xFE7A: '\u0650',
|
|
31244
|
+
0xFE7B: '\u0640\u0650',
|
|
31245
|
+
0xFE7C: '\u0651',
|
|
31246
|
+
0xFE7D: '\u0640\u0651',
|
|
31247
|
+
0xFE7E: '\u0652',
|
|
31248
|
+
0xFE7F: '\u0640\u0652',
|
|
31249
|
+
0xFE80: '\u0621',
|
|
31250
|
+
0xFE81: '\u0622',
|
|
31251
|
+
0xFE82: '\u0622',
|
|
31252
|
+
0xFE83: '\u0623',
|
|
31253
|
+
0xFE84: '\u0623',
|
|
31254
|
+
0xFE85: '\u0624',
|
|
31255
|
+
0xFE86: '\u0624',
|
|
31256
|
+
0xFE87: '\u0625',
|
|
31257
|
+
0xFE88: '\u0625',
|
|
31258
|
+
0xFE89: '\u0626',
|
|
31259
|
+
0xFE8A: '\u0626',
|
|
31260
|
+
0xFE8B: '\u0626',
|
|
31261
|
+
0xFE8C: '\u0626',
|
|
31262
|
+
0xFE8D: '\u0627',
|
|
31263
|
+
0xFE8E: '\u0627',
|
|
31264
|
+
0xFE8F: '\u0628',
|
|
31265
|
+
0xFE90: '\u0628',
|
|
31266
|
+
0xFE91: '\u0628',
|
|
31267
|
+
0xFE92: '\u0628',
|
|
31268
|
+
0xFE93: '\u0629',
|
|
31269
|
+
0xFE94: '\u0629',
|
|
31270
|
+
0xFE95: '\u062a',
|
|
31271
|
+
0xFE96: '\u062a',
|
|
31272
|
+
0xFE97: '\u062a',
|
|
31273
|
+
0xFE98: '\u062a',
|
|
31274
|
+
0xFE99: '\u062b',
|
|
31275
|
+
0xFE9A: '\u062b',
|
|
31276
|
+
0xFE9B: '\u062b',
|
|
31277
|
+
0xFE9C: '\u062b',
|
|
31278
|
+
0xFE9D: '\u062c',
|
|
31279
|
+
0xFE9E: '\u062c',
|
|
31280
|
+
0xFE9F: '\u062c',
|
|
31281
|
+
0xFEA0: '\u062c',
|
|
31282
|
+
0xFEA1: '\u062d',
|
|
31283
|
+
0xFEA2: '\u062d',
|
|
31284
|
+
0xFEA3: '\u062d',
|
|
31285
|
+
0xFEA4: '\u062d',
|
|
31286
|
+
0xFEA5: '\u062e',
|
|
31287
|
+
0xFEA6: '\u062e',
|
|
31288
|
+
0xFEA7: '\u062e',
|
|
31289
|
+
0xFEA8: '\u062e',
|
|
31290
|
+
0xFEA9: '\u062f',
|
|
31291
|
+
0xFEAA: '\u062f',
|
|
31292
|
+
0xFEAB: '\u0630',
|
|
31293
|
+
0xFEAC: '\u0630',
|
|
31294
|
+
0xFEAD: '\u0631',
|
|
31295
|
+
0xFEAE: '\u0631',
|
|
31296
|
+
0xFEAF: '\u0632',
|
|
31297
|
+
0xFEB0: '\u0632',
|
|
31298
|
+
0xFEB1: '\u0633',
|
|
31299
|
+
0xFEB2: '\u0633',
|
|
31300
|
+
0xFEB3: '\u0633',
|
|
31301
|
+
0xFEB4: '\u0633',
|
|
31302
|
+
0xFEB5: '\u0634',
|
|
31303
|
+
0xFEB6: '\u0634',
|
|
31304
|
+
0xFEB7: '\u0634',
|
|
31305
|
+
0xFEB8: '\u0634',
|
|
31306
|
+
0xFEB9: '\u0635',
|
|
31307
|
+
0xFEBA: '\u0635',
|
|
31308
|
+
0xFEBB: '\u0635',
|
|
31309
|
+
0xFEBC: '\u0635',
|
|
31310
|
+
0xFEBD: '\u0636',
|
|
31311
|
+
0xFEBE: '\u0636',
|
|
31312
|
+
0xFEBF: '\u0636',
|
|
31313
|
+
0xFEC0: '\u0636',
|
|
31314
|
+
0xFEC1: '\u0637',
|
|
31315
|
+
0xFEC2: '\u0637',
|
|
31316
|
+
0xFEC3: '\u0637',
|
|
31317
|
+
0xFEC4: '\u0637',
|
|
31318
|
+
0xFEC5: '\u0638',
|
|
31319
|
+
0xFEC6: '\u0638',
|
|
31320
|
+
0xFEC7: '\u0638',
|
|
31321
|
+
0xFEC8: '\u0638',
|
|
31322
|
+
0xFEC9: '\u0639',
|
|
31323
|
+
0xFECA: '\u0639',
|
|
31324
|
+
0xFECB: '\u0639',
|
|
31325
|
+
0xFECC: '\u0639',
|
|
31326
|
+
0xFECD: '\u063a',
|
|
31327
|
+
0xFECE: '\u063a',
|
|
31328
|
+
0xFECF: '\u063a',
|
|
31329
|
+
0xFED0: '\u063a',
|
|
31330
|
+
0xFED1: '\u0641',
|
|
31331
|
+
0xFED2: '\u0641',
|
|
31332
|
+
0xFED3: '\u0641',
|
|
31333
|
+
0xFED4: '\u0641',
|
|
31334
|
+
0xFED5: '\u0642',
|
|
31335
|
+
0xFED6: '\u0642',
|
|
31336
|
+
0xFED7: '\u0642',
|
|
31337
|
+
0xFED8: '\u0642',
|
|
31338
|
+
0xFED9: '\u0643',
|
|
31339
|
+
0xFEDA: '\u0643',
|
|
31340
|
+
0xFEDB: '\u0643',
|
|
31341
|
+
0xFEDC: '\u0643',
|
|
31342
|
+
0xFEDD: '\u0644',
|
|
31343
|
+
0xFEDE: '\u0644',
|
|
31344
|
+
0xFEDF: '\u0644',
|
|
31345
|
+
0xFEE0: '\u0644',
|
|
31346
|
+
0xFEE1: '\u0645',
|
|
31347
|
+
0xFEE2: '\u0645',
|
|
31348
|
+
0xFEE3: '\u0645',
|
|
31349
|
+
0xFEE4: '\u0645',
|
|
31350
|
+
0xFEE5: '\u0646',
|
|
31351
|
+
0xFEE6: '\u0646',
|
|
31352
|
+
0xFEE7: '\u0646',
|
|
31353
|
+
0xFEE8: '\u0646',
|
|
31354
|
+
0xFEE9: '\u0647',
|
|
31355
|
+
0xFEEA: '\u0647',
|
|
31356
|
+
0xFEEB: '\u0647',
|
|
31357
|
+
0xFEEC: '\u0647',
|
|
31358
|
+
0xFEED: '\u0648',
|
|
31359
|
+
0xFEEE: '\u0648',
|
|
31360
|
+
0xFEEF: '\u0649',
|
|
31361
|
+
0xFEF0: '\u0649',
|
|
31362
|
+
0xFEF1: '\u064a',
|
|
31363
|
+
0xFEF2: '\u064a',
|
|
31364
|
+
0xFEF3: '\u064a',
|
|
31365
|
+
0xFEF4: '\u064a',
|
|
31366
|
+
0xFEF5: '\u0644\u0622',
|
|
31367
|
+
0xFEF6: '\u0644\u0622',
|
|
31368
|
+
0xFEF7: '\u0644\u0623',
|
|
31369
|
+
0xFEF8: '\u0644\u0623',
|
|
31370
|
+
0xFEF9: '\u0644\u0625',
|
|
31371
|
+
0xFEFA: '\u0644\u0625',
|
|
31372
|
+
0xFEFB: '\u0644\u0627',
|
|
31373
|
+
0xFEFC: '\u0644\u0627'
|
|
31374
|
+
};
|
|
31375
|
+
|
|
29991
31376
|
/**
|
|
29992
31377
|
* Represents the structure element of the PDF document.
|
|
29993
31378
|
* ```typescript
|
|
@@ -31260,15 +32645,16 @@ var PdfDataExtractor = /** @__PURE__ @class */ (function () {
|
|
|
31260
32645
|
this._processPages(startIndex, endIndex);
|
|
31261
32646
|
if (this._resultantText.length) {
|
|
31262
32647
|
this._resultantText = _ignoreEscapeSequence(this._resultantText);
|
|
32648
|
+
this._resultantText = this._buildRtlReadingText(startIndex, endIndex, this._resultantText);
|
|
31263
32649
|
}
|
|
31264
32650
|
this._isLayout = false;
|
|
31265
32651
|
return this._resultantText;
|
|
31266
32652
|
};
|
|
31267
32653
|
PdfDataExtractor.prototype.extractText = function (options) {
|
|
31268
32654
|
return __awaiter$8(this, void 0, void 0, function () {
|
|
31269
|
-
var startIndex, endIndex;
|
|
31270
|
-
return __generator$8(this, function (
|
|
31271
|
-
switch (
|
|
32655
|
+
var startIndex, endIndex, _a;
|
|
32656
|
+
return __generator$8(this, function (_b) {
|
|
32657
|
+
switch (_b.label) {
|
|
31272
32658
|
case 0:
|
|
31273
32659
|
initializeTelemetryFeature('ExtractText', 'PDFLibrary');
|
|
31274
32660
|
startIndex = 0;
|
|
@@ -31288,10 +32674,15 @@ var PdfDataExtractor = /** @__PURE__ @class */ (function () {
|
|
|
31288
32674
|
}
|
|
31289
32675
|
return [4 /*yield*/, this._processPdfPages(startIndex, endIndex)];
|
|
31290
32676
|
case 1:
|
|
31291
|
-
|
|
31292
|
-
if (this._resultantText.length)
|
|
31293
|
-
|
|
31294
|
-
|
|
32677
|
+
_b.sent();
|
|
32678
|
+
if (!this._resultantText.length) return [3 /*break*/, 3];
|
|
32679
|
+
this._resultantText = _ignoreEscapeSequence(this._resultantText);
|
|
32680
|
+
_a = this;
|
|
32681
|
+
return [4 /*yield*/, this._buildRtlReadingTextAsync(startIndex, endIndex, this._resultantText)];
|
|
32682
|
+
case 2:
|
|
32683
|
+
_a._resultantText = _b.sent();
|
|
32684
|
+
_b.label = 3;
|
|
32685
|
+
case 3:
|
|
31295
32686
|
this._isLayout = false;
|
|
31296
32687
|
return [2 /*return*/, this._resultantText];
|
|
31297
32688
|
}
|
|
@@ -32681,6 +34072,7 @@ var PdfDataExtractor = /** @__PURE__ @class */ (function () {
|
|
|
32681
34072
|
this._textLine = [];
|
|
32682
34073
|
this._processPages(startIndex, endIndex);
|
|
32683
34074
|
this._isExtractTextLines = false;
|
|
34075
|
+
this._normalizeTextLines(this._textLine);
|
|
32684
34076
|
return this._textLine;
|
|
32685
34077
|
};
|
|
32686
34078
|
PdfDataExtractor.prototype.extractTextLines = function (options) {
|
|
@@ -32705,6 +34097,7 @@ var PdfDataExtractor = /** @__PURE__ @class */ (function () {
|
|
|
32705
34097
|
case 1:
|
|
32706
34098
|
_a.sent();
|
|
32707
34099
|
this._isExtractTextLines = false;
|
|
34100
|
+
this._normalizeTextLines(this._textLine);
|
|
32708
34101
|
return [2 /*return*/, this._textLine];
|
|
32709
34102
|
}
|
|
32710
34103
|
});
|
|
@@ -32801,6 +34194,311 @@ var PdfDataExtractor = /** @__PURE__ @class */ (function () {
|
|
|
32801
34194
|
}
|
|
32802
34195
|
return textSearchResults[0];
|
|
32803
34196
|
};
|
|
34197
|
+
/**
|
|
34198
|
+
* Rebuilds the plain-text extraction result in logical RTL reading order.
|
|
34199
|
+
* Non-RTL documents keep the existing flat text. RTL documents are rebuilt
|
|
34200
|
+
* from the line pipeline so rows are read top-to-bottom and RTL rows are
|
|
34201
|
+
* emitted right-to-left, matching Adobe extraction order.
|
|
34202
|
+
*
|
|
34203
|
+
* @private
|
|
34204
|
+
* @param {number} startIndex - Start page index of the extraction.
|
|
34205
|
+
* @param {number} endIndex - End page index of the extraction.
|
|
34206
|
+
* @param {string} flatText - Flat extracted text in stream order.
|
|
34207
|
+
* @returns {string} Reading-order text for RTL documents, otherwise flatText.
|
|
34208
|
+
*/
|
|
34209
|
+
PdfDataExtractor.prototype._buildRtlReadingText = function (startIndex, endIndex, flatText) {
|
|
34210
|
+
if (!_containsRtlCharacter(flatText)) {
|
|
34211
|
+
return flatText;
|
|
34212
|
+
}
|
|
34213
|
+
var textLines = this.extractTextLinesSync({ startPageIndex: startIndex, endPageIndex: endIndex });
|
|
34214
|
+
if (!textLines || textLines.length === 0) {
|
|
34215
|
+
return _normalizeRtlText(flatText);
|
|
34216
|
+
}
|
|
34217
|
+
var result = '';
|
|
34218
|
+
for (var i = 0; i < textLines.length; i++) {
|
|
34219
|
+
var textLine = textLines[Number.parseInt(i.toString(), 10)];
|
|
34220
|
+
result += textLine._text;
|
|
34221
|
+
if (i < textLines.length - 1) {
|
|
34222
|
+
result += '\r\n';
|
|
34223
|
+
}
|
|
34224
|
+
}
|
|
34225
|
+
return result;
|
|
34226
|
+
};
|
|
34227
|
+
/**
|
|
34228
|
+
* Asynchronous variant of `_buildRtlReadingText`.
|
|
34229
|
+
*
|
|
34230
|
+
* @private
|
|
34231
|
+
* @param {number} startIndex - Start page index of the extraction.
|
|
34232
|
+
* @param {number} endIndex - End page index of the extraction.
|
|
34233
|
+
* @param {string} flatText - Flat extracted text in stream order.
|
|
34234
|
+
* @returns {Promise<string>} Reading-order text for RTL documents, otherwise flatText.
|
|
34235
|
+
*/
|
|
34236
|
+
PdfDataExtractor.prototype._buildRtlReadingTextAsync = function (startIndex, endIndex, flatText) {
|
|
34237
|
+
return __awaiter$8(this, void 0, void 0, function () {
|
|
34238
|
+
var textLines, result, i, textLine;
|
|
34239
|
+
return __generator$8(this, function (_a) {
|
|
34240
|
+
switch (_a.label) {
|
|
34241
|
+
case 0:
|
|
34242
|
+
if (!_containsRtlCharacter(flatText)) {
|
|
34243
|
+
return [2 /*return*/, flatText];
|
|
34244
|
+
}
|
|
34245
|
+
return [4 /*yield*/, this.extractTextLines({ startPageIndex: startIndex, endPageIndex: endIndex })];
|
|
34246
|
+
case 1:
|
|
34247
|
+
textLines = _a.sent();
|
|
34248
|
+
if (!textLines || textLines.length === 0) {
|
|
34249
|
+
return [2 /*return*/, _normalizeRtlText(flatText)];
|
|
34250
|
+
}
|
|
34251
|
+
result = '';
|
|
34252
|
+
for (i = 0; i < textLines.length; i++) {
|
|
34253
|
+
textLine = textLines[Number.parseInt(i.toString(), 10)];
|
|
34254
|
+
result += textLine._text;
|
|
34255
|
+
if (i < textLines.length - 1) {
|
|
34256
|
+
result += '\r\n';
|
|
34257
|
+
}
|
|
34258
|
+
}
|
|
34259
|
+
return [2 /*return*/, result];
|
|
34260
|
+
}
|
|
34261
|
+
});
|
|
34262
|
+
});
|
|
34263
|
+
};
|
|
34264
|
+
PdfDataExtractor.prototype._normalizeTextLines = function (textLines) {
|
|
34265
|
+
if (!textLines || textLines.length === 0) {
|
|
34266
|
+
return;
|
|
34267
|
+
}
|
|
34268
|
+
var fragments = [];
|
|
34269
|
+
for (var i = 0; i < textLines.length; i++) {
|
|
34270
|
+
var textLine = textLines[Number.parseInt(i.toString(), 10)];
|
|
34271
|
+
if (textLine && textLine._text && textLine._bounds) {
|
|
34272
|
+
fragments.push({ text: textLine._text, bounds: textLine._bounds });
|
|
34273
|
+
}
|
|
34274
|
+
}
|
|
34275
|
+
var rowOrder = [];
|
|
34276
|
+
if (fragments.length === textLines.length) {
|
|
34277
|
+
var ordered = _reorderFragmentsForRtlReading(fragments);
|
|
34278
|
+
var consumed = new Array(textLines.length).fill(false);
|
|
34279
|
+
for (var f = 0; f < ordered.length; f++) {
|
|
34280
|
+
var fragment = ordered[Number.parseInt(f.toString(), 10)];
|
|
34281
|
+
for (var i = 0; i < textLines.length; i++) {
|
|
34282
|
+
if (consumed[Number.parseInt(i.toString(), 10)]) {
|
|
34283
|
+
continue;
|
|
34284
|
+
}
|
|
34285
|
+
var textLine = textLines[Number.parseInt(i.toString(), 10)];
|
|
34286
|
+
if (textLine._text === fragment.text && textLine._bounds === fragment.bounds) {
|
|
34287
|
+
rowOrder.push(textLine);
|
|
34288
|
+
consumed[Number.parseInt(i.toString(), 10)] = true;
|
|
34289
|
+
break;
|
|
34290
|
+
}
|
|
34291
|
+
}
|
|
34292
|
+
}
|
|
34293
|
+
}
|
|
34294
|
+
var orderedLines = rowOrder.length === textLines.length ? rowOrder : textLines;
|
|
34295
|
+
for (var i = 0; i < orderedLines.length; i++) {
|
|
34296
|
+
var textLine = orderedLines[Number.parseInt(i.toString(), 10)];
|
|
34297
|
+
this._normalizeRtlTextLine(textLine);
|
|
34298
|
+
}
|
|
34299
|
+
var tolerance = this._getMergeRowTolerance(orderedLines);
|
|
34300
|
+
var mergedLines = [];
|
|
34301
|
+
for (var i = 0; i < orderedLines.length; i++) {
|
|
34302
|
+
var textLine = orderedLines[Number.parseInt(i.toString(), 10)];
|
|
34303
|
+
var previous = mergedLines.length > 0 ?
|
|
34304
|
+
mergedLines[Number.parseInt((mergedLines.length - 1).toString(), 10)] : null;
|
|
34305
|
+
var rowHasRtl = _containsRtlCharacter(previous ? previous._text : '') ||
|
|
34306
|
+
_containsRtlCharacter(textLine._text);
|
|
34307
|
+
if (previous && rowHasRtl && this._isSameRtlRowLine(previous._bounds, textLine._bounds, tolerance) &&
|
|
34308
|
+
this._isAdjacentWordGap(previous._bounds, textLine._bounds, tolerance)) {
|
|
34309
|
+
var needsSpace = previous._text.length > 0 && textLine._text.length > 0 &&
|
|
34310
|
+
previous._text[Number.parseInt((previous._text.length - 1).toString(), 10)] !== ' ' &&
|
|
34311
|
+
textLine._text[0] !== ' ';
|
|
34312
|
+
previous._text += (needsSpace ? ' ' : '') + textLine._text;
|
|
34313
|
+
if (textLine._wordCollection) {
|
|
34314
|
+
for (var j = 0; j < textLine._wordCollection.length; j++) {
|
|
34315
|
+
previous._wordCollection.push(textLine._wordCollection[Number.parseInt(j.toString(), 10)]);
|
|
34316
|
+
}
|
|
34317
|
+
}
|
|
34318
|
+
previous._bounds = this._getMergedBounds(previous._bounds, textLine._bounds);
|
|
34319
|
+
}
|
|
34320
|
+
else {
|
|
34321
|
+
mergedLines.push(textLine);
|
|
34322
|
+
}
|
|
34323
|
+
}
|
|
34324
|
+
if (mergedLines.length !== textLines.length) {
|
|
34325
|
+
for (var i = 0; i < mergedLines.length; i++) {
|
|
34326
|
+
textLines[Number.parseInt(i.toString(), 10)] = mergedLines[Number.parseInt(i.toString(), 10)];
|
|
34327
|
+
}
|
|
34328
|
+
textLines.length = mergedLines.length;
|
|
34329
|
+
}
|
|
34330
|
+
};
|
|
34331
|
+
/**
|
|
34332
|
+
* Computes the vertical tolerance used to decide whether two text lines
|
|
34333
|
+
* share the same baseline (fraction of the dominant line height).
|
|
34334
|
+
*
|
|
34335
|
+
* @private
|
|
34336
|
+
* @param {TextLine[]} textLines - Lines being merged.
|
|
34337
|
+
* @returns {number} Row-grouping tolerance in page units.
|
|
34338
|
+
*/
|
|
34339
|
+
PdfDataExtractor.prototype._getMergeRowTolerance = function (textLines) {
|
|
34340
|
+
var totalHeight = 0;
|
|
34341
|
+
var count = 0;
|
|
34342
|
+
for (var i = 0; i < textLines.length; i++) {
|
|
34343
|
+
var textLine = textLines[Number.parseInt(i.toString(), 10)];
|
|
34344
|
+
if (textLine && textLine._bounds && textLine._bounds.height > 0) {
|
|
34345
|
+
totalHeight += textLine._bounds.height;
|
|
34346
|
+
count++;
|
|
34347
|
+
}
|
|
34348
|
+
}
|
|
34349
|
+
if (count === 0) {
|
|
34350
|
+
return 2;
|
|
34351
|
+
}
|
|
34352
|
+
return Math.max(2, (totalHeight / count) * 0.5);
|
|
34353
|
+
};
|
|
34354
|
+
/**
|
|
34355
|
+
* Determines whether two line bounds share the same baseline row.
|
|
34356
|
+
*
|
|
34357
|
+
* @private
|
|
34358
|
+
* @param {Rectangle} first - First line bounds.
|
|
34359
|
+
* @param {Rectangle} second - Second line bounds.
|
|
34360
|
+
* @param {number} tolerance - Vertical tolerance for row grouping.
|
|
34361
|
+
* @returns {boolean} True when both lines are on the same baseline row.
|
|
34362
|
+
*/
|
|
34363
|
+
PdfDataExtractor.prototype._isSameRtlRowLine = function (first, second, tolerance) {
|
|
34364
|
+
if (!first || !second) {
|
|
34365
|
+
return false;
|
|
34366
|
+
}
|
|
34367
|
+
var firstCenter = first.y + first.height / 2;
|
|
34368
|
+
var secondCenter = second.y + second.height / 2;
|
|
34369
|
+
return Math.abs(firstCenter - secondCenter) <= tolerance;
|
|
34370
|
+
};
|
|
34371
|
+
/**
|
|
34372
|
+
* Determines whether the horizontal gap between two same-baseline lines is
|
|
34373
|
+
* small enough to treat them as words of the same visual line. Large gaps
|
|
34374
|
+
* (columns, tab-separated figures) are kept as separate lines.
|
|
34375
|
+
*
|
|
34376
|
+
* @private
|
|
34377
|
+
* @param {Rectangle} previous - Bounds of the already merged line.
|
|
34378
|
+
* @param {Rectangle} current - Bounds of the candidate line to merge.
|
|
34379
|
+
* @param {number} tolerance - Row tolerance used as the gap scale.
|
|
34380
|
+
* @returns {boolean} True when the gap indicates words of one visual line.
|
|
34381
|
+
*/
|
|
34382
|
+
PdfDataExtractor.prototype._isAdjacentWordGap = function (previous, current, tolerance) {
|
|
34383
|
+
if (!previous || !current) {
|
|
34384
|
+
return false;
|
|
34385
|
+
}
|
|
34386
|
+
var gap = Math.max(previous.x - (current.x + current.width), current.x - (previous.x + previous.width));
|
|
34387
|
+
return gap < Math.max(24, tolerance * 8);
|
|
34388
|
+
};
|
|
34389
|
+
/**
|
|
34390
|
+
* Computes the union of two line bounds.
|
|
34391
|
+
*
|
|
34392
|
+
* @private
|
|
34393
|
+
* @param {Rectangle} first - First line bounds.
|
|
34394
|
+
* @param {Rectangle} second - Second line bounds.
|
|
34395
|
+
* @returns {Rectangle} Union bounds covering both lines.
|
|
34396
|
+
*/
|
|
34397
|
+
PdfDataExtractor.prototype._getMergedBounds = function (first, second) {
|
|
34398
|
+
if (!first) {
|
|
34399
|
+
return second;
|
|
34400
|
+
}
|
|
34401
|
+
if (!second) {
|
|
34402
|
+
return first;
|
|
34403
|
+
}
|
|
34404
|
+
var x = Math.min(first.x, second.x);
|
|
34405
|
+
var y = Math.min(first.y, second.y);
|
|
34406
|
+
return {
|
|
34407
|
+
x: x,
|
|
34408
|
+
y: y,
|
|
34409
|
+
width: Math.max(first.x + first.width, second.x + second.width) - x,
|
|
34410
|
+
height: Math.max(first.y + first.height, second.y + second.height) - y
|
|
34411
|
+
};
|
|
34412
|
+
};
|
|
34413
|
+
/**
|
|
34414
|
+
* Normalizes a single text line (and its words) from visual RTL order into
|
|
34415
|
+
* logical reading order, sorting RTL words right-to-left by position when
|
|
34416
|
+
* the line advances leftward.
|
|
34417
|
+
*
|
|
34418
|
+
* @private
|
|
34419
|
+
* @param {TextLine} textLine - Line to normalize.
|
|
34420
|
+
* @returns {void}
|
|
34421
|
+
*/
|
|
34422
|
+
PdfDataExtractor.prototype._normalizeRtlTextLine = function (textLine) {
|
|
34423
|
+
var words = textLine._wordCollection;
|
|
34424
|
+
if (!textLine._text || !_containsRtlCharacter(textLine._text)) {
|
|
34425
|
+
return;
|
|
34426
|
+
}
|
|
34427
|
+
var isVisualOrder = _containsArabicPresentationForm(textLine._text) ||
|
|
34428
|
+
this._isLineAdvancingLeftward(words);
|
|
34429
|
+
var changed = false;
|
|
34430
|
+
if (words && words.length > 1 && isVisualOrder) {
|
|
34431
|
+
var orderedWords = words.slice().sort(function (a, b) { return b._bounds.x - a._bounds.x; });
|
|
34432
|
+
for (var j = 0; j < orderedWords.length; j++) {
|
|
34433
|
+
if (orderedWords[Number.parseInt(j.toString(), 10)] !== words[Number.parseInt(j.toString(), 10)]) {
|
|
34434
|
+
changed = true;
|
|
34435
|
+
break;
|
|
34436
|
+
}
|
|
34437
|
+
}
|
|
34438
|
+
if (changed) {
|
|
34439
|
+
for (var j = 0; j < orderedWords.length; j++) {
|
|
34440
|
+
words[Number.parseInt(j.toString(), 10)] = orderedWords[Number.parseInt(j.toString(), 10)];
|
|
34441
|
+
}
|
|
34442
|
+
}
|
|
34443
|
+
}
|
|
34444
|
+
for (var j = 0; j < (words ? words.length : 0); j++) {
|
|
34445
|
+
var textWord = words[Number.parseInt(j.toString(), 10)];
|
|
34446
|
+
if (!textWord || !textWord._text) {
|
|
34447
|
+
continue;
|
|
34448
|
+
}
|
|
34449
|
+
if (_containsRtlCharacter(textWord._text)) {
|
|
34450
|
+
textWord._text = _normalizeRtlText(textWord._text);
|
|
34451
|
+
}
|
|
34452
|
+
else if (isVisualOrder) {
|
|
34453
|
+
textWord._text = _invertVisualLtrFragment(textWord._text);
|
|
34454
|
+
}
|
|
34455
|
+
}
|
|
34456
|
+
if (changed) {
|
|
34457
|
+
var rebuilt = '';
|
|
34458
|
+
for (var j = 0; j < words.length; j++) {
|
|
34459
|
+
rebuilt += words[Number.parseInt(j.toString(), 10)]._text;
|
|
34460
|
+
}
|
|
34461
|
+
textLine._text = rebuilt;
|
|
34462
|
+
}
|
|
34463
|
+
else if (isVisualOrder) {
|
|
34464
|
+
textLine._text = _normalizeRtlText(textLine._text);
|
|
34465
|
+
}
|
|
34466
|
+
else {
|
|
34467
|
+
textLine._text = _mapArabicPresentationForms(textLine._text);
|
|
34468
|
+
}
|
|
34469
|
+
if (isVisualOrder) {
|
|
34470
|
+
textLine._text = _resolveMirroredBrackets(textLine._text);
|
|
34471
|
+
}
|
|
34472
|
+
};
|
|
34473
|
+
/**
|
|
34474
|
+
* Determines whether the words of a line advance leftward (visual RTL order)
|
|
34475
|
+
* by comparing the bounds of consecutive words.
|
|
34476
|
+
*
|
|
34477
|
+
* @private
|
|
34478
|
+
* @param {TextWord[]} words - Line words in stream order.
|
|
34479
|
+
* @returns {boolean} True when consecutive words are placed right-to-left.
|
|
34480
|
+
*/
|
|
34481
|
+
PdfDataExtractor.prototype._isLineAdvancingLeftward = function (words) {
|
|
34482
|
+
if (!words || words.length < 2) {
|
|
34483
|
+
return false;
|
|
34484
|
+
}
|
|
34485
|
+
var rightward = 0;
|
|
34486
|
+
var leftward = 0;
|
|
34487
|
+
for (var i = 1; i < words.length; i++) {
|
|
34488
|
+
var previous = words[Number.parseInt((i - 1).toString(), 10)];
|
|
34489
|
+
var current = words[Number.parseInt(i.toString(), 10)];
|
|
34490
|
+
if (!previous._bounds || !current._bounds) {
|
|
34491
|
+
continue;
|
|
34492
|
+
}
|
|
34493
|
+
if (_isVisualOrderRtl(previous._bounds, current._bounds)) {
|
|
34494
|
+
rightward++;
|
|
34495
|
+
}
|
|
34496
|
+
else if (current._bounds.x < previous._bounds.x) {
|
|
34497
|
+
leftward++;
|
|
34498
|
+
}
|
|
34499
|
+
}
|
|
34500
|
+
return leftward === 0 && rightward > 0;
|
|
34501
|
+
};
|
|
32804
34502
|
/**
|
|
32805
34503
|
* Coordinates document-wide text search and returns the search results for all supplied search strings.
|
|
32806
34504
|
*
|
|
@@ -32873,7 +34571,8 @@ var PdfDataExtractor = /** @__PURE__ @class */ (function () {
|
|
|
32873
34571
|
var page = this._document.getPage(pageIndex);
|
|
32874
34572
|
for (var i = 0; i < searchTextCollection.length; i++) {
|
|
32875
34573
|
var searchText = searchTextCollection[Number.parseInt(i.toString(), 10)];
|
|
32876
|
-
var
|
|
34574
|
+
var normalizedSearchText = _normalizeSearchText(searchText);
|
|
34575
|
+
var searchTextLower = options.caseSensitive ? normalizedSearchText : normalizedSearchText.toLowerCase();
|
|
32877
34576
|
searchTextLowerCollection.push(searchTextLower);
|
|
32878
34577
|
boundsCollection.set(i, []);
|
|
32879
34578
|
}
|
|
@@ -32906,6 +34605,7 @@ var PdfDataExtractor = /** @__PURE__ @class */ (function () {
|
|
|
32906
34605
|
}
|
|
32907
34606
|
else {
|
|
32908
34607
|
var startIndex = 0;
|
|
34608
|
+
var isRtlWord = _containsRtlCharacter(wordText);
|
|
32909
34609
|
while (true) { // eslint-disable-line
|
|
32910
34610
|
var matchIndex = wordText.indexOf(searchTextLower, startIndex);
|
|
32911
34611
|
if (matchIndex === -1) {
|
|
@@ -32921,6 +34621,14 @@ var PdfDataExtractor = /** @__PURE__ @class */ (function () {
|
|
|
32921
34621
|
}
|
|
32922
34622
|
charIndex++;
|
|
32923
34623
|
}
|
|
34624
|
+
if (isRtlWord && glyphs.length === wordText.length) {
|
|
34625
|
+
matchGlyphs.length = 0;
|
|
34626
|
+
var glyphStart = glyphs.length - endIndex;
|
|
34627
|
+
var glyphEnd = glyphs.length - matchIndex;
|
|
34628
|
+
for (var i = glyphStart; i < glyphEnd; i++) {
|
|
34629
|
+
matchGlyphs.push(glyphs[Number.parseInt(i.toString(), 10)]);
|
|
34630
|
+
}
|
|
34631
|
+
}
|
|
32924
34632
|
if (matchGlyphs.length > 0) {
|
|
32925
34633
|
var pdfPath = new PdfPath();
|
|
32926
34634
|
for (var i = 0; i < matchGlyphs.length; i++) {
|
|
@@ -33651,5 +35359,5 @@ var PdfDataExtractor = /** @__PURE__ @class */ (function () {
|
|
|
33651
35359
|
return PdfDataExtractor;
|
|
33652
35360
|
}());
|
|
33653
35361
|
|
|
33654
|
-
export { ApplicationPlatform, PdfDataExtractor, PdfEmbeddedImage, PdfRedactionRegion, PdfRedactor, PdfStructureElement, PdfTagType, ScopeType, TextGlyph, TextLine, TextWord, _CompositeGlyph, _Contour, _FontHelper, _FontStructure, _Glyph, _GlyphHeader, _GraphicState, _ImageStructure, _MatrixHelper, _PdfAlternateCS, _PdfBaseColorSpace, _PdfBezierSegment, _PdfBinaryCMapStream, _PdfBinaryCharacterMapReader, _PdfCalGrayCS, _PdfCharacterMap, _PdfCharacterMapFactory, _PdfColorPalette, _PdfColorRgbConverter, _PdfColorSpaceUtils, _PdfCompactFont, _PdfCompactFontCharacterSet, _PdfCompactFontCompiler, _PdfCompactFontDictionary, _PdfCompactFontEncoding, _PdfCompactFontHeader, _PdfCompactFontIndex, _PdfCompactFontOffsetTracker, _PdfCompactFontParser, _PdfCompactFontPrivateDictionary, _PdfCompactFontSelect, _PdfCompactFontStrings, _PdfCompactFontTopDictionary, _PdfCompactFormatFont, _PdfContentParserHelper, _PdfDeviceCmykCS, _PdfDeviceGrayCS, _PdfDeviceRgbCS, _PdfDeviceRgbaCS, _PdfGlyph, _PdfGlyphTable, _PdfIccColorSpace, _PdfIdentityCharacterMap, _PdfImage, _PdfImageProcessor, _PdfImageResizer, _PdfIndexedCS, _PdfIntersection, _PdfJpegImage, _PdfJpxImage, _PdfLabCS, _PdfLineSegment, _PdfMetrics, _PdfOpenJpegRunner, _PdfPathFigure, _PdfPathSegment, _PdfPatternCS, _PdfPolygon, _PdfQcmsRunner, _PdfRedactionProcessor, _PdfShapeParser, _PdfTextParser, _PdfVertex, _SimpleGlyph, _TextGlyphMapper, _TextState, _TransformationStack, _addFontResources, _base64ToUint8Array, _convertBlackAndWhiteToRGBA, _convertRGBToRGBA, _convertToRGBA, _decodeEncodedText, _expertEncoding, _fetchXObject, _fontFlags, _fontTables, _getDingbatsGlyphsUnicode, _getEncoding, _getEncodingBase64String, _getFontBasicMetrics, _getFontEncodedString, _getFontGlyphMap, _getFontNameToFileMap, _getGlyphMapForStandardFonts, _getGlyphsUnicode, _getLiteralString, _getNonStdFontMap, _getSerifFonts, _getStdFontMap, _getSupplementalGlyphMapForArialBlack, _getSymbolsFonts, _getUnicodeForGlyph, _getXObject, _getXObjectResources, _glyphAnalysisEnabled, _grayToRGBA, _hexToChar, _ignoreEscapeSequence, _isArrayEqual, _macExpertEncoding, _macRomanEncoding, _parseEncodedText, _parseEscapedText, _recoverGlyphName, _skipEscapeSequence, _standardEncoding, _symbolSetEncoding, _winAnsiEncoding, _zapfDingbatsEncoding, imageKind, maximumCount };
|
|
35362
|
+
export { ApplicationPlatform, PdfDataExtractor, PdfEmbeddedImage, PdfRedactionRegion, PdfRedactor, PdfStructureElement, PdfTagType, ScopeType, TextGlyph, TextLine, TextWord, _CompositeGlyph, _Contour, _FontHelper, _FontStructure, _Glyph, _GlyphHeader, _GraphicState, _ImageStructure, _MatrixHelper, _PdfAlternateCS, _PdfBaseColorSpace, _PdfBezierSegment, _PdfBinaryCMapStream, _PdfBinaryCharacterMapReader, _PdfCalGrayCS, _PdfCharacterMap, _PdfCharacterMapFactory, _PdfColorPalette, _PdfColorRgbConverter, _PdfColorSpaceUtils, _PdfCompactFont, _PdfCompactFontCharacterSet, _PdfCompactFontCompiler, _PdfCompactFontDictionary, _PdfCompactFontEncoding, _PdfCompactFontHeader, _PdfCompactFontIndex, _PdfCompactFontOffsetTracker, _PdfCompactFontParser, _PdfCompactFontPrivateDictionary, _PdfCompactFontSelect, _PdfCompactFontStrings, _PdfCompactFontTopDictionary, _PdfCompactFormatFont, _PdfContentParserHelper, _PdfDeviceCmykCS, _PdfDeviceGrayCS, _PdfDeviceRgbCS, _PdfDeviceRgbaCS, _PdfGlyph, _PdfGlyphTable, _PdfIccColorSpace, _PdfIdentityCharacterMap, _PdfImage, _PdfImageProcessor, _PdfImageResizer, _PdfIndexedCS, _PdfIntersection, _PdfJpegImage, _PdfJpxImage, _PdfLabCS, _PdfLineSegment, _PdfMetrics, _PdfOpenJpegRunner, _PdfPathFigure, _PdfPathSegment, _PdfPatternCS, _PdfPolygon, _PdfQcmsRunner, _PdfRedactionProcessor, _PdfShapeParser, _PdfTextParser, _PdfVertex, _SimpleGlyph, _TextGlyphMapper, _TextState, _TransformationStack, _addFontResources, _base64ToUint8Array, _containsArabicPresentationForm, _containsRtlCharacter, _convertBlackAndWhiteToRGBA, _convertRGBToRGBA, _convertToRGBA, _convertVisualToLogicalOrder, _decodeEncodedText, _expertEncoding, _fetchXObject, _fontFlags, _fontTables, _getDingbatsGlyphsUnicode, _getEncoding, _getEncodingBase64String, _getFontBasicMetrics, _getFontEncodedString, _getFontGlyphMap, _getFontNameToFileMap, _getGlyphMapForStandardFonts, _getGlyphsUnicode, _getLiteralString, _getNonStdFontMap, _getSerifFonts, _getStdFontMap, _getSupplementalGlyphMapForArialBlack, _getSymbolsFonts, _getUnicodeForGlyph, _getXObject, _getXObjectResources, _glyphAnalysisEnabled, _grayToRGBA, _hexToChar, _ignoreEscapeSequence, _invertVisualLtrFragment, _isArabicPresentationForm, _isArrayEqual, _isLtrCharacter, _isNeutralCharacter, _isRtlCharacter, _isVisualOrderRtl, _macExpertEncoding, _macRomanEncoding, _mapArabicPresentationForms, _normalizeArabicCharacter, _normalizeRtlText, _normalizeSearchText, _parseEncodedText, _parseEscapedText, _recoverGlyphName, _reorderFragmentsForRtlReading, _resolveMirroredBrackets, _skipEscapeSequence, _standardEncoding, _symbolSetEncoding, _unmirrorPairedBrackets, _winAnsiEncoding, _zapfDingbatsEncoding, imageKind, maximumCount };
|
|
33655
35363
|
//# sourceMappingURL=ej2-pdf-data-extract.es5.js.map
|