@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.
@@ -16936,7 +16936,7 @@ var PdfLineAnnotation = /** @__PURE__ @class */ (function (_super) {
16936
16936
  get: function () {
16937
16937
  if (typeof this._leaderExt === 'undefined' && this._dictionary.has('LLE')) {
16938
16938
  var leaderExt = this._dictionary.get('LLE');
16939
- if (typeof leaderExt !== 'undefined' && leaderExt >= 0) {
16939
+ if (typeof leaderExt !== 'undefined') {
16940
16940
  this._leaderExt = leaderExt;
16941
16941
  }
16942
16942
  }
@@ -16961,13 +16961,8 @@ var PdfLineAnnotation = /** @__PURE__ @class */ (function (_super) {
16961
16961
  */
16962
16962
  set: function (value) {
16963
16963
  if (!Number.isNaN(value)) {
16964
- if (value >= 0) {
16965
- this._dictionary.update('LLE', value);
16966
- this._leaderExt = value;
16967
- }
16968
- else {
16969
- throw new Error('LeaderExt should be non negative number');
16970
- }
16964
+ this._dictionary.update('LLE', value);
16965
+ this._leaderExt = value;
16971
16966
  }
16972
16967
  },
16973
16968
  enumerable: true,
@@ -44117,23 +44112,30 @@ var _XfdfDocument = /** @__PURE__ @class */ (function (_super) {
44117
44112
  var streamDictionary = primitive.dictionary;
44118
44113
  this._writePrefix(writer, 'STREAM', key);
44119
44114
  writer._writeAttributeString('DEFINE', '');
44120
- this._writeAppearanceDictionary(writer, streamDictionary);
44121
- writer._writeStartElement('DATA');
44122
- var length_1 = streamDictionary.get('Length');
44123
- if (length_1 > 0 && (streamDictionary.has('Subtype') &&
44115
+ if ((streamDictionary.has('Subtype') &&
44124
44116
  this._getValue(streamDictionary.get('Subtype')) === 'Image') ||
44125
44117
  (!streamDictionary.has('Type') && !streamDictionary.has('Subtype'))) {
44118
+ var data = primitive.getString(true);
44119
+ if (!streamDictionary.has('Length') && data && data !== '') {
44120
+ streamDictionary.update('Length', primitive.length);
44121
+ }
44122
+ this._writeAppearanceDictionary(writer, streamDictionary);
44123
+ writer._writeStartElement('DATA');
44126
44124
  writer._writeAttributeString('MODE', 'RAW');
44127
44125
  writer._writeAttributeString('ENCODING', 'HEX');
44128
- var data = primitive.getString();
44129
44126
  if (data && data !== '') {
44130
44127
  writer._writeRaw(data);
44131
44128
  }
44132
44129
  }
44133
- else if (length_1 > 0) {
44130
+ else {
44131
+ var data = primitive.getString();
44132
+ if (!streamDictionary.has('Length') && data && data !== '') {
44133
+ streamDictionary.update('Length', primitive.length);
44134
+ }
44135
+ this._writeAppearanceDictionary(writer, streamDictionary);
44136
+ writer._writeStartElement('DATA');
44134
44137
  writer._writeAttributeString('MODE', 'FILTERED');
44135
44138
  writer._writeAttributeString('ENCODING', 'ASCII');
44136
- var data = primitive.getString();
44137
44139
  if (data && data !== '') {
44138
44140
  writer._writeRaw(data);
44139
44141
  }
@@ -45210,6 +45212,22 @@ var _XfdfDocument = /** @__PURE__ @class */ (function (_super) {
45210
45212
  data = this._getData(element);
45211
45213
  if (data && data.length > 0 && source instanceof _PdfContentStream) {
45212
45214
  source._bytes = data;
45215
+ var isImage = false;
45216
+ if (appearance && appearance.has('Subtype')) {
45217
+ var type = appearance.get('Subtype');
45218
+ isImage = type && type.name === 'Image';
45219
+ }
45220
+ if (isImage) {
45221
+ source._isCompress = false;
45222
+ }
45223
+ else {
45224
+ if (source.dictionary.has('Length')) {
45225
+ delete source.dictionary._map.Length;
45226
+ }
45227
+ if (source.dictionary.has('Filter')) {
45228
+ delete source.dictionary._map.Filter;
45229
+ }
45230
+ }
45213
45231
  }
45214
45232
  break;
45215
45233
  }
@@ -46306,27 +46324,27 @@ var _JsonDocument = /** @__PURE__ @class */ (function (_super) {
46306
46324
  var dataTable = new Map(); // eslint-disable-line
46307
46325
  var streamTable = new Map(); // eslint-disable-line
46308
46326
  var streamDictionary = value.dictionary;
46327
+ var data = value.getString(true);
46328
+ if (!streamDictionary.has('Length') && data && data !== '') {
46329
+ streamDictionary.update('Length', value.length);
46330
+ }
46309
46331
  this._writeAppearanceDictionary(streamTable, streamDictionary);
46310
- var length_1 = streamDictionary.get('Length');
46311
46332
  var type = void 0;
46312
46333
  if (streamDictionary.has('Subtype')) {
46313
46334
  type = this._getValue(streamDictionary.get('Subtype'));
46314
46335
  }
46315
- if (length_1 > 0) {
46316
- if ((!streamDictionary.has('Type') && !streamDictionary.has('Subtype')) ||
46317
- (streamDictionary.has('Subtype') &&
46318
- (type === 'Image' || type === 'Form' || type === 'CIDFontType0C' || type === 'OpenType'))) {
46319
- dataTable.set('mode', 'raw');
46320
- dataTable.set('encoding', 'hex');
46321
- }
46322
- else {
46323
- dataTable.set('mode', 'filtered');
46324
- dataTable.set('encoding', 'ascii');
46325
- }
46326
- var data = value.getString(true);
46327
- if (data && data !== '') {
46328
- dataTable.set('bytes', data);
46329
- }
46336
+ if ((!streamDictionary.has('Type') && !streamDictionary.has('Subtype')) ||
46337
+ (streamDictionary.has('Subtype') &&
46338
+ (type === 'Image' || type === 'Form' || type === 'CIDFontType0C' || type === 'OpenType'))) {
46339
+ dataTable.set('mode', 'raw');
46340
+ dataTable.set('encoding', 'hex');
46341
+ }
46342
+ else {
46343
+ dataTable.set('mode', 'filtered');
46344
+ dataTable.set('encoding', 'ascii');
46345
+ }
46346
+ if (data && data !== '') {
46347
+ dataTable.set('bytes', data);
46330
46348
  }
46331
46349
  streamTable.set('data', this._convertToJson(dataTable));
46332
46350
  this._writeTable('stream', this._convertToJson(streamTable), table, key, array);
@@ -47193,6 +47211,22 @@ var _JsonDocument = /** @__PURE__ @class */ (function (_super) {
47193
47211
  }
47194
47212
  var stream = new _PdfContentStream(bytes);
47195
47213
  var dictionary = this._parseDictionary(element);
47214
+ var isImage = false;
47215
+ if (dictionary && dictionary.has('Subtype')) {
47216
+ var type = dictionary.get('Subtype');
47217
+ isImage = type && type.name === 'Image';
47218
+ }
47219
+ if (isImage) {
47220
+ stream._isCompress = false;
47221
+ }
47222
+ else {
47223
+ if (dictionary.has('Length')) {
47224
+ delete dictionary._map.Length;
47225
+ }
47226
+ if (dictionary.has('Filter')) {
47227
+ delete dictionary._map.Filter;
47228
+ }
47229
+ }
47196
47230
  stream.dictionary = dictionary;
47197
47231
  result = stream;
47198
47232
  }
@@ -50198,14 +50232,14 @@ var _ImageDecoder = /** @__PURE__ @class */ (function () {
50198
50232
  _ImageDecoder.prototype._getMarker = function () {
50199
50233
  var skippedByte = 0;
50200
50234
  var marker = this._readByte();
50201
- while (marker != 255) {
50235
+ while (marker !== 255) {
50202
50236
  skippedByte++;
50203
50237
  marker = this._readByte();
50204
50238
  }
50205
50239
  do {
50206
50240
  marker = this._readByte();
50207
- } while (marker == 255);
50208
- if (skippedByte != 0) {
50241
+ } while (marker === 255);
50242
+ if (skippedByte !== 0) {
50209
50243
  throw new Error('Error decoding JPEG image');
50210
50244
  }
50211
50245
  return this._toUnsigned16(marker);