pdfmake 0.2.11 → 0.2.12

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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.12 - 2024-08-14
4
+
5
+ - Fixed error message of bad image definition
6
+
3
7
  ## 0.2.11 - 2024-08-09
4
8
 
5
9
  - Fixed and validates input values headerRows and keepWithHeaderRows
package/build/pdfmake.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! pdfmake v0.2.11, @license MIT, @link http://pdfmake.org */
1
+ /*! pdfmake v0.2.12, @license MIT, @link http://pdfmake.org */
2
2
  (function webpackUniversalModuleDefinition(root, factory) {
3
3
  if(typeof exports === 'object' && typeof module === 'object')
4
4
  module.exports = factory();
@@ -15135,7 +15135,7 @@ if ( true && module && typeof module.exports !== 'undefined') {
15135
15135
 
15136
15136
  /***/ }),
15137
15137
 
15138
- /***/ 21408:
15138
+ /***/ 82759:
15139
15139
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
15140
15140
 
15141
15141
  "use strict";
@@ -54429,7 +54429,7 @@ module.exports = URLBrowserResolver;
54429
54429
  var isFunction = (__webpack_require__(91867).isFunction);
54430
54430
  var isUndefined = (__webpack_require__(91867).isUndefined);
54431
54431
  var isNull = (__webpack_require__(91867).isNull);
54432
- var FileSaver = __webpack_require__(12615);
54432
+ var FileSaver = __webpack_require__(42616);
54433
54433
  var saveAs = FileSaver.saveAs;
54434
54434
 
54435
54435
  var defaultClientFonts = {
@@ -56940,57 +56940,61 @@ module.exports = {
56940
56940
 
56941
56941
  "use strict";
56942
56942
  /* provided dependency */ var Buffer = __webpack_require__(50621)["Buffer"];
56943
-
56944
-
56945
- var fs = __webpack_require__(48181);
56946
-
56947
- function ImageMeasure(pdfKitDoc, imageDictionary) {
56948
- this.pdfKitDoc = pdfKitDoc;
56949
- this.imageDictionary = imageDictionary || {};
56950
- }
56951
-
56952
- ImageMeasure.prototype.measureImage = function (src) {
56953
- var image;
56954
- var that = this;
56955
-
56956
- if (!this.pdfKitDoc._imageRegistry[src]) {
56957
- try {
56958
- image = this.pdfKitDoc.openImage(realImageSrc(src));
56959
- if (!image) {
56960
- throw 'No image';
56961
- }
56962
- } catch (error) {
56963
- throw 'Invalid image: ' + error.toString() + '\nImages dictionary should contain dataURL entries (or local file paths in node.js)';
56964
- }
56965
- image.embed(this.pdfKitDoc);
56966
- this.pdfKitDoc._imageRegistry[src] = image;
56967
- } else {
56968
- image = this.pdfKitDoc._imageRegistry[src];
56969
- }
56970
-
56971
- return { width: image.width, height: image.height };
56972
-
56973
- function realImageSrc(src) {
56974
- var img = that.imageDictionary[src];
56975
-
56976
- if (!img) {
56977
- return src;
56978
- }
56979
-
56980
- if (fs.existsSync(img)) {
56981
- return fs.readFileSync(img);
56982
- }
56983
-
56984
- var index = img.indexOf('base64,');
56985
- if (index < 0) {
56986
- return that.imageDictionary[src];
56987
- }
56988
-
56989
- return Buffer.from(img.substring(index + 7), 'base64');
56990
- }
56991
- };
56992
-
56993
- module.exports = ImageMeasure;
56943
+
56944
+
56945
+ var fs = __webpack_require__(48181);
56946
+
56947
+ function ImageMeasure(pdfKitDoc, imageDictionary) {
56948
+ this.pdfKitDoc = pdfKitDoc;
56949
+ this.imageDictionary = imageDictionary || {};
56950
+ }
56951
+
56952
+ ImageMeasure.prototype.measureImage = function (src) {
56953
+ var image;
56954
+ var that = this;
56955
+
56956
+ if (!this.pdfKitDoc._imageRegistry[src]) {
56957
+ try {
56958
+ image = this.pdfKitDoc.openImage(realImageSrc(src));
56959
+ if (!image) {
56960
+ throw 'No image';
56961
+ }
56962
+ } catch (error) {
56963
+ throw 'Invalid image: ' + error.toString() + '\nImages dictionary should contain dataURL entries (or local file paths in node.js)';
56964
+ }
56965
+ image.embed(this.pdfKitDoc);
56966
+ this.pdfKitDoc._imageRegistry[src] = image;
56967
+ } else {
56968
+ image = this.pdfKitDoc._imageRegistry[src];
56969
+ }
56970
+
56971
+ return { width: image.width, height: image.height };
56972
+
56973
+ function realImageSrc(src) {
56974
+ var img = that.imageDictionary[src];
56975
+
56976
+ if (!img) {
56977
+ return src;
56978
+ }
56979
+
56980
+ if (typeof img === 'object') {
56981
+ throw 'Not supported image definition: ' + JSON.stringify(img);
56982
+ }
56983
+
56984
+ if (fs.existsSync(img)) {
56985
+ return fs.readFileSync(img);
56986
+ }
56987
+
56988
+ var index = img.indexOf('base64,');
56989
+ if (index < 0) {
56990
+ return that.imageDictionary[src];
56991
+ }
56992
+
56993
+ return Buffer.from(img.substring(index + 7), 'base64');
56994
+ }
56995
+ };
56996
+
56997
+ module.exports = ImageMeasure;
56994
56998
 
56995
56999
 
56996
57000
  /***/ }),
@@ -58151,7 +58155,7 @@ function _interopDefault(ex) {
58151
58155
  return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex;
58152
58156
  }
58153
58157
 
58154
- var PdfKit = _interopDefault(__webpack_require__(21408));
58158
+ var PdfKit = _interopDefault(__webpack_require__(82759));
58155
58159
 
58156
58160
  function getEngineInstance() {
58157
58161
  return PdfKit;
@@ -61163,7 +61167,7 @@ module.exports = TraversalTracker;
61163
61167
 
61164
61168
  /***/ }),
61165
61169
 
61166
- /***/ 12615:
61170
+ /***/ 42616:
61167
61171
  /***/ (function(module, exports, __webpack_require__) {
61168
61172
 
61169
61173
  var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function(a,b){if(true)!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (b),