survey-pdf 2.5.0 → 2.5.1

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,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS PDF library v2.5.0
2
+ * surveyjs - SurveyJS PDF library v2.5.1
3
3
  * Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: SEE LICENSE IN LICENSE
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS PDF library v2.5.0
2
+ * surveyjs - SurveyJS PDF library v2.5.1
3
3
  * Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: SEE LICENSE IN LICENSE
5
5
  */
@@ -1558,7 +1558,7 @@ __webpack_require__.r(__webpack_exports__);
1558
1558
 
1559
1559
 
1560
1560
 
1561
- (0,survey_core__WEBPACK_IMPORTED_MODULE_50__.checkLibraryVersion)("".concat("2.5.0"), 'survey-pdf');
1561
+ (0,survey_core__WEBPACK_IMPORTED_MODULE_50__.checkLibraryVersion)("".concat("2.5.1"), 'survey-pdf');
1562
1562
 
1563
1563
 
1564
1564
  /***/ }),
@@ -6083,7 +6083,7 @@ var SurveyHelper = /** @class */ (function () {
6083
6083
  case 2:
6084
6084
  imageInfo = _a.sent();
6085
6085
  _a.label = 3;
6086
- case 3: return [2 /*return*/, new _pdf_render_pdf_image__WEBPACK_IMPORTED_MODULE_11__.ImageBrick(question, controller, imageInfo.imageData, point, options.width, options.height, imageInfo.width, imageInfo.height, imageInfo.imageId)];
6086
+ case 3: return [2 /*return*/, new _pdf_render_pdf_image__WEBPACK_IMPORTED_MODULE_11__.ImageBrick(question, controller, imageInfo.data, point, options.width, options.height, imageInfo.width, imageInfo.height, imageInfo.id)];
6087
6087
  }
6088
6088
  });
6089
6089
  });
@@ -6364,8 +6364,8 @@ var SurveyHelper = /** @class */ (function () {
6364
6364
  }
6365
6365
  }
6366
6366
  else if (imageSize && imageSize.height && imageSize.width) {
6367
- heightPt = SurveyHelper.parseWidth(imageSize.height.toString(), SurveyHelper.getPageAvailableWidth(controller), 1, 'px');
6368
- widthPt = SurveyHelper.parseWidth(imageSize.width.toString(), SurveyHelper.getPageAvailableWidth(controller), 1, 'px');
6367
+ heightPt = Math.min(imageSize.height, SurveyHelper.getPageAvailableWidth(controller));
6368
+ widthPt = Math.min(imageSize.width, SurveyHelper.getPageAvailableWidth(controller));
6369
6369
  }
6370
6370
  _a.label = 2;
6371
6371
  case 2: return [2 /*return*/, { width: widthPt || defaultWidthPt || 0, height: heightPt || defaultHeightPt || 0 }];
@@ -6408,7 +6408,6 @@ var SurveyHelper = /** @class */ (function () {
6408
6408
  SurveyHelper.TITLE_LOCATION_MATRIX = 'matrix';
6409
6409
  SurveyHelper.STANDARD_FONT = 'helvetica';
6410
6410
  SurveyHelper.CUSTOM_FONT_ENCODING = 'Identity-H';
6411
- SurveyHelper.inBrowser = typeof Image === 'function';
6412
6411
  return SurveyHelper;
6413
6412
  }());
6414
6413
 
@@ -12630,7 +12629,7 @@ var BaseImageUtils = /** @class */ (function () {
12630
12629
  BaseImageUtils.prototype._getImageInfo = function (url) {
12631
12630
  return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () {
12632
12631
  return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) {
12633
- return [2 /*return*/, { imageData: url, width: 0, height: 0, imageId: this.getImageId() }];
12632
+ return [2 /*return*/, { data: url, width: 0, height: 0, id: this.getImageId() }];
12634
12633
  });
12635
12634
  });
12636
12635
  };
