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 +4 -0
- package/build/pdfmake.js +60 -56
- package/build/pdfmake.js.map +1 -1
- package/build/pdfmake.min.js +2 -2
- package/build/pdfmake.min.js.map +1 -1
- package/package.json +1 -1
- package/src/imageMeasure.js +55 -51
package/CHANGELOG.md
CHANGED
package/build/pdfmake.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! pdfmake v0.2.
|
|
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
|
-
/***/
|
|
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__(
|
|
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 (
|
|
56981
|
-
|
|
56982
|
-
}
|
|
56983
|
-
|
|
56984
|
-
|
|
56985
|
-
|
|
56986
|
-
|
|
56987
|
-
|
|
56988
|
-
|
|
56989
|
-
|
|
56990
|
-
|
|
56991
|
-
}
|
|
56992
|
-
|
|
56993
|
-
|
|
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__(
|
|
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
|
-
/***/
|
|
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),
|