survey-pdf 2.0.0-rc.2 → 2.0.0-rc.3

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.
Files changed (74) hide show
  1. package/LICENSE +1 -1
  2. package/fesm/survey.pdf.fonts.js +55 -0
  3. package/fesm/survey.pdf.fonts.js.map +1 -0
  4. package/fesm/survey.pdf.js +9943 -0
  5. package/fesm/survey.pdf.js.map +1 -0
  6. package/package.json +16 -11
  7. package/survey.pdf.d.ts +1309 -1309
  8. package/survey.pdf.fonts.js +92 -78
  9. package/survey.pdf.fonts.js.map +1 -0
  10. package/survey.pdf.fonts.min.js +2 -6
  11. package/survey.pdf.fonts.min.js.LICENSE.txt +5 -0
  12. package/survey.pdf.js +7698 -7281
  13. package/survey.pdf.js.map +1 -0
  14. package/survey.pdf.min.js +2 -26
  15. package/survey.pdf.min.js.LICENSE.txt +5 -0
  16. package/typings/doc_controller.d.ts +298 -0
  17. package/typings/entries/helpers.d.ts +7 -0
  18. package/typings/entries/pdf.d.ts +51 -0
  19. package/typings/event_handler/adorners.d.ts +24 -0
  20. package/typings/event_handler/draw_canvas.d.ts +133 -0
  21. package/typings/event_handler/event_handler.d.ts +11 -0
  22. package/typings/flat_layout/flat_boolean.d.ts +22 -0
  23. package/typings/flat_layout/flat_checkbox.d.ts +19 -0
  24. package/typings/flat_layout/flat_comment.d.ts +12 -0
  25. package/typings/flat_layout/flat_custom_model.d.ts +11 -0
  26. package/typings/flat_layout/flat_default.d.ts +6 -0
  27. package/typings/flat_layout/flat_dropdown.d.ts +12 -0
  28. package/typings/flat_layout/flat_expression.d.ts +11 -0
  29. package/typings/flat_layout/flat_file.d.ts +17 -0
  30. package/typings/flat_layout/flat_html.d.ts +15 -0
  31. package/typings/flat_layout/flat_image.d.ts +12 -0
  32. package/typings/flat_layout/flat_imagepicker.d.ts +14 -0
  33. package/typings/flat_layout/flat_matrix.d.ts +38 -0
  34. package/typings/flat_layout/flat_matrixdynamic.d.ts +8 -0
  35. package/typings/flat_layout/flat_matrixmultiple.d.ts +29 -0
  36. package/typings/flat_layout/flat_multipletext.d.ts +15 -0
  37. package/typings/flat_layout/flat_paneldynamic.d.ts +13 -0
  38. package/typings/flat_layout/flat_question.d.ts +27 -0
  39. package/typings/flat_layout/flat_radiogroup.d.ts +14 -0
  40. package/typings/flat_layout/flat_ranking.d.ts +16 -0
  41. package/typings/flat_layout/flat_rating.d.ts +16 -0
  42. package/typings/flat_layout/flat_repository.d.ts +16 -0
  43. package/typings/flat_layout/flat_selectbase.d.ts +18 -0
  44. package/typings/flat_layout/flat_signaturepad.d.ts +15 -0
  45. package/typings/flat_layout/flat_survey.d.ts +15 -0
  46. package/typings/flat_layout/flat_textbox.d.ts +12 -0
  47. package/typings/fonts.d.ts +4 -0
  48. package/typings/helper_survey.d.ts +155 -0
  49. package/typings/helper_test.d.ts +21 -0
  50. package/typings/jspdf_plugins/acroform.d.ts +1 -0
  51. package/typings/page_layout/page_packer.d.ts +7 -0
  52. package/typings/pdf_render/pdf_booleanitem.d.ts +6 -0
  53. package/typings/pdf_render/pdf_brick.d.ts +86 -0
  54. package/typings/pdf_render/pdf_checkboxitem.d.ts +6 -0
  55. package/typings/pdf_render/pdf_checkitem.d.ts +23 -0
  56. package/typings/pdf_render/pdf_coloredbrick.d.ts +9 -0
  57. package/typings/pdf_render/pdf_comment.d.ts +8 -0
  58. package/typings/pdf_render/pdf_composite.d.ts +26 -0
  59. package/typings/pdf_render/pdf_custom.d.ts +8 -0
  60. package/typings/pdf_render/pdf_description.d.ts +6 -0
  61. package/typings/pdf_render/pdf_dropdown.d.ts +11 -0
  62. package/typings/pdf_render/pdf_empty.d.ts +9 -0
  63. package/typings/pdf_render/pdf_html.d.ts +9 -0
  64. package/typings/pdf_render/pdf_image.d.ts +11 -0
  65. package/typings/pdf_render/pdf_link.d.ts +9 -0
  66. package/typings/pdf_render/pdf_radioitem.d.ts +34 -0
  67. package/typings/pdf_render/pdf_rankingitem.d.ts +9 -0
  68. package/typings/pdf_render/pdf_rowline.d.ts +17 -0
  69. package/typings/pdf_render/pdf_text.d.ts +11 -0
  70. package/typings/pdf_render/pdf_textbold.d.ts +7 -0
  71. package/typings/pdf_render/pdf_textbox.d.ts +8 -0
  72. package/typings/pdf_render/pdf_textfield.d.ts +28 -0
  73. package/typings/pdf_render/pdf_titlepanel.d.ts +8 -0
  74. package/typings/survey.d.ts +152 -0