@@ -12664,11 +12663,11 @@ var BaseImageUtils = /** @class */ (function () {
12664
12663
  var scale;
12665
12664
  return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) {
12666
12665
  if (imageFit == 'fill') {
12667
- return [2 /*return*/, { imageData: imageInfo.imageData, imageId: imageInfo.imageId, width: targetWidth, height: targetHeight }];
12666
+ return [2 /*return*/, { data: imageInfo.data, id: imageInfo.id, width: targetWidth, height: targetHeight }];
12668
12667
  }
12669
12668
  if ((imageFit == 'contain' || imageFit == 'cover') && !!imageInfo.width && !!imageInfo.height && !!targetWidth && !!targetWidth) {
12670
12669
  scale = Math.min(targetWidth / imageInfo.width, targetHeight / imageInfo.height);
12671
- return [2 /*return*/, { imageData: imageInfo.imageData, imageId: imageInfo.imageId, width: imageInfo.width * scale, height: imageInfo.height * scale }];
12670
+ return [2 /*return*/, { data: imageInfo.data, id: imageInfo.id, width: imageInfo.width * scale, height: imageInfo.height * scale }];
12672
12671
  }
12673
12672
  else {
12674
12673
  return [2 /*return*/, imageInfo];
@@ -12679,7 +12678,7 @@ var BaseImageUtils = /** @class */ (function () {
12679
12678
  };
12680
12679
  Object.defineProperty(BaseImageUtils.prototype, "emptyImage", {
12681
12680
  get: function () {
12682
- return { imageData: '', width: 0, height: 0, imageId: 'image_0' };
12681
+ return { data: '', width: 0, height: 0, id: 'image_0' };
12683
12682
  },
12684
12683
  enumerable: false,
12685
12684
  configurable: true
@@ -12730,19 +12729,25 @@ var ImageUtils = /** @class */ (function (_super) {
12730
12729
  }
12731
12730
  ImageUtils.prototype._getImageInfo = function (url) {
12732
12731
  return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () {
12733
- var res, pxToPt, imageData, _a, size;
12732
+ var pxToPt, data, res, _a, size;
12734
12733
  return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_b) {
12735
12734
  switch (_b.label) {
12736
- case 0: return [4 /*yield*/, node_fetch__WEBPACK_IMPORTED_MODULE_2___default()(url)];
12737
- case 1:
12738
- res = _b.sent();
12735
+ case 0:
12739
12736
  pxToPt = 72.0 / 96.0;
12737
+ if (!(typeof url === 'string' && url.startsWith('data:'))) return [3 /*break*/, 1];
12738
+ data = Buffer.from(url.split(',')[1] || '', 'base64');
12739
+ return [3 /*break*/, 4];
12740
+ case 1: return [4 /*yield*/, node_fetch__WEBPACK_IMPORTED_MODULE_2___default()(url)];
12741
+ case 2:
12742
+ res = _b.sent();
12740
12743
  _a = Uint8Array.bind;
12741
12744
  return [4 /*yield*/, res.arrayBuffer()];
12742
- case 2:
12743
- imageData = new (_a.apply(Uint8Array, [void 0, _b.sent()]))();
12744
- size = (0,image_size__WEBPACK_IMPORTED_MODULE_3__.imageSize)(imageData);
12745
- return [2 /*return*/, { imageData: imageData, width: size.width * pxToPt, height: size.height * pxToPt, imageId: this.getImageId() }];
12745
+ case 3:
12746
+ data = new (_a.apply(Uint8Array, [void 0, _b.sent()]))();
12747
+ _b.label = 4;
12748
+ case 4:
12749
+ size = (0,image_size__WEBPACK_IMPORTED_MODULE_3__.imageSize)(data);
12750
+ return [2 /*return*/, { data: data, width: size.width * pxToPt, height: size.height * pxToPt, id: this.getImageId() }];
12746
12751
  }
12747
12752
  });
12748
12753
  });