@syncfusion/ej2-pdf 23.2.6 → 24.1.44
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 +3 -37
- 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 +70 -36
- package/dist/es6/ej2-pdf.es2015.js.map +1 -1
- package/dist/es6/ej2-pdf.es5.js +68 -34
- 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 +8 -8
- package/src/pdf/core/annotations/annotation.js +3 -8
- package/src/pdf/core/graphics/images/image-decoder.js +3 -3
- package/src/pdf/core/import-export/json-document.js +32 -16
- package/src/pdf/core/import-export/xfdf-document.js +30 -7
|
@@ -16236,7 +16236,7 @@ class PdfLineAnnotation extends PdfComment {
|
|
|
16236
16236
|
get leaderExt() {
|
|
16237
16237
|
if (typeof this._leaderExt === 'undefined' && this._dictionary.has('LLE')) {
|
|
16238
16238
|
const leaderExt = this._dictionary.get('LLE');
|
|
16239
|
-
if (typeof leaderExt !== 'undefined'
|
|
16239
|
+
if (typeof leaderExt !== 'undefined') {
|
|
16240
16240
|
this._leaderExt = leaderExt;
|
|
16241
16241
|
}
|
|
16242
16242
|
}
|
|
@@ -16261,13 +16261,8 @@ class PdfLineAnnotation extends PdfComment {
|
|
|
16261
16261
|
*/
|
|
16262
16262
|
set leaderExt(value) {
|
|
16263
16263
|
if (!Number.isNaN(value)) {
|
|
16264
|
-
|
|
16265
|
-
|
|
16266
|
-
this._leaderExt = value;
|
|
16267
|
-
}
|
|
16268
|
-
else {
|
|
16269
|
-
throw new Error('LeaderExt should be non negative number');
|
|
16270
|
-
}
|
|
16264
|
+
this._dictionary.update('LLE', value);
|
|
16265
|
+
this._leaderExt = value;
|
|
16271
16266
|
}
|
|
16272
16267
|
}
|
|
16273
16268
|
/**
|
|
@@ -42508,23 +42503,30 @@ class _XfdfDocument extends _ExportHelper {
|
|
|
42508
42503
|
const streamDictionary = primitive.dictionary;
|
|
42509
42504
|
this._writePrefix(writer, 'STREAM', key);
|
|
42510
42505
|
writer._writeAttributeString('DEFINE', '');
|
|
42511
|
-
|
|
42512
|
-
writer._writeStartElement('DATA');
|
|
42513
|
-
const length = streamDictionary.get('Length');
|
|
42514
|
-
if (length > 0 && (streamDictionary.has('Subtype') &&
|
|
42506
|
+
if ((streamDictionary.has('Subtype') &&
|
|
42515
42507
|
this._getValue(streamDictionary.get('Subtype')) === 'Image') ||
|
|
42516
42508
|
(!streamDictionary.has('Type') && !streamDictionary.has('Subtype'))) {
|
|
42509
|
+
const data = primitive.getString(true);
|
|
42510
|
+
if (!streamDictionary.has('Length') && data && data !== '') {
|
|
42511
|
+
streamDictionary.update('Length', primitive.length);
|
|
42512
|
+
}
|
|
42513
|
+
this._writeAppearanceDictionary(writer, streamDictionary);
|
|
42514
|
+
writer._writeStartElement('DATA');
|
|
42517
42515
|
writer._writeAttributeString('MODE', 'RAW');
|
|
42518
42516
|
writer._writeAttributeString('ENCODING', 'HEX');
|
|
42519
|
-
const data = primitive.getString();
|
|
42520
42517
|
if (data && data !== '') {
|
|
42521
42518
|
writer._writeRaw(data);
|
|
42522
42519
|
}
|
|
42523
42520
|
}
|
|
42524
|
-
else
|
|
42521
|
+
else {
|
|
42522
|
+
const data = primitive.getString();
|
|
42523
|
+
if (!streamDictionary.has('Length') && data && data !== '') {
|
|
42524
|
+
streamDictionary.update('Length', primitive.length);
|
|
42525
|
+
}
|
|
42526
|
+
this._writeAppearanceDictionary(writer, streamDictionary);
|
|
42527
|
+
writer._writeStartElement('DATA');
|
|
42525
42528
|
writer._writeAttributeString('MODE', 'FILTERED');
|
|
42526
42529
|
writer._writeAttributeString('ENCODING', 'ASCII');
|
|
42527
|
-
const data = primitive.getString();
|
|
42528
42530
|
if (data && data !== '') {
|
|
42529
42531
|
writer._writeRaw(data);
|
|
42530
42532
|
}
|
|
@@ -43591,6 +43593,22 @@ class _XfdfDocument extends _ExportHelper {
|
|
|
43591
43593
|
data = this._getData(element);
|
|
43592
43594
|
if (data && data.length > 0 && source instanceof _PdfContentStream) {
|
|
43593
43595
|
source._bytes = data;
|
|
43596
|
+
let isImage = false;
|
|
43597
|
+
if (appearance && appearance.has('Subtype')) {
|
|
43598
|
+
const type = appearance.get('Subtype');
|
|
43599
|
+
isImage = type && type.name === 'Image';
|
|
43600
|
+
}
|
|
43601
|
+
if (isImage) {
|
|
43602
|
+
source._isCompress = false;
|
|
43603
|
+
}
|
|
43604
|
+
else {
|
|
43605
|
+
if (source.dictionary.has('Length')) {
|
|
43606
|
+
delete source.dictionary._map.Length;
|
|
43607
|
+
}
|
|
43608
|
+
if (source.dictionary.has('Filter')) {
|
|
43609
|
+
delete source.dictionary._map.Filter;
|
|
43610
|
+
}
|
|
43611
|
+
}
|
|
43594
43612
|
}
|
|
43595
43613
|
break;
|
|
43596
43614
|
}
|
|
@@ -44649,27 +44667,27 @@ class _JsonDocument extends _ExportHelper {
|
|
|
44649
44667
|
const dataTable = new Map(); // eslint-disable-line
|
|
44650
44668
|
const streamTable = new Map(); // eslint-disable-line
|
|
44651
44669
|
const streamDictionary = value.dictionary;
|
|
44670
|
+
const data = value.getString(true);
|
|
44671
|
+
if (!streamDictionary.has('Length') && data && data !== '') {
|
|
44672
|
+
streamDictionary.update('Length', value.length);
|
|
44673
|
+
}
|
|
44652
44674
|
this._writeAppearanceDictionary(streamTable, streamDictionary);
|
|
44653
|
-
const length = streamDictionary.get('Length');
|
|
44654
44675
|
let type;
|
|
44655
44676
|
if (streamDictionary.has('Subtype')) {
|
|
44656
44677
|
type = this._getValue(streamDictionary.get('Subtype'));
|
|
44657
44678
|
}
|
|
44658
|
-
if (
|
|
44659
|
-
|
|
44660
|
-
(
|
|
44661
|
-
|
|
44662
|
-
|
|
44663
|
-
|
|
44664
|
-
|
|
44665
|
-
|
|
44666
|
-
|
|
44667
|
-
|
|
44668
|
-
|
|
44669
|
-
|
|
44670
|
-
if (data && data !== '') {
|
|
44671
|
-
dataTable.set('bytes', data);
|
|
44672
|
-
}
|
|
44679
|
+
if ((!streamDictionary.has('Type') && !streamDictionary.has('Subtype')) ||
|
|
44680
|
+
(streamDictionary.has('Subtype') &&
|
|
44681
|
+
(type === 'Image' || type === 'Form' || type === 'CIDFontType0C' || type === 'OpenType'))) {
|
|
44682
|
+
dataTable.set('mode', 'raw');
|
|
44683
|
+
dataTable.set('encoding', 'hex');
|
|
44684
|
+
}
|
|
44685
|
+
else {
|
|
44686
|
+
dataTable.set('mode', 'filtered');
|
|
44687
|
+
dataTable.set('encoding', 'ascii');
|
|
44688
|
+
}
|
|
44689
|
+
if (data && data !== '') {
|
|
44690
|
+
dataTable.set('bytes', data);
|
|
44673
44691
|
}
|
|
44674
44692
|
streamTable.set('data', this._convertToJson(dataTable));
|
|
44675
44693
|
this._writeTable('stream', this._convertToJson(streamTable), table, key, array);
|
|
@@ -45526,6 +45544,22 @@ class _JsonDocument extends _ExportHelper {
|
|
|
45526
45544
|
}
|
|
45527
45545
|
const stream = new _PdfContentStream(bytes);
|
|
45528
45546
|
const dictionary = this._parseDictionary(element);
|
|
45547
|
+
let isImage = false;
|
|
45548
|
+
if (dictionary && dictionary.has('Subtype')) {
|
|
45549
|
+
const type = dictionary.get('Subtype');
|
|
45550
|
+
isImage = type && type.name === 'Image';
|
|
45551
|
+
}
|
|
45552
|
+
if (isImage) {
|
|
45553
|
+
stream._isCompress = false;
|
|
45554
|
+
}
|
|
45555
|
+
else {
|
|
45556
|
+
if (dictionary.has('Length')) {
|
|
45557
|
+
delete dictionary._map.Length;
|
|
45558
|
+
}
|
|
45559
|
+
if (dictionary.has('Filter')) {
|
|
45560
|
+
delete dictionary._map.Filter;
|
|
45561
|
+
}
|
|
45562
|
+
}
|
|
45529
45563
|
stream.dictionary = dictionary;
|
|
45530
45564
|
result = stream;
|
|
45531
45565
|
}
|
|
@@ -48288,7 +48322,7 @@ class _ImageDecoder {
|
|
|
48288
48322
|
}
|
|
48289
48323
|
}
|
|
48290
48324
|
_skipStream() {
|
|
48291
|
-
|
|
48325
|
+
const length = this._getBuffer(this._position) << 8 | this._getBuffer(this._position + 1);
|
|
48292
48326
|
this._seek(2);
|
|
48293
48327
|
if (length < 2) {
|
|
48294
48328
|
throw new Error('Error decoding JPEG image');
|
|
@@ -48300,7 +48334,7 @@ class _ImageDecoder {
|
|
|
48300
48334
|
_readExceededJpegImage() {
|
|
48301
48335
|
let isContinueReading = true;
|
|
48302
48336
|
while (isContinueReading) {
|
|
48303
|
-
|
|
48337
|
+
const marker = this._getMarker();
|
|
48304
48338
|
switch (marker) {
|
|
48305
48339
|
case 0x00C0:
|
|
48306
48340
|
case 0x00C1:
|
|
@@ -48337,14 +48371,14 @@ class _ImageDecoder {
|
|
|
48337
48371
|
_getMarker() {
|
|
48338
48372
|
let skippedByte = 0;
|
|
48339
48373
|
let marker = this._readByte();
|
|
48340
|
-
while (marker
|
|
48374
|
+
while (marker !== 255) {
|
|
48341
48375
|
skippedByte++;
|
|
48342
48376
|
marker = this._readByte();
|
|
48343
48377
|
}
|
|
48344
48378
|
do {
|
|
48345
48379
|
marker = this._readByte();
|
|
48346
|
-
} while (marker
|
|
48347
|
-
if (skippedByte
|
|
48380
|
+
} while (marker === 255);
|
|
48381
|
+
if (skippedByte !== 0) {
|
|
48348
48382
|
throw new Error('Error decoding JPEG image');
|
|
48349
48383
|
}
|
|
48350
48384
|
return this._toUnsigned16(marker);
|