@syncfusion/ej2-pdf 25.1.38 → 25.1.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -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 +75 -42
- package/dist/es6/ej2-pdf.es2015.js.map +1 -1
- package/dist/es6/ej2-pdf.es5.js +74 -41
- package/dist/es6/ej2-pdf.es5.js.map +1 -1
- package/dist/global/ej2-pdf.min.js +2 -2
- package/dist/global/ej2-pdf.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +5 -5
- package/src/pdf/core/annotations/annotation.js +41 -20
- package/src/pdf/core/form/field.js +1 -2
- package/src/pdf/core/pdf-cross-reference.js +1 -1
- package/src/pdf/core/pdf-parser.js +3 -18
- package/src/pdf/core/utils.d.ts +9 -0
- package/src/pdf/core/utils.js +28 -0
package/dist/global/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: index.d.ts
|
|
3
|
-
* version : 25.1.
|
|
3
|
+
* version : 25.1.39
|
|
4
4
|
* Copyright Syncfusion Inc. 2001 - 2023. All rights reserved.
|
|
5
5
|
* Use of this code is subject to the terms of our license.
|
|
6
6
|
* A copy of the current license can be obtained at any time by e-mailing
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_from": "@syncfusion/ej2-pdf@*",
|
|
3
|
-
"_id": "@syncfusion/ej2-pdf@25.1.
|
|
3
|
+
"_id": "@syncfusion/ej2-pdf@25.1.38",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "sha512-
|
|
5
|
+
"_integrity": "sha512-TYJhAacgyrKDDVj7GWxuYlc0QGj2PNnrvIVbpejaNGPocfERK/mZZ2KdJ7RsyEVXNF6MrFaV4iOf/Mc0rX9jgg==",
|
|
6
6
|
"_location": "/@syncfusion/ej2-pdf",
|
|
7
7
|
"_phantomChildren": {},
|
|
8
8
|
"_requested": {
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"/@syncfusion/ej2",
|
|
22
22
|
"/@syncfusion/ej2-pdfviewer"
|
|
23
23
|
],
|
|
24
|
-
"_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-pdf/-/ej2-pdf-25.1.
|
|
25
|
-
"_shasum": "
|
|
24
|
+
"_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-pdf/-/ej2-pdf-25.1.38.tgz",
|
|
25
|
+
"_shasum": "ddd7622e294ff5ce770faa3bd555dfc6d274ae6f",
|
|
26
26
|
"_spec": "@syncfusion/ej2-pdf@*",
|
|
27
27
|
"_where": "/jenkins/workspace/elease-automation_release_25.1.1/packages/included",
|
|
28
28
|
"author": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"url": "https://github.com/syncfusion/ej2-javascript-ui-controls/tree/master/controls/pdf"
|
|
56
56
|
},
|
|
57
57
|
"typings": "index.d.ts",
|
|
58
|
-
"version": "25.1.
|
|
58
|
+
"version": "25.1.39",
|
|
59
59
|
"sideEffects": false,
|
|
60
60
|
"homepage": "https://www.syncfusion.com/javascript-ui-controls"
|
|
61
61
|
}
|
|
@@ -8136,33 +8136,53 @@ var PdfDocumentLinkAnnotation = /** @class */ (function (_super) {
|
|
|
8136
8136
|
}
|
|
8137
8137
|
if (holder) {
|
|
8138
8138
|
var index = _getPageIndex(this._crossReference._document, this._crossReference._fetch(holder));
|
|
8139
|
-
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
|
|
8143
|
-
if (mode
|
|
8144
|
-
|
|
8145
|
-
|
|
8146
|
-
|
|
8147
|
-
|
|
8148
|
-
|
|
8149
|
-
|
|
8150
|
-
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
|
|
8154
|
-
|| (typeof
|
|
8155
|
-
|
|
8139
|
+
if (index >= 0) {
|
|
8140
|
+
var page = this._crossReference._document.getPage(index);
|
|
8141
|
+
if (page && array[1] instanceof _PdfName) {
|
|
8142
|
+
var mode = array[1];
|
|
8143
|
+
if (mode) {
|
|
8144
|
+
if (mode.name === 'XYZ') {
|
|
8145
|
+
var left = array[2];
|
|
8146
|
+
var top_4 = array[3];
|
|
8147
|
+
var zoom = array[4];
|
|
8148
|
+
var topValue = (typeof top_4 !== 'undefined' && top_4 !== null) ? (page.size[1] - top_4) : 0;
|
|
8149
|
+
var leftValue = (typeof left !== 'undefined' && left !== null) ? left : 0;
|
|
8150
|
+
this._destination = new PdfDestination(page, [leftValue, topValue]);
|
|
8151
|
+
if (typeof zoom !== 'undefined' && zoom !== null) {
|
|
8152
|
+
this._destination.zoom = zoom;
|
|
8153
|
+
}
|
|
8154
|
+
if ((typeof left === 'undefined' && left === null) || (typeof top_4 === 'undefined' && top_4 === null)
|
|
8155
|
+
|| (typeof zoom === 'undefined' && zoom === null)) {
|
|
8156
|
+
this._destination._setValidation(false);
|
|
8157
|
+
}
|
|
8156
8158
|
}
|
|
8157
|
-
|
|
8158
|
-
else {
|
|
8159
|
-
if (page && mode.name === 'Fit') {
|
|
8159
|
+
else if (mode.name === 'Fit') {
|
|
8160
8160
|
this._destination = new PdfDestination(page);
|
|
8161
8161
|
this._destination.mode = PdfDestinationMode.fitToPage;
|
|
8162
8162
|
}
|
|
8163
8163
|
}
|
|
8164
8164
|
}
|
|
8165
8165
|
}
|
|
8166
|
+
else {
|
|
8167
|
+
this._destination = new PdfDestination();
|
|
8168
|
+
var zoom = array[4];
|
|
8169
|
+
var mode = array[1];
|
|
8170
|
+
if (typeof zoom !== 'undefined' && zoom !== null) {
|
|
8171
|
+
this._destination.zoom = zoom;
|
|
8172
|
+
}
|
|
8173
|
+
if (mode.name === 'Fit') {
|
|
8174
|
+
this._destination.mode = PdfDestinationMode.fitToPage;
|
|
8175
|
+
}
|
|
8176
|
+
else if (mode.name === 'XYZ') {
|
|
8177
|
+
var left = array[2];
|
|
8178
|
+
var topValue = array[3];
|
|
8179
|
+
if ((typeof left === 'undefined' && left === null) || (typeof topValue === 'undefined' && topValue === null)
|
|
8180
|
+
|| (typeof zoom === 'undefined' && zoom === null)) {
|
|
8181
|
+
this._destination._setValidation(false);
|
|
8182
|
+
}
|
|
8183
|
+
}
|
|
8184
|
+
this._destination._index = index;
|
|
8185
|
+
}
|
|
8166
8186
|
}
|
|
8167
8187
|
}
|
|
8168
8188
|
else if (this._dictionary.has('A') && !this._destination) {
|
|
@@ -9687,6 +9707,7 @@ var PdfRubberStampAnnotation = /** @class */ (function (_super) {
|
|
|
9687
9707
|
}
|
|
9688
9708
|
else if (bounds) {
|
|
9689
9709
|
templateDictionary.update('Matrix', [1, 0, 0, 1, -bounds[0], -bounds[1]]);
|
|
9710
|
+
template._size = [bounds[2], bounds[3]];
|
|
9690
9711
|
}
|
|
9691
9712
|
template._exportStream(dictionary, this._crossReference);
|
|
9692
9713
|
}
|
|
@@ -3101,8 +3101,7 @@ var PdfTextBoxField = /** @class */ (function (_super) {
|
|
|
3101
3101
|
}
|
|
3102
3102
|
}
|
|
3103
3103
|
parameter.bounds[2] = width;
|
|
3104
|
-
|
|
3105
|
-
this._drawTextBox(g, parameter, text, font, format, multiline, scroll);
|
|
3104
|
+
this._drawTextBox(g, parameter, text, font, new PdfStringFormat(PdfTextAlignment.center), multiline, scroll);
|
|
3106
3105
|
parameter.bounds[0] = parameter.bounds[0] + width;
|
|
3107
3106
|
if (parameter.borderWidth) {
|
|
3108
3107
|
g.drawLine(parameter.borderPen, parameter.bounds[0], parameter.bounds[1], parameter.bounds[0], parameter.bounds[1] + parameter.bounds[3]);
|
|
@@ -827,7 +827,7 @@ var _PdfCrossReference = /** @class */ (function () {
|
|
|
827
827
|
};
|
|
828
828
|
_PdfCrossReference.prototype._copyTrailer = function (newXref) {
|
|
829
829
|
newXref.set('Size', this._nextReferenceNumber);
|
|
830
|
-
|
|
830
|
+
newXref.set('Prev', this._prevXRefOffset);
|
|
831
831
|
var root = this._trailer.getRaw('Root'); // eslint-disable-line
|
|
832
832
|
if (typeof root !== 'undefined' && root !== null) {
|
|
833
833
|
newXref.set('Root', root);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _PdfCommand, _PdfName, _PdfDictionary, _isCommand, _PdfReference, _isName } from './pdf-primitives';
|
|
2
|
-
import { _isWhiteSpace,
|
|
2
|
+
import { _isWhiteSpace, FormatError, ParserEndOfFileException, _decodeText } from './utils';
|
|
3
3
|
import { _PdfNullStream } from './base-stream';
|
|
4
4
|
import { PdfPredictorStream } from './predictor-stream';
|
|
5
5
|
import { _PdfFlateStream } from './flate-stream';
|
|
@@ -500,6 +500,7 @@ var _PdfParser = /** @class */ (function () {
|
|
|
500
500
|
if (array.length === 0 && _isName(entry, 'Indexed')) {
|
|
501
501
|
this._isColorSpace = true;
|
|
502
502
|
}
|
|
503
|
+
entry = _decodeText(entry, this._isColorSpace, this._isPassword);
|
|
503
504
|
array.push(entry);
|
|
504
505
|
}
|
|
505
506
|
if (this.first === endOfFile) {
|
|
@@ -528,23 +529,7 @@ var _PdfParser = /** @class */ (function () {
|
|
|
528
529
|
break;
|
|
529
530
|
}
|
|
530
531
|
var value = this.getObject(cipherTransform); // eslint-disable-line
|
|
531
|
-
|
|
532
|
-
if (value.startsWith('þÿ')) {
|
|
533
|
-
value = value.substring(2);
|
|
534
|
-
if (value.endsWith('ÿý')) {
|
|
535
|
-
value = value.substring(0, value.length - 2);
|
|
536
|
-
}
|
|
537
|
-
var bytes = _stringToBytes(value);
|
|
538
|
-
var result = '';
|
|
539
|
-
for (var i = 0; i < bytes.length; i += 2) {
|
|
540
|
-
var x = bytes[Number.parseInt(i.toString(), 10)] << 8;
|
|
541
|
-
var y = bytes[Number.parseInt((i + 1).toString(), 10)];
|
|
542
|
-
var codeUnit = x | y;
|
|
543
|
-
result += String.fromCharCode(codeUnit);
|
|
544
|
-
}
|
|
545
|
-
value = result;
|
|
546
|
-
}
|
|
547
|
-
}
|
|
532
|
+
value = _decodeText(value, this._isColorSpace, this._isPassword);
|
|
548
533
|
this._isPassword = false;
|
|
549
534
|
dictionary.set(key, value);
|
|
550
535
|
}
|
package/src/pdf/core/utils.d.ts
CHANGED
|
@@ -749,3 +749,12 @@ export declare function _obtainDestination(dictionary: _PdfDictionary, key: stri
|
|
|
749
749
|
* @returns {number[]} bounds.
|
|
750
750
|
*/
|
|
751
751
|
export declare function _updateBounds(annotation: PdfAnnotation, bounds?: number[]): number[];
|
|
752
|
+
/**
|
|
753
|
+
* Decode text.
|
|
754
|
+
*
|
|
755
|
+
* @param {string} text Text to decode.
|
|
756
|
+
* @param {boolean} isColorSpace Color space or not
|
|
757
|
+
* @param {boolean} isPassword Password or not
|
|
758
|
+
* @returns {string} Decoded text.
|
|
759
|
+
*/
|
|
760
|
+
export declare function _decodeText(text: string, isColorSpace: boolean, isPassword: boolean): string;
|
package/src/pdf/core/utils.js
CHANGED
|
@@ -3929,3 +3929,31 @@ export function _updateBounds(annotation, bounds) {
|
|
|
3929
3929
|
}
|
|
3930
3930
|
return rect;
|
|
3931
3931
|
}
|
|
3932
|
+
/**
|
|
3933
|
+
* Decode text.
|
|
3934
|
+
*
|
|
3935
|
+
* @param {string} text Text to decode.
|
|
3936
|
+
* @param {boolean} isColorSpace Color space or not
|
|
3937
|
+
* @param {boolean} isPassword Password or not
|
|
3938
|
+
* @returns {string} Decoded text.
|
|
3939
|
+
*/
|
|
3940
|
+
export function _decodeText(text, isColorSpace, isPassword) {
|
|
3941
|
+
if (text && typeof text === 'string' && !isColorSpace && !isPassword) {
|
|
3942
|
+
if (text.startsWith('þÿ')) {
|
|
3943
|
+
text = text.substring(2);
|
|
3944
|
+
if (text.endsWith('ÿý')) {
|
|
3945
|
+
text = text.substring(0, text.length - 2);
|
|
3946
|
+
}
|
|
3947
|
+
var bytes = _stringToBytes(text);
|
|
3948
|
+
var result = '';
|
|
3949
|
+
for (var i = 0; i < bytes.length; i += 2) {
|
|
3950
|
+
var x = bytes[Number.parseInt(i.toString(), 10)] << 8;
|
|
3951
|
+
var y = bytes[Number.parseInt((i + 1).toString(), 10)];
|
|
3952
|
+
var codeUnit = x | y;
|
|
3953
|
+
result += String.fromCharCode(codeUnit);
|
|
3954
|
+
}
|
|
3955
|
+
text = result;
|
|
3956
|
+
}
|
|
3957
|
+
}
|
|
3958
|
+
return text;
|
|
3959
|
+
}
|