survey-pdf 3.0.0-beta.6 → 3.0.0-beta.8
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/README.md +3 -3
- package/fesm/layouts/index.mjs +1 -1
- package/fesm/pdf-form-filler-shared.mjs +1 -1
- package/fesm/pdf-form-filler.mjs +1 -1
- package/fesm/pdf-form-filler.node.mjs +1 -1
- package/fesm/pdf-shared.mjs +56 -20
- package/fesm/pdf-shared.mjs.map +1 -1
- package/fesm/survey.pdf.fonts.mjs +1 -1
- package/fesm/survey.pdf.mjs +3 -3
- package/fesm/survey.pdf.node.mjs +3 -3
- package/layouts/compact.js +1 -1
- package/layouts/compact.min.js.LICENSE.txt +1 -1
- package/layouts/index.js +1 -1
- package/layouts/index.min.js.LICENSE.txt +1 -1
- package/layouts/spacious.js +1 -1
- package/layouts/spacious.min.js.LICENSE.txt +1 -1
- package/package.json +3 -2
- package/pdf-form-filler.js +1 -1
- package/pdf-form-filler.min.js.LICENSE.txt +1 -1
- package/pdf-form-filler.node.js +1 -1
- package/pdf-form-filler.node.min.js.LICENSE.txt +1 -1
- package/survey.pdf.fonts.js +1 -1
- package/survey.pdf.fonts.min.js.LICENSE.txt +1 -1
- package/survey.pdf.js +63 -20
- package/survey.pdf.js.map +1 -1
- package/survey.pdf.min.js +13 -13
- package/survey.pdf.min.js.LICENSE.txt +1 -1
- package/survey.pdf.node.js +63 -20
- package/survey.pdf.node.js.map +1 -1
- package/survey.pdf.node.min.js +13 -13
- package/survey.pdf.node.min.js.LICENSE.txt +1 -1
- package/typings/doc_controller.d.ts +5 -0
- package/typings/entries/pdf-base.d.ts +1 -0
- package/typings/flat_layout/flat_checkbox.d.ts +1 -0
- package/typings/flat_layout/flat_page.d.ts +1 -0
- package/typings/flat_layout/flat_panel.d.ts +1 -0
- package/typings/style/types.d.ts +28 -24
- package/typings/survey.d.ts +7 -5
package/README.md
CHANGED
|
@@ -26,8 +26,8 @@ SurveyJS PDF Generator allows you to save an unlimited number of custom-built su
|
|
|
26
26
|
- Support for headers and footers both on a page and an entire survey level
|
|
27
27
|
- An API to download a fillable survey form as a document file in a traditional PDF format
|
|
28
28
|
- PDF Form conversion to Blob, Base64 URL, or Raw PDF
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
<br>
|
|
30
|
+
<img width="750" height="474" alt="5-health-insurance-1(use as main)" src="https://github.com/user-attachments/assets/71451f5c-ea50-4da6-87a5-b4d478bb50b8" />
|
|
31
31
|
|
|
32
32
|
## Get Started
|
|
33
33
|
|
|
@@ -41,7 +41,7 @@ SurveyJS PDF Generator allows you to save an unlimited number of custom-built su
|
|
|
41
41
|
- [Website](https://surveyjs.io/)
|
|
42
42
|
- [Documentation](https://surveyjs.io/pdf-generator/documentation/overview)
|
|
43
43
|
- [Live Examples](https://surveyjs.io/pdf-generator/examples/)
|
|
44
|
-
- [What's New](https://surveyjs.io/
|
|
44
|
+
- [What's New](https://surveyjs.io/WhatsNew)
|
|
45
45
|
|
|
46
46
|
## Build SurveyJS PDF Generator from Sources
|
|
47
47
|
|
package/fesm/layouts/index.mjs
CHANGED
package/fesm/pdf-form-filler.mjs
CHANGED
package/fesm/pdf-shared.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* surveyjs - SurveyJS PDF library v3.0.0-beta.
|
|
2
|
+
* surveyjs - SurveyJS PDF library v3.0.0-beta.8
|
|
3
3
|
* Copyright (c) 2015-2026 Devsoft Baltic OÜ - http://surveyjs.io/
|
|
4
4
|
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
|
|
5
5
|
*/
|
|
@@ -3402,7 +3402,8 @@ function getPatchedAcroFormComboBox(doc) {
|
|
|
3402
3402
|
|
|
3403
3403
|
if (formObject.isUnicode) {
|
|
3404
3404
|
var fontList = {};
|
|
3405
|
-
|
|
3405
|
+
const font = scope.internal.getFont(formObject.fontName, formObject.fontStyle);
|
|
3406
|
+
fontList[font.id] = font;
|
|
3406
3407
|
var payload = {
|
|
3407
3408
|
text: line,
|
|
3408
3409
|
x: null,
|
|
@@ -3412,7 +3413,7 @@ function getPatchedAcroFormComboBox(doc) {
|
|
|
3412
3413
|
},
|
|
3413
3414
|
mutex: {
|
|
3414
3415
|
pdfEscape: pdfEscape,
|
|
3415
|
-
activeFontKey:
|
|
3416
|
+
activeFontKey: font.id,
|
|
3416
3417
|
fonts: fontList,
|
|
3417
3418
|
activeFontSize: formObject.fontSize
|
|
3418
3419
|
}
|
|
@@ -4378,6 +4379,9 @@ function getPatchedAcroFormComboBox(doc) {
|
|
|
4378
4379
|
enumerable: true,
|
|
4379
4380
|
configurable: true,
|
|
4380
4381
|
get: function () {
|
|
4382
|
+
if (this.isUnicode) {
|
|
4383
|
+
return _V;
|
|
4384
|
+
}
|
|
4381
4385
|
if ((this instanceof AcroFormButton === true)) {
|
|
4382
4386
|
return pdfUnescape(_V.substr(1, _V.length - 1));
|
|
4383
4387
|
} else {
|
|
@@ -4386,10 +4390,16 @@ function getPatchedAcroFormComboBox(doc) {
|
|
|
4386
4390
|
},
|
|
4387
4391
|
set: function (value) {
|
|
4388
4392
|
value = value.toString();
|
|
4389
|
-
if (
|
|
4390
|
-
_V =
|
|
4393
|
+
if (this.isUnicode) {
|
|
4394
|
+
_V = toUnicode(value);
|
|
4395
|
+
this.trueValue = value;
|
|
4391
4396
|
} else {
|
|
4392
|
-
|
|
4397
|
+
if ((this instanceof AcroFormButton === true)) {
|
|
4398
|
+
_V = '/' + value;
|
|
4399
|
+
} else {
|
|
4400
|
+
_V = value;
|
|
4401
|
+
}
|
|
4402
|
+
|
|
4393
4403
|
}
|
|
4394
4404
|
}
|
|
4395
4405
|
});
|
|
@@ -7462,7 +7472,7 @@ class DocController extends DocOptions {
|
|
|
7462
7472
|
setPage(index) {
|
|
7463
7473
|
this.doc.setPage(index + 1);
|
|
7464
7474
|
}
|
|
7465
|
-
setColor(value, getOldColor, setColorFunc) {
|
|
7475
|
+
setColor(value, getOldColor, setColorFunc, gOpacityOption = 'opacity') {
|
|
7466
7476
|
const { doc } = this;
|
|
7467
7477
|
const oldColor = getOldColor();
|
|
7468
7478
|
const { color, opacity } = SurveyHelper.parseColor(value);
|
|
@@ -7470,7 +7480,7 @@ class DocController extends DocOptions {
|
|
|
7470
7480
|
let needRestoreGraphicsState = false;
|
|
7471
7481
|
if (opacity !== undefined) {
|
|
7472
7482
|
doc.saveGraphicsState();
|
|
7473
|
-
doc.setGState(new doc.GState({ opacity }));
|
|
7483
|
+
doc.setGState(new doc.GState({ [gOpacityOption]: opacity }));
|
|
7474
7484
|
needRestoreGraphicsState = true;
|
|
7475
7485
|
}
|
|
7476
7486
|
return () => {
|
|
@@ -7481,7 +7491,7 @@ class DocController extends DocOptions {
|
|
|
7481
7491
|
};
|
|
7482
7492
|
}
|
|
7483
7493
|
setDrawColor(color) {
|
|
7484
|
-
this.drawColorRestoreCallbacks.push(this.setColor(color, () => this.doc.getDrawColor(), (val) => this.doc.setDrawColor(val)));
|
|
7494
|
+
this.drawColorRestoreCallbacks.push(this.setColor(color, () => this.doc.getDrawColor(), (val) => this.doc.setDrawColor(val), 'stroke-opacity'));
|
|
7485
7495
|
}
|
|
7486
7496
|
restoreDrawColor() {
|
|
7487
7497
|
if (this.drawColorRestoreCallbacks.length > 0) {
|
|
@@ -7878,6 +7888,7 @@ function getDefaultStyle(theme, layout) {
|
|
|
7878
7888
|
},
|
|
7879
7889
|
spacing: {
|
|
7880
7890
|
titleDescriptionGap: getSizeVariable('--sjs2-pdf-layout-title-large-gap'),
|
|
7891
|
+
pageGap: baseSpace * 3, //todo: need variable
|
|
7881
7892
|
headerContentGap: getSizeVariable('--sjs2-pdf-layout-page-gap-vertical') + getSizeVariable('--sjs2-pdf-layout-title-large-padding-bottom'),
|
|
7882
7893
|
},
|
|
7883
7894
|
backgroundColor: getColorVariable('--sjs2-color-utility-body'),
|
|
@@ -8095,6 +8106,7 @@ function getDefaultStyle(theme, layout) {
|
|
|
8095
8106
|
}
|
|
8096
8107
|
},
|
|
8097
8108
|
matrix: {
|
|
8109
|
+
columnMinWidth: baseSize * 12,
|
|
8098
8110
|
listChoiceText: {
|
|
8099
8111
|
fontColor: getColorVariable('--sjs2-color-fg-basic-primary'),
|
|
8100
8112
|
fontSize: getSizeVariable('--sjs2-typography-font-size-default'),
|
|
@@ -8889,7 +8901,7 @@ class SurveyPDF extends SurveyModel {
|
|
|
8889
8901
|
*
|
|
8890
8902
|
* To apply a new visual style to the PDF document, call the [`applyStyle`](https://surveyjs.io/pdf-generator/documentation/api-reference/surveypdf#applyStyle) method.
|
|
8891
8903
|
*
|
|
8892
|
-
* [
|
|
8904
|
+
* [PDF Appearance Customization - Styles Config](/pdf-generator/documentation/pdf-appearance-customization#styles-config (linkStyle))
|
|
8893
8905
|
*/
|
|
8894
8906
|
get style() {
|
|
8895
8907
|
if (!this.styleValue) {
|
|
@@ -8906,7 +8918,7 @@ class SurveyPDF extends SurveyModel {
|
|
|
8906
8918
|
*
|
|
8907
8919
|
* This method accepts either an [`IDocStyle`](https://surveyjs.io/pdf-generator/documentation/api-reference/IDocStyle) object that overrides properties in the default visual style, or a callback function that returns such an object. When a callback is used, it receives helper functions—`getSizeVariable(name)` and `getColorVariable(name)`—which allow you to derive dimensions and colors from the currently applied UI theme.
|
|
8908
8920
|
*
|
|
8909
|
-
* [
|
|
8921
|
+
* [PDF Appearance Customization - Styles Config](/pdf-generator/documentation/pdf-appearance-customization#styles-config (linkStyle))
|
|
8910
8922
|
* @param value An [`IDocStyle`](https://surveyjs.io/pdf-generator/documentation/api-reference/IDocStyle) object, or a callback function that returns an `IDocStyle` object.
|
|
8911
8923
|
*/
|
|
8912
8924
|
applyStyle(value) {
|
|
@@ -8916,6 +8928,7 @@ class SurveyPDF extends SurveyModel {
|
|
|
8916
8928
|
else {
|
|
8917
8929
|
this.styleValue = SurveyHelper.mergeObjects({}, this.style, value);
|
|
8918
8930
|
}
|
|
8931
|
+
this.stylesHash = {};
|
|
8919
8932
|
}
|
|
8920
8933
|
get theme() {
|
|
8921
8934
|
return this._theme || BaseTheme;
|
|
@@ -8924,10 +8937,11 @@ class SurveyPDF extends SurveyModel {
|
|
|
8924
8937
|
* Applies a UI theme to the exported PDF document.
|
|
8925
8938
|
*
|
|
8926
8939
|
* A theme defines color- and shadow-related CSS variables. To configure spacing, sizing, typography, and other non-color variables, use the [`applyLayout`](#applyLayout) method.
|
|
8927
|
-
* @param theme An [`ITheme`](https://surveyjs.io/form-library/documentation/api-reference/itheme) object.
|
|
8940
|
+
* @param theme An [`ITheme`](https://surveyjs.io/form-library/documentation/api-reference/itheme) object with theme settings.
|
|
8941
|
+
* @param baseTheme An optional `ITheme` object used as the base theme. When specified, it is deep-merged with `theme`, and the merged result is applied.
|
|
8928
8942
|
*/
|
|
8929
|
-
applyTheme(theme) {
|
|
8930
|
-
this._theme = SurveyHelper.mergeObjects({}, BaseTheme, theme);
|
|
8943
|
+
applyTheme(theme, baseTheme) {
|
|
8944
|
+
this._theme = SurveyHelper.mergeObjects({}, BaseTheme, baseTheme !== null && baseTheme !== void 0 ? baseTheme : {}, theme);
|
|
8931
8945
|
this.clearStyles();
|
|
8932
8946
|
}
|
|
8933
8947
|
get defaultLayout() {
|
|
@@ -8944,9 +8958,10 @@ class SurveyPDF extends SurveyModel {
|
|
|
8944
8958
|
*
|
|
8945
8959
|
* A layout defines non-color CSS variables, including spacing, sizing, typography, border radius, and other dimensional variables. To configure colors and shadows, use the [`applyTheme`](#applyTheme) method.
|
|
8946
8960
|
* @param layout An `IDocLayout` object that specifies layout variables.
|
|
8961
|
+
* @param baseLayout An optional `IDocLayout` object used as the base layout. When specified, it is deep-merged with `layout`, and the merged result is applied.
|
|
8947
8962
|
*/
|
|
8948
|
-
applyLayout(layout) {
|
|
8949
|
-
this._layout = SurveyHelper.mergeObjects({}, this.defaultLayout, layout);
|
|
8963
|
+
applyLayout(layout, baseLayout) {
|
|
8964
|
+
this._layout = SurveyHelper.mergeObjects({}, this.defaultLayout, baseLayout !== null && baseLayout !== void 0 ? baseLayout : {}, layout);
|
|
8950
8965
|
this.clearStyles();
|
|
8951
8966
|
}
|
|
8952
8967
|
getItemStyle(question, item, style) {
|
|
@@ -9241,7 +9256,7 @@ class FlatPanel {
|
|
|
9241
9256
|
currentAvailableWidth = availableWidth - gapBetweenElements;
|
|
9242
9257
|
currentRow = [];
|
|
9243
9258
|
}
|
|
9244
|
-
currentAvailableWidth -= width
|
|
9259
|
+
currentAvailableWidth -= width + gapBetweenElements;
|
|
9245
9260
|
currentRow.push({ element: el, width: width });
|
|
9246
9261
|
});
|
|
9247
9262
|
if (currentRow.length != 0) {
|
|
@@ -9272,6 +9287,9 @@ class FlatPanel {
|
|
|
9272
9287
|
});
|
|
9273
9288
|
return rows;
|
|
9274
9289
|
}
|
|
9290
|
+
getGapBetweenRows() {
|
|
9291
|
+
return this.style.spacing.elementGap;
|
|
9292
|
+
}
|
|
9275
9293
|
generateRowsFlats(point) {
|
|
9276
9294
|
return __awaiter(this, void 0, void 0, function* () {
|
|
9277
9295
|
const currPoint = SurveyHelper.clone(point);
|
|
@@ -9313,7 +9331,7 @@ class FlatPanel {
|
|
|
9313
9331
|
rowContainers.forEach((elementFlat) => rowsFlats.push(...elementFlat.getBricks()));
|
|
9314
9332
|
rowsFlats.push(SurveyHelper.createRowlineFlat(currPoint, this.controller));
|
|
9315
9333
|
currPoint.xLeft = point.xLeft;
|
|
9316
|
-
currPoint.yTop += this.
|
|
9334
|
+
currPoint.yTop += this.getGapBetweenRows();
|
|
9317
9335
|
nextMarginLeft = currPoint.xLeft;
|
|
9318
9336
|
}
|
|
9319
9337
|
}
|
|
@@ -9340,6 +9358,12 @@ class FlatPage extends FlatPanel {
|
|
|
9340
9358
|
return bricks;
|
|
9341
9359
|
});
|
|
9342
9360
|
}
|
|
9361
|
+
getGapBetweenRows() {
|
|
9362
|
+
if (this.survey.isSinglePage && this.panel === this.survey.visiblePages[0]) {
|
|
9363
|
+
return this.survey.style.survey.spacing.pageGap;
|
|
9364
|
+
}
|
|
9365
|
+
return super.getGapBetweenRows();
|
|
9366
|
+
}
|
|
9343
9367
|
}
|
|
9344
9368
|
FlatRepository.registerPage(FlatPage);
|
|
9345
9369
|
|
|
@@ -9791,6 +9815,18 @@ class FlatCheckbox extends FlatSelectBase {
|
|
|
9791
9815
|
}
|
|
9792
9816
|
}, SurveyHelper.getPatchedTextStyle(this.controller, Object.assign({}, style)));
|
|
9793
9817
|
}
|
|
9818
|
+
generateFlats(point) {
|
|
9819
|
+
const _super = Object.create(null, {
|
|
9820
|
+
generateFlats: { get: () => super.generateFlats }
|
|
9821
|
+
});
|
|
9822
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9823
|
+
const oldMaxSelectedChoices = this.question.maxSelectedChoices;
|
|
9824
|
+
this.question.maxSelectedChoices = 0;
|
|
9825
|
+
const flats = yield _super.generateFlats.call(this, point);
|
|
9826
|
+
this.question.maxSelectedChoices = oldMaxSelectedChoices;
|
|
9827
|
+
return flats;
|
|
9828
|
+
});
|
|
9829
|
+
}
|
|
9794
9830
|
}
|
|
9795
9831
|
class FlatTagbox extends FlatCheckbox {
|
|
9796
9832
|
getVisibleChoices() {
|
|
@@ -11413,7 +11449,7 @@ class CustomBrick extends PdfBrick {
|
|
|
11413
11449
|
}
|
|
11414
11450
|
}
|
|
11415
11451
|
|
|
11416
|
-
checkLibraryVersion(`${"3.0.0-beta.
|
|
11452
|
+
checkLibraryVersion(`${"3.0.0-beta.8"}`, 'survey-pdf');
|
|
11417
11453
|
|
|
11418
11454
|
function rgbaToHex(rgbaString) {
|
|
11419
11455
|
const parts = rgbaString.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+),?\s*([0-9.]+)?\)$/);
|
|
@@ -11449,5 +11485,5 @@ function parseColorCssFunction(value) {
|
|
|
11449
11485
|
}
|
|
11450
11486
|
}
|
|
11451
11487
|
|
|
11452
|
-
export {
|
|
11488
|
+
export { TextBrick as $, FlatQuestionDefault as A, BaseImageUtils as B, CheckItemBrick as C, DocController as D, EmptyBrick as E, FlatBooleanCheckbox as F, FlatRadiogroup as G, FlatRanking as H, FlatRating as I, FlatRepository as J, FlatSelectBase as K, FlatSignaturePad as L, FlatSlider as M, FlatSurvey as N, FlatTextbox as O, HTMLBrick as P, HorizontalAlign as Q, ImageBrick as R, LinkBrick as S, PagePacker as T, PdfBrick as U, RadioItemBrick as V, RankingItemBrick as W, RowlineBrick as X, SurveyHelper as Y, SurveyPDF as Z, __awaiter as _, registerImageUtils as a, TextFieldBrick as a0, VerticalAlign as a1, parseColorCssFunction as a2, registerVariablesManagerCreator as b, CompositeBrick as c, CustomBrick as d, DocOptions as e, DrawCanvas as f, DropdownBrick as g, EventHandler as h, FlatCheckbox as i, FlatComment as j, FlatCustomModel as k, FlatDropdown as l, FlatExpression as m, FlatFile as n, FlatHTML as o, FlatImage as p, FlatImagePicker as q, rgbaToHex as r, FlatMatrix as s, FlatMatrixDynamic as t, FlatMatrixMultiple as u, FlatMultipleText as v, FlatPage as w, FlatPanel as x, FlatPanelDynamic as y, FlatQuestion as z };
|
|
11453
11489
|
//# sourceMappingURL=pdf-shared.mjs.map
|