@syncfusion/ej2-pdf 24.1.41 → 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.
@@ -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' && leaderExt >= 0) {
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
- if (value >= 0) {
16265
- this._dictionary.update('LLE', value);
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,24 +42503,33 @@ class _XfdfDocument extends _ExportHelper {
42508
42503
  const streamDictionary = primitive.dictionary;
42509
42504
  this._writePrefix(writer, 'STREAM', key);
42510
42505
  writer._writeAttributeString('DEFINE', '');
42511
- const data = primitive.getString();
42512
- if (!streamDictionary.has('Length') && data && data !== '') {
42513
- streamDictionary.update('Length', primitive.length);
42514
- }
42515
- this._writeAppearanceDictionary(writer, streamDictionary);
42516
- writer._writeStartElement('DATA');
42517
42506
  if ((streamDictionary.has('Subtype') &&
42518
42507
  this._getValue(streamDictionary.get('Subtype')) === 'Image') ||
42519
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');
42520
42515
  writer._writeAttributeString('MODE', 'RAW');
42521
42516
  writer._writeAttributeString('ENCODING', 'HEX');
42517
+ if (data && data !== '') {
42518
+ writer._writeRaw(data);
42519
+ }
42522
42520
  }
42523
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');
42524
42528
  writer._writeAttributeString('MODE', 'FILTERED');
42525
42529
  writer._writeAttributeString('ENCODING', 'ASCII');
42526
- }
42527
- if (data && data !== '') {
42528
- writer._writeRaw(data);
42530
+ if (data && data !== '') {
42531
+ writer._writeRaw(data);
42532
+ }
42529
42533
  }
42530
42534
  writer._writeEndElement();
42531
42535
  writer._writeEndElement();
@@ -43589,6 +43593,22 @@ class _XfdfDocument extends _ExportHelper {
43589
43593
  data = this._getData(element);
43590
43594
  if (data && data.length > 0 && source instanceof _PdfContentStream) {
43591
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
+ }
43592
43612
  }
43593
43613
  break;
43594
43614
  }
@@ -45524,6 +45544,22 @@ class _JsonDocument extends _ExportHelper {
45524
45544
  }
45525
45545
  const stream = new _PdfContentStream(bytes);
45526
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
+ }
45527
45563
  stream.dictionary = dictionary;
45528
45564
  result = stream;
45529
45565
  }
@@ -48335,14 +48371,14 @@ class _ImageDecoder {
48335
48371
  _getMarker() {
48336
48372
  let skippedByte = 0;
48337
48373
  let marker = this._readByte();
48338
- while (marker != 255) {
48374
+ while (marker !== 255) {
48339
48375
  skippedByte++;
48340
48376
  marker = this._readByte();
48341
48377
  }
48342
48378
  do {
48343
48379
  marker = this._readByte();
48344
- } while (marker == 255);
48345
- if (skippedByte != 0) {
48380
+ } while (marker === 255);
48381
+ if (skippedByte !== 0) {
48346
48382
  throw new Error('Error decoding JPEG image');
48347
48383
  }
48348
48384
  return this._toUnsigned16(marker);