survey-pdf 2.0.6 → 2.0.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "survey-pdf",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "description": "survey.pdf.js is a SurveyJS PDF Library. It is a easy way to export SurveyJS surveys to PDF. It uses JSON for survey metadata.",
5
5
  "keywords": [
6
6
  "Survey",
@@ -19,7 +19,7 @@
19
19
  },
20
20
  "typings": "./typings/entries/pdf.d.ts",
21
21
  "peerDependencies": {
22
- "survey-core": "2.0.6"
22
+ "survey-core": "2.0.7"
23
23
  },
24
24
  "dependencies": {
25
25
  "jspdf": "^2.3.0 || ^3"
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS PDF library v2.0.6
2
+ * surveyjs - SurveyJS PDF library v2.0.7
3
3
  * Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS PDF library v2.0.6
2
+ * surveyjs - SurveyJS PDF library v2.0.7
3
3
  * Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
5
  */
package/survey.pdf.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS PDF library v2.0.6
2
+ * surveyjs - SurveyJS PDF library v2.0.7
3
3
  * Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
5
  */
@@ -1553,7 +1553,7 @@ __webpack_require__.r(__webpack_exports__);
1553
1553
 
1554
1554
 
1555
1555
 
1556
- (0,survey_core__WEBPACK_IMPORTED_MODULE_51__.checkLibraryVersion)("".concat("2.0.6"), 'survey-pdf');
1556
+ (0,survey_core__WEBPACK_IMPORTED_MODULE_51__.checkLibraryVersion)("".concat("2.0.7"), 'survey-pdf');
1557
1557
 
1558
1558
 
1559
1559
  /***/ }),
@@ -2414,8 +2414,8 @@ var FlatFile = /** @class */ (function (_super) {
2414
2414
  });
2415
2415
  });
2416
2416
  };
2417
- FlatFile.prototype.addLine = function (rowsFlats, currPoint, index) {
2418
- if (index !== this.question.previewValue.length - 1) {
2417
+ FlatFile.prototype.addLine = function (rowsFlats, currPoint, index, previewValue) {
2418
+ if (index !== previewValue.length - 1) {
2419
2419
  rowsFlats[rowsFlats.length - 1].addBrick(_helper_survey__WEBPACK_IMPORTED_MODULE_5__.SurveyHelper.createRowlineFlat(currPoint, this.controller));
2420
2420
  currPoint.yTop += _helper_survey__WEBPACK_IMPORTED_MODULE_5__.SurveyHelper.EPSILON;
2421
2421
  rowsFlats.push(new _pdf_render_pdf_composite__WEBPACK_IMPORTED_MODULE_4__.CompositeBrick());
@@ -2430,11 +2430,12 @@ var FlatFile = /** @class */ (function (_super) {
2430
2430
  };
2431
2431
  FlatFile.prototype.generateFlatsContent = function (point) {
2432
2432
  return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () {
2433
- var rowsFlats, currPoint, yBot, i, item, canPreviewImage, _a, availableWidth, compositeWidth, itemFlat, itemFlat;
2433
+ var previewValue, rowsFlats, currPoint, yBot, i, item, canPreviewImage, _a, availableWidth, compositeWidth, itemFlat, itemFlat;
2434
2434
  return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_b) {
2435
2435
  switch (_b.label) {
2436
2436
  case 0:
2437
- if (!(this.question.previewValue.length === 0)) return [3 /*break*/, 2];
2437
+ previewValue = this.question.showPreview ? this.question.previewValue : this.question.value;
2438
+ if (!(!previewValue || previewValue.length === 0)) return [3 /*break*/, 2];
2438
2439
  return [4 /*yield*/, _helper_survey__WEBPACK_IMPORTED_MODULE_5__.SurveyHelper.createTextFlat(point, this.question, this.controller, this.question.noFileChosenCaption, _pdf_render_pdf_text__WEBPACK_IMPORTED_MODULE_3__.TextBrick)];
2439
2440
  case 1: return [2 /*return*/, [_b.sent()]];
2440
2441
  case 2:
@@ -2444,12 +2445,12 @@ var FlatFile = /** @class */ (function (_super) {
2444
2445
  i = 0;
2445
2446
  _b.label = 3;
2446
2447
  case 3:
2447
- if (!(i < this.question.previewValue.length)) return [3 /*break*/, 12];
2448
- item = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, this.question.previewValue[i]);
2448
+ if (!(i < previewValue.length)) return [3 /*break*/, 12];
2449
+ item = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, previewValue[i]);
2449
2450
  canPreviewImage = _helper_survey__WEBPACK_IMPORTED_MODULE_5__.SurveyHelper.canPreviewImage(this.question, item, item.content);
2450
2451
  if (!canPreviewImage) return [3 /*break*/, 5];
2451
2452
  _a = item;
2452
- return [4 /*yield*/, _helper_survey__WEBPACK_IMPORTED_MODULE_5__.SurveyHelper.getCorrectedImageSize(this.controller, { imageWidth: this.question.imageWidth, imageHeight: this.question.imageHeight, imageLink: this.question.previewValue[i].content, defaultImageWidth: 200, defaultImageHeight: 150 })];
2453
+ return [4 /*yield*/, _helper_survey__WEBPACK_IMPORTED_MODULE_5__.SurveyHelper.getCorrectedImageSize(this.controller, { imageWidth: this.question.imageWidth, imageHeight: this.question.imageHeight, imageLink: previewValue[i].content, defaultImageWidth: 200, defaultImageHeight: 150 })];
2453
2454
  case 4:
2454
2455
  _a.imageSize = _b.sent();
2455
2456
  _b.label = 5;
@@ -2463,7 +2464,7 @@ var FlatFile = /** @class */ (function (_super) {
2463
2464
  if (availableWidth < compositeWidth) {
2464
2465
  currPoint.xLeft = point.xLeft;
2465
2466
  currPoint.yTop = yBot;
2466
- this.addLine(rowsFlats, currPoint, i);
2467
+ this.addLine(rowsFlats, currPoint, i, previewValue);
2467
2468
  }
2468
2469
  this.controller.pushMargins(currPoint.xLeft, this.controller.paperWidth - currPoint.xLeft - compositeWidth);
2469
2470
  return [4 /*yield*/, this.generateFlatItem(currPoint, item)];
@@ -2478,7 +2479,7 @@ var FlatFile = /** @class */ (function (_super) {
2478
2479
  if (availableWidth < this.controller.unitWidth) {
2479
2480
  currPoint.xLeft = point.xLeft;
2480
2481
  currPoint.yTop = yBot;
2481
- this.addLine(rowsFlats, currPoint, i);
2482
+ this.addLine(rowsFlats, currPoint, i, previewValue);
2482
2483
  }
2483
2484
  return [4 /*yield*/, this.generateFlatItem(currPoint, item)];
2484
2485
  case 9: