@syncfusion/ej2-pdf-export 29.2.4 → 30.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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 29.2.4
3
+ * version : 30.1.38
4
4
  * Copyright Syncfusion Inc. 2001 - 2024. 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,54 +1,17 @@
1
1
  {
2
- "_from": "@syncfusion/ej2-pdf-export@*",
3
- "_id": "@syncfusion/ej2-pdf-export@29.1.40",
4
- "_inBundle": false,
5
- "_integrity": "sha512-NQyWKCZHp1wP+Knk5an8NHYns3wGI10zYGofj25GECylywMbPj2pyauCymPKa8ePShj6op1KByZGWf9F+UbbRA==",
6
- "_location": "/@syncfusion/ej2-pdf-export",
7
- "_phantomChildren": {},
8
- "_requested": {
9
- "type": "range",
10
- "registry": true,
11
- "raw": "@syncfusion/ej2-pdf-export@*",
12
- "name": "@syncfusion/ej2-pdf-export",
13
- "escapedName": "@syncfusion%2fej2-pdf-export",
14
- "scope": "@syncfusion",
15
- "rawSpec": "*",
16
- "saveSpec": null,
17
- "fetchSpec": "*"
18
- },
19
- "_requiredBy": [
20
- "/",
21
- "/@syncfusion/ej2",
22
- "/@syncfusion/ej2-charts",
23
- "/@syncfusion/ej2-circulargauge",
24
- "/@syncfusion/ej2-grids",
25
- "/@syncfusion/ej2-heatmap",
26
- "/@syncfusion/ej2-lineargauge",
27
- "/@syncfusion/ej2-maps",
28
- "/@syncfusion/ej2-pivotview",
29
- "/@syncfusion/ej2-treemap"
30
- ],
31
- "_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-pdf-export/-/ej2-pdf-export-29.1.40.tgz",
32
- "_shasum": "5d0a3735ab2d0b6eedf8473d7e14a23dde21a37b",
33
- "_spec": "@syncfusion/ej2-pdf-export@*",
34
- "_where": "/jenkins/workspace/elease-automation_release_29.1.1/packages/included",
35
- "author": {
36
- "name": "Syncfusion Inc."
37
- },
38
- "bundleDependencies": false,
39
- "dependencies": {
40
- "@syncfusion/ej2-compression": "~29.2.4"
41
- },
42
- "deprecated": false,
2
+ "name": "@syncfusion/ej2-pdf-export",
3
+ "version": "30.1.38",
43
4
  "description": "Syncfusion TypeScript Component",
44
- "devDependencies": {},
45
- "es2015": "./dist/es6/ej2-pdf-export.es5.js",
5
+ "author": "Syncfusion Inc.",
46
6
  "license": "SEE LICENSE IN license",
47
7
  "main": "./dist/ej2-pdf-export.umd.min.js",
48
8
  "module": "./index.js",
49
- "name": "@syncfusion/ej2-pdf-export",
9
+ "es2015": "./dist/es6/ej2-pdf-export.es5.js",
10
+ "devDependencies": {},
11
+ "dependencies": {
12
+ "@syncfusion/ej2-compression": "~30.1.37"
13
+ },
50
14
  "typings": "index.d.ts",
51
- "version": "29.2.4",
52
15
  "sideEffects": false,
53
16
  "homepage": "https://www.syncfusion.com/javascript-ui-controls"
54
17
  }