@@ -0,0 +1,5 @@
1
+ /*!
2
+ * surveyjs - SurveyJS PDF library v2.0.0-rc.3
3
+ * Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
4
+ * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
+ */
@@ -0,0 +1,298 @@
1
+ import { IHTMLRenderType } from './flat_layout/flat_html';
2
+ import { LocalizableString } from 'survey-core';
3
+ import './jspdf_plugins/acroform.js';
4
+ import './jspdf_plugins/from_html.js';
5
+ export interface IPoint {
6
+ /**
7
+ * An X-coordinate for the left element edge.
8
+ */
9
+ xLeft: number;
10
+ /**
11
+ * A Y-coordinate for the top element edge.
12
+ */
13
+ yTop: number;
14
+ }
15
+ /**
16
+ * An interface that describes a rectangle.
17
+ */
18
+ export interface IRect extends IPoint {
19
+ /**
20
+ * An X-coordinate for the right element edge.
21
+ */
22
+ xRight: number;
23
+ /**
24
+ * A Y-coordinate for the bottom element edge.
25
+ */
26
+ yBot: number;
27
+ }
28
+ export interface ISize {
29
+ width: number;
30
+ height: number;
31
+ }
32
+ export interface IMarginLR {
33
+ /**
34
+ * A left margin.
35
+ */
36
+ left?: number;
37
+ /**
38
+ * A right margin.
39
+ */
40
+ right?: number;
41
+ }
42
+ /**
43
+ * An interface that describes margins.
44
+ */
45
+ export interface IMargin extends IMarginLR {
46
+ /**
47
+ * A top margin.
48
+ */
49
+ top?: number;
50
+ /**
51
+ * A bottom margin.
52
+ */
53
+ bot?: number;
54
+ }
55
+ /**
56
+ * PDF document configuration. Pass it as the second argument to the `SurveyPDF` constructor:
57
+ *
58
+ * ```js
59
+ * const surveyPdf = new SurveyPDF.SurveyPDF(surveyJson, pdfDocOptions);
60
+ *
61
+ * // In modular applications:
62
+ * import { SurveyPDF } from "survey-pdf";
63
+ * const surveyPdf = new SurveyPDF(surveyJson, pdfDocOptions);
64
+ * ```
65
+ */
66
+ export interface IDocOptions {
67
+ /**
68
+ * Page orientation.
69
+ *
70
+ * Possible values:
71
+ *
72
+ * - `"p"` (default) - Portrait orientation.
73
+ * - `"l"` - Landscape orientation.
74
+ *
75
+ * @see format
76
+ */
77
+ orientation?: 'p' | 'l';
78
+ /**
79
+ * Page format.
80
+ *
81
+ * Possible values:
82
+ *
83
+ * - `"a0"` - `"a10"` (`"a4"` is default)
84
+ * - `"b0"` - `"b10"`
85
+ * - `"c0"` - `"c10"`
86
+ * - `"dl"`
87
+ * - `"letter"`
88
+ * - `"government-letter"`
89
+ * - `"legal"`
90
+ * - `"junior-legal"`
91
+ * - `"ledger"`
92
+ * - `"tabloid"`
93
+ * - `"credit-card"`
94
+ * - Array<number> - custom page size in millimeters, for example, `[210, 297]`.
95
+ *
96
+ * @see orientation
97
+ */
98
+ format?: string | number[];
99
+ /**
100
+ * Font size in points.
101
+ *
102
+ * Default value: 14
103
+ *
104
+ * @see fontName
105
+ */
106
+ fontSize?: number;
107
+ /**
108
+ * Font name.
109
+ *
110
+ * Possible values:
111
+ *
112
+ * - `"Helvetica"` (default)
113
+ * - `"Courier"`
114
+ * - `"Times"`
115
+ * - `"Symbol"`
116
+ * - `"ZapfDingbats"`
117
+ * - [Custom font name](https://surveyjs.io/Documentation/Pdf-Export?id=Customization-ChangeFonts#use-custom-font)
118
+ *
119
+ * [View Demo](https://surveyjs.io/pdf-generator/examples/change-font-in-pdf-form/ (linkStyle))
120
+ * @see fontSize
121
+ */
122
+ fontName?: string;
123
+ base64Normal?: string;
124
+ base64Bold?: string;
125
+ /**
126
+ * Specifies whether to apply a custom font to [HTML questions](https://surveyjs.io/form-library/examples/questiontype-html/).
127
+ *
128
+ * Default value: `false`
129
+ *
130
+ * [View Demo](https://surveyjs.io/pdf-generator/examples/change-font-in-pdf-form/ (linkStyle))
131
+ * @see htmlRenderAs
132
+ */
133
+ useCustomFontInHtml?: boolean;
134
+ /**
135
+ * Page margins. Set this property to an object with the following fields: `top`, `bot`, `left`, `right`.
136
+ */
137
+ margins?: IMargin;
138
+ /**
139
+ * Specifies how to render [HTML questions](https://surveyjs.io/Documentation/Library?id=questionhtmlmodel) into PDF.
140
+ *
141
+ * Possible values:
142
+ *
143
+ * - `"standard"` - Render HTML questions as selectable text.
144
+ * - `"image"` - Render HTML questions as images.
145
+ * - `"auto"` (default) - Select between the `"standard"` and `"image"` modes automatically based on the HTML content.
146
+ *
147
+ * You can override this property for an individual HTML question. Set the question's `renderAs` property to `"standard"` or `"image"` in the survey JSON schema.
148
+ * @see useCustomFontInHtml
149
+ */
150
+ htmlRenderAs?: IHTMLRenderType;
151
+ /**
152
+ * Specifies how to render [Matrix](https://surveyjs.io/Documentation/Library?id=questionmatrixmodel), [Matrix Dropdown](https://surveyjs.io/Documentation/Library?id=questionmatrixdropdownmodel), and [Matrix Dynamic](https://surveyjs.io/Documentation/Library?id=questionmatrixdynamicmodel) questions into PDF.
153
+ *
154
+ * Possible values:
155
+ *
156
+ * - `"list"` - Render matrix-like questions as lists.
157
+ * - `"auto"` (default) - Render matrix-like questions as tables if they fit into the available space. Otherwise, render the questions as lists.
158
+ *
159
+ * You can override this property for an individual matrix-like question. Set the question's `renderAs` property to `"list"` in the survey JSON schema.
160
+ */
161
+ matrixRenderAs?: 'auto' | 'list';
162
+ useLegacyBooleanRendering?: boolean;
163
+ /**
164
+ * Specifies how to render read-only questions.
165
+ *
166
+ * Possible values:
167
+ *
168
+ * - `"text"` - Render read-only questions as plain text and custom primitives.
169
+ * - `"acroform"` - Use Adobe AcroForms to render questions that support them as interactive form elements switched to their native read-only state. Other questions are rendered in `"text"` mode.
170
+ * - `"auto"` (default) - Prefer the `"text"` mode but use `"acroform"` for [File Upload](https://surveyjs.io/form-library/documentation/api-reference/file-model) questions and links.
171
+ */
172
+ readonlyRenderAs?: 'auto' | 'text' | 'acroform';
173
+ textFieldRenderAs?: 'singleLine' | 'multiLine';
174
+ /**
175
+ * Specifies whether to compress the PDF document. Compressed documents do not support [custom fonts](https://surveyjs.io/Documentation/Pdf-Export?id=Customization-ChangeFonts#use-custom-font).
176
+ *
177
+ * Default value: `false`
178
+ */
179
+ compress?: boolean;
180
+ /**
181
+ * Specifies whether to apply `imageFit` settings specified in the survey JSON schema to exported images.
182
+ *
183
+ * Default value: `false`
184
+ *
185
+ * This property applies the following settings:
186
+ *
187
+ * - [`imageFit`](https://surveyjs.io/form-library/documentation/api-reference/add-image-to-survey#imageFit) to exported [Image](https://surveyjs.io/form-library/documentation/api-reference/add-image-to-survey) questions
188
+ * - [`imageFit`](https://surveyjs.io/form-library/documentation/api-reference/image-picker-question-model#imageFit) to exported [Image Picker](https://surveyjs.io/form-library/documentation/api-reference/image-picker-question-model) questions
189
+ * - [`logoFit`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#logoFit) to an exported logo in the survey header
190
+ *
191
+ * If you enable the `applyImageFit` property, the quality of images may be lower because they pass through several conversions. If `applyImageFit` is disabled, exported images fill the entire container and do not preserve their aspect ratio, but their quality remains the same because they are exported as is.
192
+ */
193
+ applyImageFit?: boolean;
194
+ /**
195
+ * Specifies whether the PDF document contains text in right-to-left languages.
196
+ *
197
+ * Default value: `false`
198
+ */
199
+ isRTL?: boolean;
200
+ /**
201
+ * Specifies whether to include only selected choices when PDF Generator renders a [Multi-Select Dropdown (Tag Box)](https://surveyjs.io/form-library/examples/how-to-create-multiselect-tag-box/) question.
202
+ *
203
+ * Default value: `false` (include all choices)
204
+ */
205
+ tagboxSelectedChoicesOnly?: boolean;
206
+ }
207
+ export declare class DocOptions implements IDocOptions {
208
+ static readonly MM_TO_PT: number;
209
+ static readonly FONT_SIZE = 14;
210
+ protected _orientation: 'l' | 'p';
211
+ protected _format: string | number[];
212
+ protected _fontSize: number;
213
+ protected _fontName: string;
214
+ static SEGOE_NORMAL: string;
215
+ static SEGOE_BOLD: string;
216
+ protected _base64Normal: string;
217
+ protected _base64Bold: string;
218
+ protected _useCustomFontInHtml: boolean;
219
+ protected _margins: IMargin;
220
+ protected _htmlRenderAs: IHTMLRenderType;
221
+ protected _matrixRenderAs: 'auto' | 'list';
222
+ protected _readonlyRenderAs: 'auto' | 'text' | 'acroform';
223
+ protected _compress: boolean;
224
+ protected _applyImageFit: boolean;
225
+ protected _useLegacyBooleanRendering: boolean;
226
+ protected _isRTL: boolean;
227
+ protected _tagboxSelectedChoicesOnly: boolean;
228
+ constructor(options: IDocOptions);
229
+ get leftTopPoint(): IPoint;
230
+ get fontSize(): number;
231
+ get fontName(): string;
232
+ get base64Normal(): string;
233
+ get base64Bold(): string;
234
+ get useCustomFontInHtml(): boolean;
235
+ get margins(): IMargin;
236
+ get format(): string | number[];
237
+ get orientation(): 'l' | 'p';
238
+ get htmlRenderAs(): IHTMLRenderType;
239
+ get matrixRenderAs(): 'auto' | 'list';
240
+ get readonlyRenderAs(): 'auto' | 'text' | 'acroform';
241
+ get compress(): boolean;
242
+ get applyImageFit(): boolean;
243
+ get useLegacyBooleanRendering(): boolean;
244
+ get isRTL(): boolean;
245
+ get tagboxSelectedChoicesOnly(): boolean;
246
+ }
247
+ /**
248
+ * The `DocController` object includes an API that allows you to configure the resulting PDF document. You can access this object within functions that handle the `SurveyPDF`'s [`onRender...`](https://surveyjs.io/pdf-generator/documentation/api-reference/surveypdf#onRenderFooter) events.
249
+ *
250
+ * [View Demo](https://surveyjs.io/pdf-generator/examples/how-to-use-adorners-in-pdf-forms/ (linkStyle))
251
+ */
252
+ export declare class DocController extends DocOptions {
253
+ private _doc;
254
+ private _helperDoc;
255
+ private _fontStyle;
256
+ private marginsStack;
257
+ constructor(options?: IDocOptions);
258
+ static customFonts: {
259
+ [name: string]: {
260
+ normal: string;
261
+ bold: string;
262
+ italic: string;
263
+ bolditalic: string;
264
+ };
265
+ };
266
+ static addFont(fontName: string, base64: string, fontStyle: 'normal' | 'bold' | 'italic' | 'bolditalic'): void;
267
+ get doc(): any;
268
+ get helperDoc(): any;
269
+ get fontName(): string;
270
+ set fontName(fontName: string);
271
+ get fontSize(): number;
272
+ set fontSize(fontSize: number);
273
+ get fontStyle(): string;
274
+ set fontStyle(fontStyle: string);
275
+ measureText(text?: string | LocalizableString | number, fontStyle?: string, fontSize?: number): ISize;
276
+ /**
277
+ * The width of one character in pixels.
278
+ */
279
+ get unitWidth(): number;
280
+ /**
281
+ * The heigth of one character in pixels.
282
+ */
283
+ get unitHeight(): number;
284
+ pushMargins(left?: number, right?: number): void;
285
+ popMargins(): void;
286
+ /**
287
+ * The width of a PDF page in pixels.
288
+ */
289
+ get paperWidth(): number;
290
+ /**
291
+ * The height of a PDF page in pixels.
292
+ */
293
+ get paperHeight(): number;
294
+ getNumberOfPages(): number;
295
+ addPage(): void;
296
+ getCurrentPageIndex(): number;
297
+ setPage(index: number): void;
298
+ }
@@ -0,0 +1,7 @@
1
+ export declare function __extends(d: any, b: any): void;
2
+ export declare var __assign: () => any;
3
+ export declare function __rest(s: any, e: any): any;
4
+ export declare function __decorate(decorators: any, target: any, key: any, desc: any): any;
5
+ export declare function __awaiter(thisArg: any, _arguments: any, P: any, generator: any): any;
6
+ export declare function __generator(thisArg: any, body: any): any;
7
+ export declare function __spreadArray(to: any, from: any, pack: any): any;
@@ -0,0 +1,51 @@
1
+ export { SurveyPDF } from '../survey';
2
+ export { SurveyHelper } from '../helper_survey';
3
+ export { IPoint, IRect, ISize, IMarginLR, IMargin, IDocOptions, DocOptions, DocController } from '../doc_controller';
4
+ export { FlatRepository } from '../flat_layout/flat_repository';
5
+ export { IFlatQuestion, FlatQuestion } from '../flat_layout/flat_question';
6
+ export { FlatQuestionDefault } from '../flat_layout/flat_default';
7
+ export { FlatBooleanCheckbox as FlatBoolean } from '../flat_layout/flat_boolean';
8
+ export { FlatCheckbox } from '../flat_layout/flat_checkbox';
9
+ export { FlatCustomModel } from '../flat_layout/flat_custom_model';
10
+ export { FlatComment } from '../flat_layout/flat_comment';
11
+ export { FlatDropdown } from '../flat_layout/flat_dropdown';
12
+ export { FlatExpression } from '../flat_layout/flat_expression';
13
+ export { FlatFile } from '../flat_layout/flat_file';
14
+ export { FlatHTML } from '../flat_layout/flat_html';
15
+ export { FlatImage } from '../flat_layout/flat_image';
16
+ export { FlatImagePicker } from '../flat_layout/flat_imagepicker';
17
+ export { FlatPanelDynamic } from '../flat_layout/flat_paneldynamic';
18
+ export { FlatRadiogroup } from '../flat_layout/flat_radiogroup';
19
+ export { FlatRanking } from '../flat_layout/flat_ranking';
20
+ export { FlatRating } from '../flat_layout/flat_rating';
21
+ export { FlatSelectBase } from '../flat_layout/flat_selectbase';
22
+ export { FlatSignaturePad } from '../flat_layout/flat_signaturepad';
23
+ export { FlatTextbox } from '../flat_layout/flat_textbox';
24
+ export { FlatSurvey } from '../flat_layout/flat_survey';
25
+ export { FlatMatrix } from '../flat_layout/flat_matrix';
26
+ export { FlatMatrixMultiple } from '../flat_layout/flat_matrixmultiple';
27
+ export { FlatMatrixDynamic } from '../flat_layout/flat_matrixdynamic';
28
+ export { FlatMultipleText } from '../flat_layout/flat_multipletext';
29
+ export { PagePacker } from '../page_layout/page_packer';
30
+ export { EventHandler } from '../event_handler/event_handler';
31
+ export { HorizontalAlign, VerticalAlign, IDrawRectOptions, IDrawTextOptions, IDrawImageOptions, DrawCanvas } from '../event_handler/draw_canvas';
32
+ export { IPdfBrick, PdfBrick } from '../pdf_render/pdf_brick';
33
+ export { BooleanItemBrick } from '../pdf_render/pdf_booleanitem';
34
+ export { CheckboxItemBrick } from '../pdf_render/pdf_checkboxitem';
35
+ export { CheckItemBrick } from '../pdf_render/pdf_checkitem';
36
+ export { CommentBrick } from '../pdf_render/pdf_comment';
37
+ export { CompositeBrick } from '../pdf_render/pdf_composite';
38
+ export { CustomBrick } from '../pdf_render/pdf_custom';
39
+ export { DropdownBrick } from '../pdf_render/pdf_dropdown';
40
+ export { EmptyBrick } from '../pdf_render/pdf_empty';
41
+ export { HTMLBrick } from '../pdf_render/pdf_html';
42
+ export { ImageBrick } from '../pdf_render/pdf_image';
43
+ export { LinkBrick } from '../pdf_render/pdf_link';
44
+ export { RadioItemBrick } from '../pdf_render/pdf_radioitem';
45
+ export { RankingItemBrick } from '../pdf_render/pdf_rankingitem';
46
+ export { RowlineBrick } from '../pdf_render/pdf_rowline';
47
+ export { TextFieldBrick } from '../pdf_render/pdf_textfield';
48
+ export { TextBoldBrick } from '../pdf_render/pdf_textbold';
49
+ export { TextBoxBrick } from '../pdf_render/pdf_textbox';
50
+ export { TextBrick } from '../pdf_render/pdf_text';
51
+ export { TitlePanelBrick } from '../pdf_render/pdf_titlepanel';
@@ -0,0 +1,24 @@
1
+ import { PanelModel, PageModel, Question } from 'survey-core';
2
+ import { IPoint, DocController } from '../doc_controller';
3
+ import { FlatRepository } from '../flat_layout/flat_repository';
4
+ import { IPdfBrick } from '../pdf_render/pdf_brick';
5
+ export declare class AdornersBaseOptions {
6
+ point: IPoint;
7
+ bricks: IPdfBrick[];
8
+ controller: DocController;
9
+ repository: FlatRepository;
10
+ module: any;
11
+ constructor(point: IPoint, bricks: IPdfBrick[], controller: DocController, repository: FlatRepository, module: any);
12
+ }
13
+ export declare class AdornersOptions extends AdornersBaseOptions {
14
+ question: Question;
15
+ constructor(point: IPoint, bricks: IPdfBrick[], question: Question, controller: DocController, repository: FlatRepository, module: any);
16
+ }
17
+ export declare class AdornersPanelOptions extends AdornersBaseOptions {
18
+ panel: PanelModel;
19
+ constructor(point: IPoint, bricks: IPdfBrick[], panel: PanelModel, controller: DocController, repository: FlatRepository, module: any);
20
+ }
21
+ export declare class AdornersPageOptions extends AdornersBaseOptions {
22
+ page: PageModel;
23
+ constructor(point: IPoint, bricks: IPdfBrick[], page: PageModel, controller: DocController, repository: FlatRepository, module: any);
24
+ }
@@ -0,0 +1,133 @@
1
+ import { IRect, IMargin, DocController } from '../doc_controller';
2
+ import { IPdfBrick } from '../pdf_render/pdf_brick';
3
+ /**
4
+ * Horizontal alignment types in onRenderHeader and onRenderFooter events
5
+ */
6
+ export declare enum HorizontalAlign {
7
+ NotSet = "notset",
8
+ Left = "left",
9
+ Center = "center",
10
+ Right = "right"
11
+ }
12
+ /**
13
+ * Vertical alignment types in onRenderHeader and onRenderFooter events
14
+ */
15
+ export declare enum VerticalAlign {
16
+ NotSet = "notset",
17
+ Top = "top",
18
+ Middle = "middle",
19
+ Bottom = "bottom"
20
+ }
21
+ export interface IDrawRectOptions {
22
+ /**
23
+ * Horizontal alignment within the rectangle that limits the drawing area.
24
+ *
25
+ * Possible values:
26
+ *
27
+ * - `"center"` (default)
28
+ * - `"left"`
29
+ * - `"right"`
30
+ */
31
+ horizontalAlign?: HorizontalAlign;
32
+ /**
33
+ * Vertical alignment within the rectangle that limits the drawing area.
34
+ *
35
+ * Possible values:
36
+ *
37
+ * - `"middle"` (default)
38
+ * - `"top"`
39
+ * - `"bottom"`
40
+ */
41
+ verticalAlign?: VerticalAlign;
42
+ /**
43
+ * The distance between the content and the borders of the rectangle. This property applies only if the content is aligned to the left/right or top/bottom.
44
+ */
45
+ margins?: IMargin;
46
+ /**
47
+ * An object with coordinates of the rectangle.
48
+ */
49
+ rect?: IRect;
50
+ }
51
+ /**
52
+ * An object that configures rendering a piece of text.
53
+ */
54
+ export interface IDrawTextOptions extends IDrawRectOptions {
55
+ /**
56
+ * A text string to be drawn.
57
+ */
58
+ text: string;
59
+ /**
60
+ * Font size in points.
61
+ *
62
+ * Default value: 14
63
+ */
64
+ fontSize?: number;
65
+ /**
66
+ * Enable this property to render the text string bold.
67
+ *
68
+ * Default value: `false`
69
+ */
70
+ isBold?: boolean;
71
+ }
72
+ /**
73
+ * An object that configures rendering an image.
74
+ */
75
+ export interface IDrawImageOptions extends IDrawRectOptions {
76
+ /**
77
+ * An image width in pixels. Defaults to the [rectangle width](https://surveyjs.io/pdf-generator/documentation/api-reference/idrawimageoptions#rect).
78
+ */
79
+ width?: number;
80
+ /**
81
+ * An image height in pixels. Defaults to the [rectangle height](https://surveyjs.io/pdf-generator/documentation/api-reference/idrawimageoptions#rect).
82
+ */
83
+ height?: number;
84
+ /**
85
+ * A string value with a base64-encoded image to be drawn.
86
+ */
87
+ base64: string;
88
+ /**
89
+ * Specifies how to resize the image to fit it into its container.
90
+ *
91
+ * Default value: `"contain"` if [`applyImageFit`](https://surveyjs.io/pdf-generator/documentation/api-reference/idocoptions#applyImageFit) is enabled or `undefined` if not.
92
+ *
93
+ * Refer to the [`object-fit`](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit) CSS property description for information on accepted values.
94
+ */
95
+ imageFit?: string;
96
+ }
97
+ /**
98
+ * An object that describes a drawing area and enables you to draw an image or a piece of text within the area. You can access this object within functions that handle `SurveyPDF`'s [`onRenderHeader`](https://surveyjs.io/pdf-generator/documentation/api-reference/surveypdf#onRenderHeader) and [`onRenderFooter`](https://surveyjs.io/pdf-generator/documentation/api-reference/surveypdf#onRenderFooter) events.
99
+ *
100
+ * [View Demo](https://surveyjs.io/pdf-generator/examples/customize-header-and-footer-of-pdf-form/ (linkStyle))
101
+ */
102
+ export declare class DrawCanvas {
103
+ packs: IPdfBrick[];
104
+ controller: DocController;
105
+ protected _rect: IRect;
106
+ protected _countPages: number;
107
+ protected _pageNumber: number;
108
+ constructor(packs: IPdfBrick[], controller: DocController, _rect: IRect, _countPages: number, _pageNumber: number);
109
+ /**
110
+ * A total number of pages in the document.
111
+ */
112
+ get pageCount(): number;
113
+ get countPages(): number;
114
+ /**
115
+ * The number of the page that contains the drawing area. Enumeration starts with 1.
116
+ */
117
+ get pageNumber(): number;
118
+ /**
119
+ * An object with coordinates of a rectangle that limits the drawing area. This object contain the following fields: `xLeft`, `xRight`, `yTop`, `yBot`.
120
+ */
121
+ get rect(): IRect;
122
+ private alignRect;
123
+ /**
124
+ * Draws a piece of text within the drawing area.
125
+ * @param textOptions An [`IDrawTextOptions`](https://surveyjs.io/pdf-generator/documentation/api-reference/idrawtextoptions) object that configures the drawing.
126
+ */
127
+ drawText(textOptions: IDrawTextOptions): void;
128
+ /**
129
+ * Draws an image within the drawing area.
130
+ * @param imageOptions An [`IDrawImageOptions`](https://surveyjs.io/pdf-generator/documentation/api-reference/idrawimageoptions) object that configures drawing.
131
+ */
132
+ drawImage(imageOptions: IDrawImageOptions): Promise<void>;
133
+ }
@@ -0,0 +1,11 @@
1
+ import { EventBase } from 'survey-core';
2
+ import { SurveyPDF } from '../survey';
3
+ import { DocController } from '../doc_controller';
4
+ import { IPdfBrick } from '../pdf_render/pdf_brick';
5
+ export declare class EventAsync<Sender, Options> extends EventBase<Sender, Options> {
6
+ unshift(func: (sender: Sender, options: Options) => any): void;
7
+ fire(sender: Sender, options: Options): Promise<void>;
8
+ }
9
+ export declare class EventHandler {
10
+ static process_header_events(survey: SurveyPDF, controller: DocController, packs: IPdfBrick[][]): Promise<void>;
11
+ }
@@ -0,0 +1,22 @@
1
+ import { IQuestion, ItemValue, QuestionBooleanModel } from 'survey-core';
2
+ import { SurveyPDF } from '../survey';
3
+ import { IPoint, DocController } from '../doc_controller';
4
+ import { FlatQuestion } from './flat_question';
5
+ import { IPdfBrick } from '../pdf_render/pdf_brick';
6
+ import { FlatRadiogroup } from './flat_radiogroup';
7
+ export declare class FlatBooleanCheckbox extends FlatQuestion {
8
+ protected survey: SurveyPDF;
9
+ protected controller: DocController;
10
+ protected question: QuestionBooleanModel;
11
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
12
+ generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
13
+ }
14
+ export declare class FlatBoolean extends FlatRadiogroup {
15
+ protected survey: SurveyPDF;
16
+ protected controller: DocController;
17
+ private items;
18
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
19
+ private buildItems;
20
+ protected getVisibleChoices(): Array<ItemValue>;
21
+ protected getColCount(): number;
22
+ }
@@ -0,0 +1,19 @@
1
+ import { IQuestion, ItemValue, QuestionCheckboxModel, QuestionTagboxModel } from 'survey-core';
2
+ import { SurveyPDF } from '../survey';
3
+ import { IRect, DocController } from '../doc_controller';
4
+ import { FlatSelectBase } from './flat_selectbase';
5
+ import { IPdfBrick } from '../pdf_render/pdf_brick';
6
+ export declare class FlatCheckbox extends FlatSelectBase {
7
+ protected survey: SurveyPDF;
8
+ protected controller: DocController;
9
+ protected question: QuestionCheckboxModel;
10
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
11
+ generateFlatItem(rect: IRect, item: ItemValue, index: number): IPdfBrick;
12
+ }
13
+ export declare class FlatTagbox extends FlatCheckbox {
14
+ protected survey: SurveyPDF;
15
+ protected controller: DocController;
16
+ protected question: QuestionTagboxModel;
17
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
18
+ protected getVisibleChoices(): Array<ItemValue>;
19
+ }
@@ -0,0 +1,12 @@
1
+ import { IQuestion, QuestionCommentModel } from 'survey-core';
2
+ import { SurveyPDF } from '../survey';
3
+ import { IPoint, DocController } from '../doc_controller';
4
+ import { FlatQuestion } from './flat_question';
5
+ import { IPdfBrick } from '../pdf_render/pdf_brick';
6
+ export declare class FlatComment extends FlatQuestion {
7
+ protected survey: SurveyPDF;
8
+ protected controller: DocController;
9
+ protected question: QuestionCommentModel;
10
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
11
+ generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
12
+ }
@@ -0,0 +1,11 @@
1
+ import { IQuestion } from 'survey-core';
2
+ import { SurveyPDF } from '../survey';
3
+ import { IPoint, DocController } from '../doc_controller';
4
+ import { FlatQuestion } from './flat_question';
5
+ import { IPdfBrick } from '../pdf_render/pdf_brick';
6
+ export declare class FlatCustomModel extends FlatQuestion {
7
+ protected survey: SurveyPDF;
8
+ protected controller: DocController;
9
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
10
+ generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
11
+ }
@@ -0,0 +1,6 @@
1
+ import { IPoint } from '../doc_controller';
2
+ import { IPdfBrick } from '../pdf_render/pdf_brick';
3
+ import { FlatQuestion } from './flat_question';
4
+ export declare class FlatQuestionDefault extends FlatQuestion {
5
+ generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
6
+ }
@@ -0,0 +1,12 @@
1
+ import { IQuestion, QuestionDropdownModel } from 'survey-core';
2
+ import { SurveyPDF } from '../survey';
3
+ import { IPoint, DocController } from '../doc_controller';
4
+ import { FlatQuestion } from './flat_question';
5
+ import { IPdfBrick } from '../pdf_render/pdf_brick';
6
+ export declare class FlatDropdown extends FlatQuestion {
7
+ protected survey: SurveyPDF;
8
+ protected controller: DocController;
9
+ protected question: QuestionDropdownModel;
10
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
11
+ generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
12
+ }
@@ -0,0 +1,11 @@
1
+ import { IQuestion, QuestionExpressionModel } from 'survey-core';
2
+ import { SurveyPDF } from '../survey';
3
+ import { IPoint, DocController } from '../doc_controller';
4
+ import { FlatQuestion } from './flat_question';
5
+ import { IPdfBrick } from '../pdf_render/pdf_brick';
6
+ export declare class FlatExpression extends FlatQuestion {
7
+ protected survey: SurveyPDF;
8
+ protected question: QuestionExpressionModel;
9
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
10
+ generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
11
+ }
@@ -0,0 +1,17 @@
1
+ import { IQuestion, QuestionFileModel } from 'survey-core';
2
+ import { SurveyPDF } from '../survey';
3
+ import { IPoint, DocController } from '../doc_controller';
4
+ import { FlatQuestion } from './flat_question';
5
+ import { IPdfBrick } from '../pdf_render/pdf_brick';
6
+ export declare class FlatFile extends FlatQuestion {
7
+ protected survey: SurveyPDF;
8
+ static readonly IMAGE_GAP_SCALE: number;
9
+ static readonly TEXT_MIN_SCALE: number;
10
+ static DEFAULT_IMAGE_FIT: string;
11
+ protected question: QuestionFileModel;
12
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
13
+ private generateFlatItem;
14
+ private addLine;
15
+ private getImagePreviewContentWidth;
16
+ generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
17
+ }