@syncfusion/ej2-pdf 25.1.37 → 25.1.38
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 -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 +45 -22
- package/dist/es6/ej2-pdf.es2015.js.map +1 -1
- package/dist/es6/ej2-pdf.es5.js +44 -21
- 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 +3 -3
- package/src/pdf/core/annotations/annotation.js +23 -5
- package/src/pdf/core/base-stream.d.ts +1 -1
- package/src/pdf/core/base-stream.js +5 -15
- package/src/pdf/core/import-export/json-document.js +14 -2
- package/src/pdf/core/pdf-cross-reference.d.ts +1 -0
- package/src/pdf/core/pdf-cross-reference.js +4 -1
|
@@ -13196,7 +13196,19 @@ class _JsonDocument extends _ExportHelper {
|
|
|
13196
13196
|
const dataTable = new Map(); // eslint-disable-line
|
|
13197
13197
|
const streamTable = new Map(); // eslint-disable-line
|
|
13198
13198
|
const streamDictionary = value.dictionary;
|
|
13199
|
-
|
|
13199
|
+
let data;
|
|
13200
|
+
let baseStream = value; // eslint-disable-line
|
|
13201
|
+
let isImageStream = false;
|
|
13202
|
+
if (streamDictionary.has('Subtype') && streamDictionary.get('Subtype').name === 'Image') {
|
|
13203
|
+
isImageStream = true;
|
|
13204
|
+
}
|
|
13205
|
+
if (isImageStream && baseStream.stream && baseStream.stream instanceof _PdfStream) {
|
|
13206
|
+
const stream = baseStream.stream;
|
|
13207
|
+
data = baseStream.getString(true, stream.getByteRange(stream.start, stream.end));
|
|
13208
|
+
}
|
|
13209
|
+
else {
|
|
13210
|
+
data = value.getString(true);
|
|
13211
|
+
}
|
|
13200
13212
|
if (!streamDictionary.has('Length') && data && data !== '') {
|
|
13201
13213
|
streamDictionary.update('Length', value.length);
|
|
13202
13214
|
}
|
|
@@ -26382,8 +26394,26 @@ class PdfSquareAnnotation extends PdfComment {
|
|
|
26382
26394
|
}
|
|
26383
26395
|
}
|
|
26384
26396
|
if (isFlatten && this._appearanceTemplate) {
|
|
26385
|
-
const
|
|
26386
|
-
|
|
26397
|
+
const appearanceDictionary = this._appearanceTemplate._content.dictionary;
|
|
26398
|
+
const isValid = appearanceDictionary && appearanceDictionary.has('BBox') && !appearanceDictionary.has('CropBox') && !appearanceDictionary.has('MediaBox');
|
|
26399
|
+
if (isValid && this.measure) {
|
|
26400
|
+
const graphics = this._page.graphics;
|
|
26401
|
+
const state = graphics.save();
|
|
26402
|
+
if (typeof this.opacity !== 'undefined' && this._opacity < 1) {
|
|
26403
|
+
graphics.setTransparency(this._opacity);
|
|
26404
|
+
}
|
|
26405
|
+
const point = this.bounds;
|
|
26406
|
+
const box = this._appearanceTemplate._content.dictionary.getArray('BBox');
|
|
26407
|
+
point.x -= box[0];
|
|
26408
|
+
point.y += box[1];
|
|
26409
|
+
graphics.drawTemplate(this._appearanceTemplate, point);
|
|
26410
|
+
graphics.restore(state);
|
|
26411
|
+
this._removeAnnotationFromPage(this._page, this);
|
|
26412
|
+
}
|
|
26413
|
+
else {
|
|
26414
|
+
const isNormalMatrix = this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary);
|
|
26415
|
+
this._flattenAnnotationTemplate(this._appearanceTemplate, isNormalMatrix);
|
|
26416
|
+
}
|
|
26387
26417
|
}
|
|
26388
26418
|
if (!isFlatten && this._setAppearance && !this.measure) {
|
|
26389
26419
|
let appearance;
|
|
@@ -26518,16 +26548,16 @@ class PdfSquareAnnotation extends PdfComment {
|
|
|
26518
26548
|
const converter = new _PdfUnitConvertor();
|
|
26519
26549
|
let value;
|
|
26520
26550
|
if (this.bounds.width === this.bounds.height) {
|
|
26521
|
-
value = this._getEqualPdfGraphicsUnit(this.
|
|
26551
|
+
value = this._getEqualPdfGraphicsUnit(this.unit, this._unitString);
|
|
26522
26552
|
this._unitString = value.unitString;
|
|
26523
26553
|
const width = converter._convertUnits(this.bounds.width, _PdfGraphicsUnit.point, value.graphicsUnit);
|
|
26524
26554
|
area = width * width;
|
|
26525
26555
|
}
|
|
26526
26556
|
else {
|
|
26527
|
-
value = this._getEqualPdfGraphicsUnit(this.
|
|
26557
|
+
value = this._getEqualPdfGraphicsUnit(this.unit, this._unitString);
|
|
26528
26558
|
this._unitString = value.unitString;
|
|
26529
26559
|
const width = converter._convertUnits(this.bounds.width, _PdfGraphicsUnit.point, value.graphicsUnit);
|
|
26530
|
-
value = this._getEqualPdfGraphicsUnit(this.
|
|
26560
|
+
value = this._getEqualPdfGraphicsUnit(this.unit, this._unitString);
|
|
26531
26561
|
this._unitString = value.unitString;
|
|
26532
26562
|
const height = converter._convertUnits(this.bounds.height, _PdfGraphicsUnit.point, value.graphicsUnit);
|
|
26533
26563
|
area = width * height;
|
|
@@ -43510,25 +43540,15 @@ class _PdfBaseStream {
|
|
|
43510
43540
|
moveStart() {
|
|
43511
43541
|
return null;
|
|
43512
43542
|
}
|
|
43513
|
-
getString(isHex = false) {
|
|
43514
|
-
|
|
43515
|
-
|
|
43516
|
-
throw new Error('Invalid argument for bytesToString');
|
|
43543
|
+
getString(isHex = false, bytes) {
|
|
43544
|
+
if (typeof bytes === 'undefined' || bytes === null) {
|
|
43545
|
+
bytes = this.getBytes();
|
|
43517
43546
|
}
|
|
43518
43547
|
if (isHex) {
|
|
43519
43548
|
return _byteArrayToHexString(bytes);
|
|
43520
43549
|
}
|
|
43521
43550
|
else {
|
|
43522
|
-
|
|
43523
|
-
const max = 8192;
|
|
43524
|
-
if (len < max) {
|
|
43525
|
-
return String.fromCharCode.apply(null, bytes);
|
|
43526
|
-
}
|
|
43527
|
-
const stringBuffer = [];
|
|
43528
|
-
for (let i = 0; i < len; i += max) {
|
|
43529
|
-
stringBuffer.push(String.fromCharCode.apply(null, bytes.subarray(i, Math.min(i + max, len))));
|
|
43530
|
-
}
|
|
43531
|
-
return stringBuffer.join('');
|
|
43551
|
+
return _bytesToString(bytes);
|
|
43532
43552
|
}
|
|
43533
43553
|
}
|
|
43534
43554
|
skip(n) {
|
|
@@ -47464,6 +47484,9 @@ class _PdfCrossReference {
|
|
|
47464
47484
|
_setStartXRef(startXRef) {
|
|
47465
47485
|
this._startXRefQueue = [startXRef];
|
|
47466
47486
|
this._prevStartXref = startXRef;
|
|
47487
|
+
if (typeof this._prevXRefOffset === 'undefined' || this._prevXRefOffset === null) {
|
|
47488
|
+
this._prevXRefOffset = startXRef;
|
|
47489
|
+
}
|
|
47467
47490
|
}
|
|
47468
47491
|
_parse(recoveryMode) {
|
|
47469
47492
|
let trailerDictionary;
|
|
@@ -48265,7 +48288,7 @@ class _PdfCrossReference {
|
|
|
48265
48288
|
}
|
|
48266
48289
|
_copyTrailer(newXref) {
|
|
48267
48290
|
newXref.set('Size', this._nextReferenceNumber);
|
|
48268
|
-
newXref.set('Prev', this._prevStartXref);
|
|
48291
|
+
this._document._isEncrypted ? newXref.set('Prev', this._prevXRefOffset) : newXref.set('Prev', this._prevStartXref);
|
|
48269
48292
|
const root = this._trailer.getRaw('Root'); // eslint-disable-line
|
|
48270
48293
|
if (typeof root !== 'undefined' && root !== null) {
|
|
48271
48294
|
newXref.set('Root', root);
|
|
@@ -51196,7 +51219,7 @@ class PdfDocument {
|
|
|
51196
51219
|
pageDictionary.update('Parent', sectionReference);
|
|
51197
51220
|
sectionDictionary.update('Kids', [pageReference]);
|
|
51198
51221
|
if (this.pageCount === 0) {
|
|
51199
|
-
|
|
51222
|
+
const parentReference = this._catalog._catalogDictionary._get('Pages');
|
|
51200
51223
|
if (parentReference && this._catalog._topPagesDictionary) {
|
|
51201
51224
|
this._catalog._topPagesDictionary.update('Kids', [sectionReference]);
|
|
51202
51225
|
sectionDictionary.update('Parent', parentReference);
|