@@ -21,6 +21,7 @@ export declare class TtfReader {
21
21
  private missedGlyphs;
22
22
  private tableNames;
23
23
  private entrySelectors;
24
+ _isOpenTypeFont: boolean;
24
25
  /**
25
26
  * Width table.
26
27
  */
@@ -193,6 +194,7 @@ export declare class TtfReader {
193
194
  * @private
194
195
  */
195
196
  readFontProgram(chars: Dictionary<string, string>): number[];
197
+ _readCompactFontFormatTable(): number[];
196
198
  /**
197
199
  * Reconverts string to be in proper format saved into PDF file.
198
200
  */
@@ -35,6 +35,7 @@ var TtfReader = /** @class */ (function () {
35
35
  this.missedGlyphs = 0;
36
36
  this.tableNames = ['cvt ', 'fpgm', 'glyf', 'head', 'hhea', 'hmtx', 'loca', 'maxp', 'prep'];
37
37
  this.entrySelectors = [0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4];
38
+ this._isOpenTypeFont = false;
38
39
  this.fontData = fontData;
39
40
  this.initialize();
40
41
  }
@@ -170,6 +171,9 @@ var TtfReader = /** @class */ (function () {
170
171
  this.offset = this.readInt32(this.offset);
171
172
  version = this.readInt32(this.offset);
172
173
  }
174
+ if (version === 0x4f54544f) {
175
+ this._isOpenTypeFont = true;
176
+ }
173
177
  return version;
174
178
  };
175
179
  TtfReader.prototype.readNameTable = function () {
@@ -588,7 +592,7 @@ var TtfReader = /** @class */ (function () {
588
592
  // NOTE: Strange!
589
593
  this.metrics.stemV = 80;
590
594
  this.metrics.widthTable = this.updateWidth();
591
- this.metrics.contains = this.tableDirectory.containsKey('CFF');
595
+ this.metrics.contains = this.tableDirectory.containsKey('CFF ');
592
596
  this.metrics.subScriptSizeFactor = headTable.unitsPerEm / os2Table.ySubscriptYSize;
593
597
  this.metrics.superscriptSizeFactor = headTable.unitsPerEm / os2Table.ySuperscriptYSize;
594
598
  };
@@ -1107,6 +1111,15 @@ var TtfReader = /** @class */ (function () {
1107
1111
  var fontProgram = this.getFontProgram(newLocaUpdated, newGlyphTable, glyphTableSize, newLocaSize);
1108
1112
  return fontProgram;
1109
1113
  };
1114
+ TtfReader.prototype._readCompactFontFormatTable = function () {
1115
+ var tableInfo = this.getTable('CFF ');
1116
+ var length = tableInfo.length;
1117
+ var offset = tableInfo.offset;
1118
+ var cffData = new Array(length);
1119
+ this.setOffset(offset);
1120
+ var result = this.read(cffData, 0, length);
1121
+ return result.buffer;
1122
+ };
1110
1123
  /**
1111
1124
  * Reconverts string to be in proper format saved into PDF file.
1112
1125
  */
@@ -193,7 +193,12 @@ var UnicodeTrueTypeFont = /** @class */ (function () {
193
193
  this.descendantFont.isResource = true;
194
194
  this.descendantFont.descendantFontBeginSave = new SaveDescendantFontEventHandler(this);
195
195
  this.descendantFont.items.setValue(this.dictionaryProperties.type, new PdfName(this.dictionaryProperties.font));
196
- this.descendantFont.items.setValue(this.dictionaryProperties.subtype, new PdfName(this.dictionaryProperties.cIDFontType2));
196
+ if (this.ttfReader && this.ttfReader._isOpenTypeFont) {
197
+ this.descendantFont.items.setValue(this.dictionaryProperties.subtype, new PdfName(this.dictionaryProperties.cIDFontType0));
198
+ }
199
+ else {
200
+ this.descendantFont.items.setValue(this.dictionaryProperties.subtype, new PdfName(this.dictionaryProperties.cIDFontType2));
201
+ }
197
202
  this.descendantFont.items.setValue(this.dictionaryProperties.baseFont, new PdfName(this.subsetName));
198
203
  this.descendantFont.items.setValue(this.dictionaryProperties.cIDToGIDMap, new PdfName(this.dictionaryProperties.identity));
199
204
  this.descendantFont.items.setValue(this.dictionaryProperties.dw, new PdfNumber(1000));
@@ -222,7 +227,13 @@ var UnicodeTrueTypeFont = /** @class */ (function () {
222
227
  descriptor.items.setValue(this.dictionaryProperties.descent, new PdfNumber(metrics.winDescent));
223
228
  descriptor.items.setValue(this.dictionaryProperties.leading, new PdfNumber(metrics.leading));
224
229
  descriptor.items.setValue(this.dictionaryProperties.avgWidth, new PdfNumber(metrics.widthTable[32]));
225
- descriptor.items.setValue(this.dictionaryProperties.fontFile2, new PdfReferenceHolder(this.fontProgram));
230
+ if (this.ttfReader.metrics.contains) {
231
+ descriptor.items.setValue(this.dictionaryProperties.fontFile3, new PdfReferenceHolder(this.fontProgram));
232
+ this.fontProgram.items.setValue(this.dictionaryProperties.subtype, new PdfName(this.dictionaryProperties.cIDFontType0C));
233
+ }
234
+ else {
235
+ descriptor.items.setValue(this.dictionaryProperties.fontFile2, new PdfReferenceHolder(this.fontProgram));
236
+ }
226
237
  descriptor.items.setValue(this.dictionaryProperties.maxWidth, new PdfNumber(metrics.widthTable[32]));
227
238
  descriptor.items.setValue(this.dictionaryProperties.xHeight, new PdfNumber(0));
228
239
  descriptor.items.setValue(this.dictionaryProperties.stemH, new PdfNumber(0));
@@ -418,13 +429,20 @@ var UnicodeTrueTypeFont = /** @class */ (function () {
418
429
  * Generates font program.
419
430
  */
420
431
  UnicodeTrueTypeFont.prototype.generateFontProgram = function () {
421
- var fontProgram = null;
422
432
  this.usedChars = (this.usedChars === null || this.usedChars === undefined) ? new Dictionary() : this.usedChars;
423
433
  this.ttfReader.setOffset(0);
424
- fontProgram = this.ttfReader.readFontProgram(this.usedChars);
425
- this.fontProgram.clearStream();
426
- this.fontProgram.isResource = true;
427
- this.fontProgram.writeBytes(fontProgram);
434
+ if (this.ttfReader.metrics.contains && this.ttfReader._isOpenTypeFont) {
435
+ var cffData = this.ttfReader._readCompactFontFormatTable();
436
+ this.fontProgram.clearStream();
437
+ this.fontProgram.isResource = true;
438
+ this.fontProgram.writeBytes(cffData);
439
+ }
440
+ else {
441
+ var fontProgram = this.ttfReader.readFontProgram(this.usedChars);
442
+ this.fontProgram.clearStream();
443
+ this.fontProgram.isResource = true;
444
+ this.fontProgram.writeBytes(fontProgram);
445
+ }
428
446
  };
429
447
  /**
430
448
  * Calculates flags for the font descriptor.
@@ -290,6 +290,11 @@ export declare class DictionaryProperties {
290
290
  * @private
291
291
  */
292
292
  readonly cIDToGIDMap: string;
293
+ /**
294
+ * Specifies the value of 'cIDFontType0C'.
295
+ * @private
296
+ */
297
+ readonly cIDFontType0C: string;
293
298
  /**
294
299
  * Specifies the value of 'identity'.
295
300
  * @private
@@ -310,6 +315,11 @@ export declare class DictionaryProperties {
310
315
  * @private
311
316
  */
312
317
  readonly cIDSystemInfo: string;
318
+ /**
319
+ * Specifies the value of 'CIDFontType0'.
320
+ * @private
321
+ */
322
+ readonly cIDFontType0: string;
313
323
  /**
314
324
  * Specifies the value of 'fontName'.
315
325
  * @private
@@ -370,6 +380,11 @@ export declare class DictionaryProperties {
370
380
  * @private
371
381
  */
372
382
  readonly fontFile2: string;
383
+ /**
384
+ * Specifies the value of 'fontFile3'.
385
+ * @private
386
+ */
387
+ readonly fontFile3: string;
373
388
  /**
374
389
  * Specifies the value of 'maxWidth'.
375
390
  * @private
@@ -295,6 +295,11 @@ var DictionaryProperties = /** @class */ (function () {
295
295
  * @private
296
296
  */
297
297
  this.cIDToGIDMap = 'CIDToGIDMap';
298
+ /**
299
+ * Specifies the value of 'cIDFontType0C'.
300
+ * @private
301
+ */
302
+ this.cIDFontType0C = 'CIDFontType0C';
298
303
  /**
299
304
  * Specifies the value of 'identity'.
300
305
  * @private
@@ -315,6 +320,11 @@ var DictionaryProperties = /** @class */ (function () {
315
320
  * @private
316
321
  */
317
322
  this.cIDSystemInfo = 'CIDSystemInfo';
323
+ /**
324
+ * Specifies the value of 'CIDFontType0'.
325
+ * @private
326
+ */
327
+ this.cIDFontType0 = 'CIDFontType0';
318
328
  /**
319
329
  * Specifies the value of 'fontName'.
320
330
  * @private
@@ -375,6 +385,11 @@ var DictionaryProperties = /** @class */ (function () {
375
385
  * @private
376
386
  */
377
387
  this.fontFile2 = 'FontFile2';
388
+ /**
389
+ * Specifies the value of 'fontFile3'.
390
+ * @private
391
+ */
392
+ this.fontFile3 = 'FontFile3';
378
393
  /**
379
394
  * Specifies the value of 'maxWidth'.
380
395
  * @private