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
package/survey.pdf.d.ts CHANGED
@@ -1,1309 +1,1309 @@
1
- /*Type definitions for SurveyJS PDF library v2.0.0-rc.2
2
- Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
3
- Definitions by: Devsoft Baltic OÜ <https://github.com/surveyjs/>
4
- */
5
- // Dependencies for this module:
6
- // ../../../../survey-core
7
-
8
- import { SurveyModel, EventBase } from 'survey-core';
9
- import { IQuestion, Question, QuestionRatingModel, QuestionFileModel, LocalizableString } from 'survey-core';
10
- import { ItemValue, QuestionBooleanModel } from 'survey-core';
11
- import { QuestionCheckboxModel, QuestionTagboxModel } from 'survey-core';
12
- import { QuestionCommentModel } from 'survey-core';
13
- import { QuestionDropdownModel } from 'survey-core';
14
- import { QuestionExpressionModel } from 'survey-core';
15
- import { QuestionHtmlModel } from 'survey-core';
16
- import { QuestionImageModel } from 'survey-core';
17
- import { QuestionImagePickerModel } from 'survey-core';
18
- import { QuestionPanelDynamicModel } from 'survey-core';
19
- import { QuestionRadiogroupModel } from 'survey-core';
20
- import { QuestionRankingModel } from 'survey-core';
21
- import { QuestionCheckboxBase } from 'survey-core';
22
- import { QuestionSignaturePadModel } from 'survey-core';
23
- import { QuestionTextModel } from 'survey-core';
24
- import { PanelModel } from 'survey-core';
25
- import { QuestionMatrixModel, MatrixRowModel } from 'survey-core';
26
- import { QuestionMatrixDropdownModelBase } from 'survey-core';
27
- import { QuestionMultipleTextModel } from 'survey-core';
28
- import { PageModel } from 'survey-core';
29
-
30
- /**
31
- * The `SurveyPDF` object enables you to export your surveys and forms to PDF documents.
32
- *
33
- * [View Demo](https://surveyjs.io/pdf-generator/examples/ (linkStyle))
34
- */
35
- export declare class SurveyPDF extends SurveyModel {
36
- options: IDocOptions;
37
- constructor(jsonObject: any, options?: IDocOptions);
38
- get haveCommercialLicense(): boolean;
39
- set haveCommercialLicense(val: boolean);
40
- /**
41
- * An event that is raised when SurveyJS PDF Generator renders a page header. Handle this event to customize the header.
42
- *
43
- * Parameters:
44
- *
45
- * - `sender`: `SurveyPDF`\
46
- * A SurveyPDF instance that raised the event.
47
- *
48
- * - `canvas`: [`DrawCanvas`](https://surveyjs.io/pdf-generator/documentation/api-reference/drawcanvas)\
49
- * An object that you can use to draw text and images in the page header.
50
- *
51
- * [View Demo](https://surveyjs.io/pdf-generator/examples/customize-header-and-footer-of-pdf-form/ (linkStyle))
52
- */
53
- onRenderHeader: EventAsync<SurveyPDF, DrawCanvas>;
54
- /**
55
- * An event that is raised when SurveyJS PDF Generator renders a page footer. Handle this event to customize the footer.
56
- *
57
- * Parameters:
58
- *
59
- * - `sender`: `SurveyPDF`\
60
- * A SurveyPDF instance that raised the event.
61
- *
62
- * - `canvas`: [`DrawCanvas`](https://surveyjs.io/pdf-generator/documentation/api-reference/drawcanvas)\
63
- * An object that you can use to draw text and images in the page footer.
64
- *
65
- * [View Demo](https://surveyjs.io/pdf-generator/examples/customize-header-and-footer-of-pdf-form/ (linkStyle))
66
- */
67
- onRenderFooter: EventAsync<SurveyPDF, DrawCanvas>;
68
- /**
69
- * An event that is raised when SurveyJS PDF Generator renders a survey question. Handle this event to customize question rendering.
70
- *
71
- * Parameters:
72
- *
73
- * - `sender`: `SurveyPDF`\
74
- * A SurveyPDF instance that raised the event.
75
- *
76
- * - `options.question`: [`Question`](https://surveyjs.io/form-library/documentation/api-reference/question)\
77
- * A survey question that is being rendered.
78
- *
79
- * - `options.point`: `IPoint`\
80
- * An object with coordinates of the top-left corner of the element being rendered. This object contains the following properties: `{ xLeft: number, yTop: number }`.
81
- *
82
- * - `options.bricks`: [`PdfBrick[]`](https://surveyjs.io/pdf-generator/documentation/api-reference/pdfbrick)\
83
- * An array of [bricks](https://surveyjs.io/pdf-generator/documentation/customize-survey-question-rendering-in-pdf-form#custom-rendering) used to render the element.
84
- *
85
- * - `options.controller`: [`DocController`](https://surveyjs.io/pdf-generator/documentation/api-reference/doccontroller)\
86
- * An object that provides access to main PDF document properties (font, margins, page width and height) and allows you to modify them.
87
- *
88
- * - `options.repository`: `FlatRepository`\
89
- * A repository with classes that render elements to PDF. Use its `create` method if you need to create a new instance of a rendering class.
90
- *
91
- * [View Demo](https://surveyjs.io/pdf-generator/examples/how-to-use-adorners-in-pdf-forms/ (linkStyle))
92
- */
93
- onRenderQuestion: EventAsync<SurveyPDF, AdornersOptions>;
94
- /**
95
- * An event that is raised when SurveyJS PDF Generator renders a panel. Handle this event to customize panel rendering.
96
- *
97
- * Parameters:
98
- *
99
- * - `sender`: `SurveyPDF`\
100
- * A SurveyPDF instance that raised the event.
101
- *
102
- * - `options.panel`: [`PanelModel`](https://surveyjs.io/form-library/documentation/api-reference/panel-model)\
103
- * A panel that is being rendered.
104
- *
105
- * - `options.point`: `IPoint`\
106
- * An object with coordinates of the top-left corner of the element being rendered. This object contains the following properties: `{ xLeft: number, yTop: number }`.
107
- *
108
- * - `options.bricks`: [`PdfBrick[]`](https://surveyjs.io/pdf-generator/documentation/api-reference/pdfbrick)\
109
- * An array of [bricks](https://surveyjs.io/pdf-generator/documentation/customize-survey-question-rendering-in-pdf-form#custom-rendering) used to render the element.
110
- *
111
- * - `options.controller`: [`DocController`](https://surveyjs.io/pdf-generator/documentation/api-reference/doccontroller)\
112
- * An object that provides access to main PDF document properties (font, margins, page width and height) and allows you to modify them.
113
- *
114
- * - `options.repository`: `FlatRepository`\
115
- * A repository with classes that render elements to PDF. Use its `create` method if you need to create a new instance of a rendering class.
116
- *
117
- * [View Demo](https://surveyjs.io/pdf-generator/examples/how-to-use-adorners-in-pdf-forms/ (linkStyle))
118
- */
119
- onRenderPanel: EventAsync<SurveyPDF, AdornersPanelOptions>;
120
- /**
121
- * An event that is raised when SurveyJS PDF Generator renders a page. Handle this event to customize page rendering.
122
- *
123
- * Parameters:
124
- *
125
- * - `sender`: `SurveyPDF`\
126
- * A SurveyPDF instance that raised the event.
127
- *
128
- * - `options.page`: [`PageModel`](https://surveyjs.io/form-library/documentation/api-reference/page-model)\
129
- * A page that is being rendered.
130
- *
131
- * - `options.point`: `IPoint`\
132
- * An object with coordinates of the top-left corner of the element being rendered. This object contains the following properties: `{ xLeft: number, yTop: number }`.
133
- *
134
- * - `options.bricks`: [`PdfBrick[]`](https://surveyjs.io/pdf-generator/documentation/api-reference/pdfbrick)\
135
- * An array of [bricks](https://surveyjs.io/pdf-generator/documentation/customize-survey-question-rendering-in-pdf-form#custom-rendering) used to render the element.
136
- *
137
- * - `options.controller`: [`DocController`](https://surveyjs.io/pdf-generator/documentation/api-reference/doccontroller)\
138
- * An object that provides access to main PDF document properties (font, margins, page width and height) and allows you to modify them.
139
- *
140
- * - `options.repository`: `FlatRepository`\
141
- * A repository with classes that render elements to PDF. Use its `create` method if you need to create a new instance of a rendering class.
142
- *
143
- * [View Demo](https://surveyjs.io/pdf-generator/examples/how-to-use-adorners-in-pdf-forms/ (linkStyle))
144
- */
145
- onRenderPage: EventAsync<SurveyPDF, AdornersPageOptions>;
146
- onDocControllerCreated: EventBase<SurveyPDF, {
147
- controller: DocController;
148
- }>;
149
- onRenderCheckItemAcroform: EventAsync<SurveyPDF, any>;
150
- onRenderRadioGroupWrapAcroform: EventAsync<SurveyPDF, any>;
151
- onRenderRadioItemAcroform: EventAsync<SurveyPDF, any>;
152
- getUpdatedCheckItemAcroformOptions(options: any): void;
153
- getUpdatedRadioGroupWrapOptions(options: any): void;
154
- getUpdatedRadioItemAcroformOptions(options: any): void;
155
- protected renderSurvey(controller: DocController): Promise<void>;
156
- /**
157
- * An asynchronous method that starts download of the generated PDF file in the web browser.
158
- *
159
- * @param fileName *(Optional)* A file name with the ".pdf" extension. Default value: `"survey_result.pdf"`.
160
- */
161
- save(fileName?: string): Promise<any>;
162
- /**
163
- * An asynchronous method that allows you to get PDF content in different formats.
164
- *
165
- * [View Demo](https://surveyjs.io/pdf-generator/examples/convert-pdf-form-blob-base64-raw-pdf-javascript/ (linkStyle))
166
- *
167
- * @param type *(Optional)* One of `"blob"`, `"bloburl"`, `"dataurlstring"`. Do not specify this parameter if you want to get raw PDF content as a string value.
168
- *
169
- */
170
- raw(type?: string): Promise<string>;
171
- }
172
-
173
- export type IBorderDescription = IRect & ISize & Pick<PdfBrick, 'formBorderColor'> & {
174
- rounded?: boolean;
175
- dashStyle?: {
176
- dashArray: [number, number] | [number];
177
- dashPhase: number;
178
- };
179
- outside?: boolean;
180
- };
181
- export declare class SurveyHelper {
182
- static EPSILON: number;
183
- static TITLE_SURVEY_FONT_SIZE_SCALE: number;
184
- static TITLE_PAGE_FONT_SIZE_SCALE: number;
185
- static TITLE_PANEL_FONT_SIZE_SCALE: number;
186
- static DESCRIPTION_FONT_SIZE_SCALE: number;
187
- static OTHER_ROWS_COUNT: number;
188
- static RATING_MIN_WIDTH: number;
189
- static RATING_MIN_HEIGHT: number;
190
- static RATING_COLUMN_WIDTH: number;
191
- static MATRIX_COLUMN_WIDTH: number;
192
- static IMAGEPICKER_COUNT: number;
193
- static IMAGEPICKER_RATIO: number;
194
- static MULTIPLETEXT_TEXT_PERS: number;
195
- static HTML_TAIL_TEXT_SCALE: number;
196
- static SELECT_ITEM_FLAT_SCALE: number;
197
- static GAP_BETWEEN_ROWS: number;
198
- static GAP_BETWEEN_COLUMNS: number;
199
- static GAP_BETWEEN_ITEM_TEXT: number;
200
- static FORM_BORDER_VISIBLE: boolean;
201
- static BORDER_SCALE: number;
202
- static VISIBLE_BORDER_SCALE: number;
203
- static UNVISIBLE_BORDER_SCALE: number;
204
- static RADIUS_SCALE: number;
205
- static TITLE_FONT_SCALE: number;
206
- static VALUE_READONLY_PADDING_SCALE: number;
207
- static HTML_TO_IMAGE_QUALITY: number;
208
- static FORM_BORDER_COLOR: string;
209
- static TEXT_COLOR: string;
210
- static BACKGROUND_COLOR: string;
211
- static TITLE_LOCATION_MATRIX: string;
212
- static STANDARD_FONT: string;
213
- static CUSTOM_FONT_ENCODING: string;
214
- static parseWidth(width: string, maxWidth: number, columnsCount?: number, defaultUnit?: string): number;
215
- static pxToPt(value: number | string): number;
216
- static mergeRects(...rects: IRect[]): IRect;
217
- static createPoint(rect: IRect, isLeft?: boolean, isTop?: boolean): IPoint;
218
- static createRect(point: IPoint, width: number, height: number): IRect;
219
- static createHeaderRect(controller: DocController): IRect;
220
- static createFooterRect(controller: DocController): IRect;
221
- static chooseHtmlFont(controller: DocController): string;
222
- static generateCssTextRule(fontSize: number, fontStyle: string, fontName: string): string;
223
- static createHtmlContainerBlock(html: string, controller: DocController, renderAs: IHTMLRenderType): string;
224
- static splitHtmlRect(controller: DocController, htmlBrick: IPdfBrick): IPdfBrick;
225
- static createPlainTextFlat<T extends IPdfBrick>(point: IPoint, question: IQuestion, controller: DocController, text: string, fabric: new (question: IQuestion, controller: DocController, rect: IRect, text: string) => T): CompositeBrick;
226
- static createTextFlat<T extends IPdfBrick>(point: IPoint, question: IQuestion, controller: DocController, text: string | LocalizableString, fabric: new (question: IQuestion, controller: DocController, rect: IRect, text: string) => T): Promise<IPdfBrick>;
227
- static createHTMLRect(point: IPoint, controller: DocController, margins: {
228
- top: number;
229
- bottom: number;
230
- width: number;
231
- }, resultY: number): IRect;
232
- static createHTMLFlat(point: IPoint, question: Question, controller: DocController, html: string): Promise<IPdfBrick>;
233
- static generateFontFace(fontName: string, fontBase64: string, fontWeight: string): string;
234
- static generateFontFaceWithItalicStyle(fontName: string, fontBase64: string, fontWeight: string): string;
235
- static htmlToXml(html: string): string;
236
- static createSvgContent(html: string, width: number, controller: DocController): {
237
- svg: string;
238
- divWidth: number;
239
- divHeight: number;
240
- };
241
- static htmlToImage(html: string, width: number, controller: DocController): Promise<{
242
- url: string;
243
- aspect: number;
244
- }>;
245
- static createBoldTextFlat(point: IPoint, question: Question, controller: DocController, text: string | LocalizableString): Promise<IPdfBrick>;
246
- static createTitleFlat(point: IPoint, question: Question, controller: DocController): Promise<IPdfBrick>;
247
- static createTitleSurveyFlat(point: IPoint, controller: DocController, text: string | LocalizableString): Promise<IPdfBrick>;
248
- static createTitlePanelFlat(point: IPoint, controller: DocController, text: string | LocalizableString, isPage?: boolean): Promise<IPdfBrick>;
249
- static createDescFlat(point: IPoint, question: IQuestion, controller: DocController, text: string | LocalizableString): Promise<IPdfBrick>;
250
- static getReadonlyRenderAs(question: Question, controller: DocController): 'auto' | 'text' | 'acroform';
251
- static createCommentFlat(point: IPoint, question: Question, controller: DocController, isQuestion: boolean, options?: {
252
- rows?: number;
253
- index?: number;
254
- value?: string;
255
- readOnly?: boolean;
256
- }): Promise<IPdfBrick>;
257
- static getQuestionOrCommentValue(question: Question, isQuestion?: boolean): string;
258
- static getQuestionOrCommentDisplayValue(question: Question, isQuestion?: boolean): string;
259
- static inBrowser: boolean;
260
- static get hasDocument(): boolean;
261
- static getImageBase64(imageLink: string): Promise<string>;
262
- static shouldConvertImageToPng: boolean;
263
- static getImageLink(controller: DocController, imageOptions: {
264
- link: string;
265
- width: number;
266
- height: number;
267
- objectFit?: string;
268
- }, applyImageFit: boolean): Promise<string>;
269
- static createImageFlat(point: IPoint, question: any, controller: DocController, imageOptions: {
270
- link: string;
271
- width: number;
272
- height: number;
273
- objectFit?: string;
274
- }, applyImageFit?: boolean): Promise<IPdfBrick>;
275
- static canPreviewImage(question: QuestionFileModel, item: {
276
- name: string;
277
- type: string;
278
- content: string;
279
- }, url: string): boolean;
280
- static getImageSize(url: string): Promise<ISize>;
281
- static createRowlineFlat(point: IPoint, controller: DocController, width?: number, color?: string): IPdfBrick;
282
- static createLinkFlat(point: IPoint, question: Question, controller: DocController, text: string, link: string): Promise<IPdfBrick>;
283
- static createAcroformRect(rect: IRect): number[];
284
- static createTextFieldRect(point: IPoint, controller: DocController, lines?: number): IRect;
285
- static createReadOnlyTextFieldTextFlat(point: IPoint, controller: DocController, question: Question, value: string): Promise<IPdfBrick>;
286
- static renderFlatBorders(controller: DocController, borderOptions: IBorderDescription): void;
287
- static getLocString(text: LocalizableString): string;
288
- static getDropdownQuestionValue(question: Question): string;
289
- static getContentQuestion(question: Question): Question;
290
- static getContentQuestionTypeRenderAs(question: Question, survey: SurveyPDF): string;
291
- static getContentQuestionType(question: Question, survey: SurveyPDF): string;
292
- static getRatingMinWidth(controller: DocController): number;
293
- static getRatingItemText(question: QuestionRatingModel, index: number, locText: LocalizableString): LocalizableString;
294
- static getPageAvailableWidth(controller: DocController): number;
295
- static getImagePickerAvailableWidth(controller: DocController): number;
296
- static getColumnWidth(controller: DocController, colCount: number): number;
297
- static setColumnMargins(controller: DocController, colCount: number, column: number): void;
298
- static moveRect(rect: IRect, left?: number, top?: number): IRect;
299
- static scaleRect(rect: IRect, scale: number): IRect;
300
- static getBorderWidth(controller: DocController): number;
301
- static formScale(controller: DocController, flat: ISize): number;
302
- static generateQuestionFlats(survey: SurveyPDF, controller: DocController, question: Question, point: IPoint): Promise<IPdfBrick[]>;
303
- static isFontExist(controller: DocController, fontName: string): boolean;
304
- static isCustomFont(controller: DocController, fontName: string): boolean;
305
- static fixFont(controller: DocController): void;
306
- static clone(src: any): any;
307
- static shouldRenderReadOnly(question: IQuestion, controller: DocController, readOnly?: boolean): boolean;
308
- static isSizeEmpty(val: any): boolean;
309
- static isHeightEmpty(val: any): boolean;
310
- static getCorrectedImageSize(controller: DocController, imageOptions: {
311
- imageWidth?: any;
312
- imageHeight?: any;
313
- imageLink: string;
314
- defaultImageWidth?: any;
315
- defaultImageHeight?: any;
316
- }): Promise<ISize>;
317
- }
318
-
319
- import './jspdf_plugins/acroform.js';
320
- import './jspdf_plugins/from_html.js';
321
- export interface IPoint {
322
- /**
323
- * An X-coordinate for the left element edge.
324
- */
325
- xLeft: number;
326
- /**
327
- * A Y-coordinate for the top element edge.
328
- */
329
- yTop: number;
330
- }
331
- /**
332
- * An interface that describes a rectangle.
333
- */
334
- export interface IRect extends IPoint {
335
- /**
336
- * An X-coordinate for the right element edge.
337
- */
338
- xRight: number;
339
- /**
340
- * A Y-coordinate for the bottom element edge.
341
- */
342
- yBot: number;
343
- }
344
- export interface ISize {
345
- width: number;
346
- height: number;
347
- }
348
- export interface IMarginLR {
349
- /**
350
- * A left margin.
351
- */
352
- left?: number;
353
- /**
354
- * A right margin.
355
- */
356
- right?: number;
357
- }
358
- /**
359
- * An interface that describes margins.
360
- */
361
- export interface IMargin extends IMarginLR {
362
- /**
363
- * A top margin.
364
- */
365
- top?: number;
366
- /**
367
- * A bottom margin.
368
- */
369
- bot?: number;
370
- }
371
- /**
372
- * PDF document configuration. Pass it as the second argument to the `SurveyPDF` constructor:
373
- *
374
- * ```js
375
- * const surveyPdf = new SurveyPDF.SurveyPDF(surveyJson, pdfDocOptions);
376
- *
377
- * // In modular applications:
378
- import { SurveyPDF } from "survey-pdf";
379
- * const surveyPdf = new SurveyPDF(surveyJson, pdfDocOptions);
380
- * ```
381
- */
382
- export interface IDocOptions {
383
- /**
384
- * Page orientation.
385
- *
386
- * Possible values:
387
- *
388
- * - `"p"` (default) - Portrait orientation.
389
- * - `"l"` - Landscape orientation.
390
- *
391
- * @see format
392
- */
393
- orientation?: 'p' | 'l';
394
- /**
395
- * Page format.
396
- *
397
- * Possible values:
398
- *
399
- * - `"a0"` - `"a10"` (`"a4"` is default)
400
- * - `"b0"` - `"b10"`
401
- * - `"c0"` - `"c10"`
402
- * - `"dl"`
403
- * - `"letter"`
404
- * - `"government-letter"`
405
- * - `"legal"`
406
- * - `"junior-legal"`
407
- * - `"ledger"`
408
- * - `"tabloid"`
409
- * - `"credit-card"`
410
- * - Array<number> - custom page size in millimeters, for example, `[210, 297]`.
411
- *
412
- * @see orientation
413
- */
414
- format?: string | number[];
415
- /**
416
- * Font size in points.
417
- *
418
- * Default value: 14
419
- *
420
- * @see fontName
421
- */
422
- fontSize?: number;
423
- /**
424
- * Font name.
425
- *
426
- * Possible values:
427
- *
428
- * - `"Helvetica"` (default)
429
- * - `"Courier"`
430
- * - `"Times"`
431
- * - `"Symbol"`
432
- * - `"ZapfDingbats"`
433
- * - [Custom font name](https://surveyjs.io/Documentation/Pdf-Export?id=Customization-ChangeFonts#use-custom-font)
434
- *
435
- * [View Demo](https://surveyjs.io/pdf-generator/examples/change-font-in-pdf-form/ (linkStyle))
436
- * @see fontSize
437
- */
438
- fontName?: string;
439
- base64Normal?: string;
440
- base64Bold?: string;
441
- /**
442
- * Specifies whether to apply a custom font to [HTML questions](https://surveyjs.io/form-library/examples/questiontype-html/).
443
- *
444
- * Default value: `false`
445
- *
446
- * [View Demo](https://surveyjs.io/pdf-generator/examples/change-font-in-pdf-form/ (linkStyle))
447
- * @see htmlRenderAs
448
- */
449
- useCustomFontInHtml?: boolean;
450
- /**
451
- * Page margins. Set this property to an object with the following fields: `top`, `bot`, `left`, `right`.
452
- */
453
- margins?: IMargin;
454
- /**
455
- * Specifies how to render [HTML questions](https://surveyjs.io/Documentation/Library?id=questionhtmlmodel) into PDF.
456
- *
457
- * Possible values:
458
- *
459
- * - `"standard"` - Render HTML questions as selectable text.
460
- * - `"image"` - Render HTML questions as images.
461
- * - `"auto"` (default) - Select between the `"standard"` and `"image"` modes automatically based on the HTML content.
462
- *
463
- * 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.
464
- * @see useCustomFontInHtml
465
- */
466
- htmlRenderAs?: IHTMLRenderType;
467
- /**
468
- * 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.
469
- *
470
- * Possible values:
471
- *
472
- * - `"list"` - Render matrix-like questions as lists.
473
- * - `"auto"` (default) - Render matrix-like questions as tables if they fit into the available space. Otherwise, render the questions as lists.
474
- *
475
- * You can override this property for an individual matrix-like question. Set the question's `renderAs` property to `"list"` in the survey JSON schema.
476
- */
477
- matrixRenderAs?: 'auto' | 'list';
478
- useLegacyBooleanRendering?: boolean;
479
- /**
480
- * Specifies how to render read-only questions.
481
- *
482
- * Possible values:
483
- *
484
- * - `"text"` - Render read-only questions as plain text and custom primitives.
485
- * - `"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.
486
- * - `"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.
487
- */
488
- readonlyRenderAs?: 'auto' | 'text' | 'acroform';
489
- textFieldRenderAs?: 'singleLine' | 'multiLine';
490
- /**
491
- * 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).
492
- *
493
- * Default value: `false`
494
- */
495
- compress?: boolean;
496
- /**
497
- * Specifies whether to apply `imageFit` settings specified in the survey JSON schema to exported images.
498
- *
499
- * Default value: `false`
500
- *
501
- * This property applies the following settings:
502
- *
503
- * - [`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
504
- * - [`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
505
- * - [`logoFit`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#logoFit) to an exported logo in the survey header
506
- *
507
- * 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.
508
- */
509
- applyImageFit?: boolean;
510
- /**
511
- * Specifies whether the PDF document contains text in right-to-left languages.
512
- *
513
- * Default value: `false`
514
- */
515
- isRTL?: boolean;
516
- /**
517
- * 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.
518
- *
519
- * Default value: `false` (include all choices)
520
- */
521
- tagboxSelectedChoicesOnly?: boolean;
522
- }
523
- export declare class DocOptions implements IDocOptions {
524
- static readonly MM_TO_PT: number;
525
- static readonly FONT_SIZE = 14;
526
- protected _orientation: 'l' | 'p';
527
- protected _format: string | number[];
528
- protected _fontSize: number;
529
- protected _fontName: string;
530
- static SEGOE_NORMAL: string;
531
- static SEGOE_BOLD: string;
532
- protected _base64Normal: string;
533
- protected _base64Bold: string;
534
- protected _useCustomFontInHtml: boolean;
535
- protected _margins: IMargin;
536
- protected _htmlRenderAs: IHTMLRenderType;
537
- protected _matrixRenderAs: 'auto' | 'list';
538
- protected _readonlyRenderAs: 'auto' | 'text' | 'acroform';
539
- protected _compress: boolean;
540
- protected _applyImageFit: boolean;
541
- protected _useLegacyBooleanRendering: boolean;
542
- protected _isRTL: boolean;
543
- protected _tagboxSelectedChoicesOnly: boolean;
544
- constructor(options: IDocOptions);
545
- get leftTopPoint(): IPoint;
546
- get fontSize(): number;
547
- get fontName(): string;
548
- get base64Normal(): string;
549
- get base64Bold(): string;
550
- get useCustomFontInHtml(): boolean;
551
- get margins(): IMargin;
552
- get format(): string | number[];
553
- get orientation(): 'l' | 'p';
554
- get htmlRenderAs(): IHTMLRenderType;
555
- get matrixRenderAs(): 'auto' | 'list';
556
- get readonlyRenderAs(): 'auto' | 'text' | 'acroform';
557
- get compress(): boolean;
558
- get applyImageFit(): boolean;
559
- get useLegacyBooleanRendering(): boolean;
560
- get isRTL(): boolean;
561
- get tagboxSelectedChoicesOnly(): boolean;
562
- }
563
- /**
564
- * 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.
565
- *
566
- * [View Demo](https://surveyjs.io/pdf-generator/examples/how-to-use-adorners-in-pdf-forms/ (linkStyle))
567
- */
568
- export declare class DocController extends DocOptions {
569
- constructor(options?: IDocOptions);
570
- static customFonts: {
571
- [name: string]: {
572
- normal: string;
573
- bold: string;
574
- italic: string;
575
- bolditalic: string;
576
- };
577
- };
578
- static addFont(fontName: string, base64: string, fontStyle: 'normal' | 'bold' | 'italic' | 'bolditalic'): void;
579
- get doc(): any;
580
- get helperDoc(): any;
581
- get fontName(): string;
582
- set fontName(fontName: string);
583
- get fontSize(): number;
584
- set fontSize(fontSize: number);
585
- get fontStyle(): string;
586
- set fontStyle(fontStyle: string);
587
- measureText(text?: string | LocalizableString | number, fontStyle?: string, fontSize?: number): ISize;
588
- /**
589
- * The width of one character in pixels.
590
- */
591
- get unitWidth(): number;
592
- /**
593
- * The heigth of one character in pixels.
594
- */
595
- get unitHeight(): number;
596
- pushMargins(left?: number, right?: number): void;
597
- popMargins(): void;
598
- /**
599
- * The width of a PDF page in pixels.
600
- */
601
- get paperWidth(): number;
602
- /**
603
- * The height of a PDF page in pixels.
604
- */
605
- get paperHeight(): number;
606
- getNumberOfPages(): number;
607
- addPage(): void;
608
- getCurrentPageIndex(): number;
609
- setPage(index: number): void;
610
- }
611
-
612
- export type FlatConstructor = new (survey: SurveyPDF, question: IQuestion, controller: DocController) => IFlatQuestion;
613
- export declare class FlatRepository {
614
- static getInstance(): FlatRepository;
615
- register(modelType: string, rendererConstructor: FlatConstructor): void;
616
- isTypeRegistered(type: string): boolean;
617
- getRenderer(type: string): FlatConstructor;
618
- create(survey: SurveyPDF, question: Question, docController: DocController, type?: string): IFlatQuestion;
619
- static register(type: string, rendererConstructor: FlatConstructor): void;
620
- static getRenderer(type: string): FlatConstructor;
621
- }
622
-
623
- export interface IFlatQuestion {
624
- generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
625
- generateFlats(point: IPoint): Promise<IPdfBrick[]>;
626
- }
627
- export declare class FlatQuestion implements IFlatQuestion {
628
- protected survey: SurveyPDF;
629
- protected controller: DocController;
630
- static CONTENT_GAP_VERT_SCALE: number;
631
- static CONTENT_GAP_HOR_SCALE: number;
632
- static CONTENT_INDENT_SCALE: number;
633
- static DESC_GAP_SCALE: number;
634
- protected question: Question;
635
- constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
636
- generateFlatsComposite(point: IPoint): Promise<IPdfBrick[]>;
637
- generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
638
- generateFlatsContentWithOptionalElements(point: IPoint): Promise<IPdfBrick[]>;
639
- generateFlats(point: IPoint): Promise<IPdfBrick[]>;
640
- protected get shouldRenderAsComment(): boolean;
641
- }
642
-
643
- export declare class FlatQuestionDefault extends FlatQuestion {
644
- generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
645
- }
646
-
647
- export declare class FlatBooleanCheckbox extends FlatQuestion {
648
- protected survey: SurveyPDF;
649
- protected controller: DocController;
650
- protected question: QuestionBooleanModel;
651
- constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
652
- generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
653
- }
654
- export declare class FlatBoolean extends FlatRadiogroup {
655
- protected survey: SurveyPDF;
656
- protected controller: DocController;
657
- constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
658
- protected getVisibleChoices(): Array<ItemValue>;
659
- protected getColCount(): number;
660
- }
661
-
662
- export declare class FlatCheckbox extends FlatSelectBase {
663
- protected survey: SurveyPDF;
664
- protected controller: DocController;
665
- protected question: QuestionCheckboxModel;
666
- constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
667
- generateFlatItem(rect: IRect, item: ItemValue, index: number): IPdfBrick;
668
- }
669
- export declare class FlatTagbox extends FlatCheckbox {
670
- protected survey: SurveyPDF;
671
- protected controller: DocController;
672
- protected question: QuestionTagboxModel;
673
- constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
674
- protected getVisibleChoices(): Array<ItemValue>;
675
- }
676
-
677
- export declare class FlatCustomModel extends FlatQuestion {
678
- protected survey: SurveyPDF;
679
- protected controller: DocController;
680
- constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
681
- generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
682
- }
683
-
684
- export declare class FlatComment extends FlatQuestion {
685
- protected survey: SurveyPDF;
686
- protected controller: DocController;
687
- protected question: QuestionCommentModel;
688
- constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
689
- generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
690
- }
691
-
692
- export declare class FlatDropdown extends FlatQuestion {
693
- protected survey: SurveyPDF;
694
- protected controller: DocController;
695
- protected question: QuestionDropdownModel;
696
- constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
697
- generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
698
- }
699
-
700
- export declare class FlatExpression extends FlatQuestion {
701
- protected survey: SurveyPDF;
702
- protected question: QuestionExpressionModel;
703
- constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
704
- generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
705
- }
706
-
707
- export declare class FlatFile extends FlatQuestion {
708
- protected survey: SurveyPDF;
709
- static readonly IMAGE_GAP_SCALE: number;
710
- static readonly TEXT_MIN_SCALE: number;
711
- static DEFAULT_IMAGE_FIT: string;
712
- protected question: QuestionFileModel;
713
- constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
714
- generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
715
- }
716
-
717
- export type IHTMLRenderType = 'auto' | 'standard' | 'image';
718
- export declare class FlatHTML extends FlatQuestion {
719
- protected survey: SurveyPDF;
720
- protected question: QuestionHtmlModel;
721
- constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
722
- protected correctHtml(html: string): string;
723
- generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
724
- }
725
-
726
- export declare class FlatImage extends FlatQuestion {
727
- protected survey: SurveyPDF;
728
- protected question: QuestionImageModel;
729
- constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
730
- generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
731
- }
732
-
733
- export declare class FlatImagePicker extends FlatQuestion {
734
- protected survey: SurveyPDF;
735
- protected question: QuestionImagePickerModel;
736
- protected radio: FlatRadiogroup;
737
- constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
738
- generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
739
- }
740
-
741
- export declare class FlatPanelDynamic extends FlatQuestion {
742
- protected survey: SurveyPDF;
743
- protected controller: DocController;
744
- protected question: QuestionPanelDynamicModel;
745
- static readonly GAP_BETWEEN_PANELS: number;
746
- constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
747
- generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
748
- }
749
-
750
- export declare class FlatRadiogroup extends FlatSelectBase {
751
- protected survey: SurveyPDF;
752
- protected controller: DocController;
753
- protected question: QuestionRadiogroupModel;
754
- constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
755
- protected isItemSelected(item: ItemValue, checked?: boolean): boolean;
756
- generateFlatItem(rect: IRect, item: ItemValue, index: number, key?: string, checked?: boolean, context?: any): IPdfBrick;
757
- }
758
-
759
- export declare class FlatRanking extends FlatQuestion {
760
- protected survey: SurveyPDF;
761
- protected controller: DocController;
762
- protected question: QuestionRankingModel;
763
- constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
764
- protected generateFlatComposite(point: IPoint, item: ItemValue, index: number, unrankedItem?: boolean): Promise<IPdfBrick>;
765
- generateChoicesColumn(point: IPoint, choices: ItemValue[], unrankedChoices?: boolean): Promise<IPdfBrick[]>;
766
- generateSelectToRankItemsVertically(point: IPoint): Promise<IPdfBrick[]>;
767
- generateSelectToRankItemsHorizontally(point: IPoint): Promise<IPdfBrick[]>;
768
- generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
769
- }
770
-
771
- export declare class FlatRating extends FlatRadiogroup {
772
- protected survey: SurveyPDF;
773
- protected controller: DocController;
774
- protected questionRating: QuestionRatingModel;
775
- constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
776
- protected generateFlatHorisontalComposite(point: IPoint, item: ItemValue, index: number): Promise<IPdfBrick>;
777
- protected generateFlatComposite(point: IPoint, item: ItemValue, index: number): Promise<IPdfBrick>;
778
- protected generateHorisontallyItems(point: IPoint): Promise<CompositeBrick[]>;
779
- generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
780
- }
781
-
782
- export declare abstract class FlatSelectBase extends FlatQuestion {
783
- protected survey: SurveyPDF;
784
- protected controller: DocController;
785
- protected question: QuestionCheckboxBase;
786
- constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
787
- abstract generateFlatItem(rect: IRect, item: ItemValue, index: number): IPdfBrick;
788
- protected generateFlatComposite(point: IPoint, item: ItemValue, index: number): Promise<IPdfBrick>;
789
- protected getVisibleChoices(): Array<ItemValue>;
790
- protected getColCount(): number;
791
- generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
792
- protected generateVerticallyItems(point: IPoint, itemValues: ItemValue[]): Promise<IPdfBrick[]>;
793
- protected generateHorisontallyItems(point: IPoint, colCount: number): Promise<IPdfBrick[]>;
794
- }
795
-
796
- export declare class FlatSignaturePad extends FlatQuestion {
797
- protected survey: SurveyPDF;
798
- protected question: QuestionSignaturePadModel;
799
- static BORDER_STYLE: 'dashed' | 'solid' | 'none';
800
- constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
801
- generateBackgroundImage(point: IPoint): Promise<IPdfBrick>;
802
- generateSign(point: IPoint): Promise<IPdfBrick>;
803
- generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
804
- }
805
-
806
- export declare class FlatTextbox extends FlatQuestion {
807
- protected survey: SurveyPDF;
808
- static readonly MULTILINE_TEXT_ROWS_COUNT: number;
809
- protected question: QuestionTextModel;
810
- constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
811
- generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
812
- }
813
-
814
- export declare class FlatSurvey {
815
- static QUES_GAP_VERT_SCALE: number;
816
- static PANEL_CONT_GAP_SCALE: number;
817
- static PANEL_DESC_GAP_SCALE: number;
818
- static generateFlatsPanel(survey: SurveyPDF, controller: DocController, panel: PanelModel, point: IPoint): Promise<IPdfBrick[]>;
819
- static generateFlats(survey: SurveyPDF, controller: DocController): Promise<IPdfBrick[][]>;
820
- }
821
-
822
- export declare class FlatMatrix extends FlatQuestion {
823
- protected survey: SurveyPDF;
824
- protected controller: DocController;
825
- static readonly GAP_BETWEEN_ROWS: number;
826
- protected question: QuestionMatrixModel;
827
- constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
828
- protected generateFlatsHeader(point: IPoint): Promise<IPdfBrick[]>;
829
- protected generateFlatsRows(point: IPoint, isVertical: boolean): Promise<IPdfBrick[]>;
830
- generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
831
- }
832
- export declare class FlatMatrixRow extends FlatRadiogroup {
833
- protected survey: SurveyPDF;
834
- protected controller: DocController;
835
- protected isFirst: boolean;
836
- protected isVertical: boolean;
837
- protected questionMatrix: QuestionMatrixModel;
838
- constructor(survey: SurveyPDF, question: IQuestion, controller: DocController, row: MatrixRowModel, rowIndex: number, key: string, isFirst: boolean, isVertical: boolean, rowTitleWidth: number, columnWidth: number);
839
- generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
840
- protected generateTextComposite(point: IPoint, column: ItemValue, index: number): Promise<IPdfBrick>;
841
- protected generateItemCompoiste(point: IPoint, column: ItemValue, index: number): Promise<IPdfBrick>;
842
- protected generateFlatsHorizontallyCells(point: IPoint): Promise<(IPdfBrick | CompositeBrick)[]>;
843
- protected generateFlatsVerticallyCells(point: IPoint): Promise<IPdfBrick[]>;
844
- }
845
-
846
- export declare class FlatMatrixMultiple extends FlatQuestion {
847
- protected survey: SurveyPDF;
848
- protected isMultiple: boolean;
849
- static readonly GAP_BETWEEN_ROWS: number;
850
- protected question: QuestionMatrixDropdownModelBase;
851
- constructor(survey: SurveyPDF, question: IQuestion, controller: DocController, isMultiple?: boolean);
852
- generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
853
- }
854
-
855
- export declare class FlatMatrixDynamic extends FlatMatrixMultiple {
856
- protected survey: SurveyPDF;
857
- constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
858
- }
859
-
860
- export declare class FlatMultipleText extends FlatQuestion {
861
- protected survey: SurveyPDF;
862
- protected controller: DocController;
863
- static readonly ROWS_GAP_SCALE: number;
864
- protected question: QuestionMultipleTextModel;
865
- constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
866
- generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
867
- }
868
-
869
- export declare class PagePacker {
870
- static pack(flats: IPdfBrick[][], controller: DocController): IPdfBrick[][];
871
- }
872
-
873
- export declare class EventAsync<Sender, Options> extends EventBase<Sender, Options> {
874
- unshift(func: (sender: Sender, options: Options) => any): void;
875
- fire(sender: Sender, options: Options): Promise<void>;
876
- }
877
- export declare class EventHandler {
878
- static process_header_events(survey: SurveyPDF, controller: DocController, packs: IPdfBrick[][]): Promise<void>;
879
- }
880
-
881
- /**
882
- * Horizontal alignment types in onRenderHeader and onRenderFooter events
883
- */
884
- export declare enum HorizontalAlign {
885
- NotSet = "notset",
886
- Left = "left",
887
- Center = "center",
888
- Right = "right"
889
- }
890
- /**
891
- * Vertical alignment types in onRenderHeader and onRenderFooter events
892
- */
893
- export declare enum VerticalAlign {
894
- NotSet = "notset",
895
- Top = "top",
896
- Middle = "middle",
897
- Bottom = "bottom"
898
- }
899
- export interface IDrawRectOptions {
900
- /**
901
- * Horizontal alignment within the rectangle that limits the drawing area.
902
- *
903
- * Possible values:
904
- *
905
- * - `"center"` (default)
906
- * - `"left"`
907
- * - `"right"`
908
- */
909
- horizontalAlign?: HorizontalAlign;
910
- /**
911
- * Vertical alignment within the rectangle that limits the drawing area.
912
- *
913
- * Possible values:
914
- *
915
- * - `"middle"` (default)
916
- * - `"top"`
917
- * - `"bottom"`
918
- */
919
- verticalAlign?: VerticalAlign;
920
- /**
921
- * 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.
922
- */
923
- margins?: IMargin;
924
- /**
925
- * An object with coordinates of the rectangle.
926
- */
927
- rect?: IRect;
928
- }
929
- /**
930
- * An object that configures rendering a piece of text.
931
- */
932
- export interface IDrawTextOptions extends IDrawRectOptions {
933
- /**
934
- * A text string to be drawn.
935
- */
936
- text: string;
937
- /**
938
- * Font size in points.
939
- *
940
- * Default value: 14
941
- */
942
- fontSize?: number;
943
- /**
944
- * Enable this property to render the text string bold.
945
- *
946
- * Default value: `false`
947
- */
948
- isBold?: boolean;
949
- }
950
- /**
951
- * An object that configures rendering an image.
952
- */
953
- export interface IDrawImageOptions extends IDrawRectOptions {
954
- /**
955
- * An image width in pixels. Defaults to the [rectangle width](https://surveyjs.io/pdf-generator/documentation/api-reference/idrawimageoptions#rect).
956
- */
957
- width?: number;
958
- /**
959
- * An image height in pixels. Defaults to the [rectangle height](https://surveyjs.io/pdf-generator/documentation/api-reference/idrawimageoptions#rect).
960
- */
961
- height?: number;
962
- /**
963
- * A string value with a base64-encoded image to be drawn.
964
- */
965
- base64: string;
966
- /**
967
- * Specifies how to resize the image to fit it into its container.
968
- *
969
- * Default value: `"contain"` if [`applyImageFit`](https://surveyjs.io/pdf-generator/documentation/api-reference/idocoptions#applyImageFit) is enabled or `undefined` if not.
970
- *
971
- * Refer to the [`object-fit`](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit) CSS property description for information on accepted values.
972
- */
973
- imageFit?: string;
974
- }
975
- /**
976
- * 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.
977
- *
978
- * [View Demo](https://surveyjs.io/pdf-generator/examples/customize-header-and-footer-of-pdf-form/ (linkStyle))
979
- */
980
- export declare class DrawCanvas {
981
- protected packs: IPdfBrick[];
982
- controller: DocController;
983
- protected _rect: IRect;
984
- protected _countPages: number;
985
- protected _pageNumber: number;
986
- constructor(packs: IPdfBrick[], controller: DocController, _rect: IRect, _countPages: number, _pageNumber: number);
987
- /**
988
- * A total number of pages in the document.
989
- */
990
- get pageCount(): number;
991
- get countPages(): number;
992
- /**
993
- * The number of the page that contains the drawing area. Enumeration starts with 1.
994
- */
995
- get pageNumber(): number;
996
- /**
997
- * An object with coordinates of a rectangle that limits the drawing area. This object contain the following fields: `xLeft`, `xRight`, `yTop`, `yBot`.
998
- */
999
- get rect(): IRect;
1000
- /**
1001
- * Draws a piece of text within the drawing area.
1002
- * @param textOptions An [`IDrawTextOptions`](https://surveyjs.io/pdf-generator/documentation/api-reference/idrawtextoptions) object that configures the drawing.
1003
- */
1004
- drawText(textOptions: IDrawTextOptions): void;
1005
- /**
1006
- * Draws an image within the drawing area.
1007
- * @param imageOptions An [`IDrawImageOptions`](https://surveyjs.io/pdf-generator/documentation/api-reference/idrawimageoptions) object that configures drawing.
1008
- */
1009
- drawImage(imageOptions: IDrawImageOptions): Promise<void>;
1010
- }
1011
-
1012
- export type TranslateXFunction = (xLeft: number, xRight: number) => {
1013
- xLeft: number;
1014
- xRight: number;
1015
- };
1016
- export interface IPdfBrick extends IRect, ISize {
1017
- render(): Promise<void>;
1018
- unfold(): IPdfBrick[];
1019
- translateX(func: TranslateXFunction): void;
1020
- isPageBreak: boolean;
1021
- }
1022
- /**
1023
- * An object that describes a PDF brick&mdash;a simple element with specified content, size, and location. Bricks are fundamental elements used to construct a PDF document.
1024
- *
1025
- * You can access `PdfBrick` objects within functions that handle `SurveyPDF`'s [`onRenderQuestion`](https://surveyjs.io/pdf-generator/documentation/api-reference/surveypdf#onRenderQuestion), [`onRenderPanel`](https://surveyjs.io/pdf-generator/documentation/api-reference/surveypdf#onRenderPanel), and [`onRenderPage`](https://surveyjs.io/pdf-generator/documentation/api-reference/surveypdf#onRenderPage) events.
1026
- *
1027
- * [View Demo](https://surveyjs.io/pdf-generator/examples/add-markup-to-customize-pdf-forms/ (linkStyle))
1028
- */
1029
- export declare class PdfBrick implements IPdfBrick {
1030
- protected question: IQuestion;
1031
- protected controller: DocController;
1032
- protected _xLeft: number;
1033
- protected _xRight: number;
1034
- protected _yTop: number;
1035
- protected _yBot: number;
1036
- /**
1037
- * An X-coordinate for the left brick edge.
1038
- */
1039
- get xLeft(): number;
1040
- set xLeft(val: number);
1041
- /**
1042
- * An X-coordinate for the right brick edge.
1043
- */
1044
- get xRight(): number;
1045
- set xRight(val: number);
1046
- /**
1047
- * A Y-coordinate for the top brick edge.
1048
- */
1049
- get yTop(): number;
1050
- set yTop(val: number);
1051
- /**
1052
- * A Y-coordinate for the bottom brick edge.
1053
- */
1054
- get yBot(): number;
1055
- set yBot(val: number);
1056
- /**
1057
- * Font size in points.
1058
- *
1059
- * Default value: 14 (inherited from the parent PDF document)
1060
- */
1061
- fontSize: number;
1062
- /**
1063
- * The color of text within the brick.
1064
- *
1065
- * Default value: `"#404040"`
1066
- */
1067
- textColor: string;
1068
- formBorderColor: string;
1069
- isPageBreak: boolean;
1070
- constructor(question: IQuestion, controller: DocController, rect: IRect);
1071
- translateX(func: TranslateXFunction): void;
1072
- /**
1073
- * The brick's width in pixels.
1074
- */
1075
- get width(): number;
1076
- /**
1077
- * The brick's height in pixels.
1078
- */
1079
- get height(): number;
1080
- protected getShouldRenderReadOnly(): boolean;
1081
- afterRenderCallback: () => void;
1082
- render(): Promise<void>;
1083
- renderInteractive(): Promise<void>;
1084
- renderReadOnly(): Promise<void>;
1085
- /**
1086
- * Allows you to get a flat array of nested PDF bricks.
1087
- * @returns A flat array of nested PDF bricks.
1088
- */
1089
- unfold(): IPdfBrick[];
1090
- protected getCorrectedText(val: string): string;
1091
- protected setXLeft(val: number): void;
1092
- protected setXRight(val: number): void;
1093
- protected setYTop(val: number): void;
1094
- protected setYBottom(val: number): void;
1095
- }
1096
-
1097
- export declare class BooleanItemBrick extends CheckItemBrick {
1098
- constructor(question: IQuestion, controller: DocController, rect: IRect);
1099
- }
1100
-
1101
- export declare class CheckboxItemBrick extends CheckItemBrick {
1102
- constructor(question: IQuestion, controller: DocController, rect: IRect, item: ItemValue, index: number);
1103
- }
1104
-
1105
- export interface ICheckItemBrickContext {
1106
- question: IQuestion;
1107
- readOnly: boolean;
1108
- checked: boolean;
1109
- item?: ItemValue;
1110
- index?: number;
1111
- }
1112
- export declare class CheckItemBrick extends PdfBrick {
1113
- protected fieldName: string;
1114
- protected context: ICheckItemBrickContext;
1115
- static readonly CHECKMARK_READONLY_FONT_SIZE_SCALE: number;
1116
- protected question: QuestionCheckboxModel;
1117
- constructor(controller: DocController, rect: IRect, fieldName: string, context: ICheckItemBrickContext);
1118
- protected getShouldRenderReadOnly(): boolean;
1119
- renderInteractive(): Promise<void>;
1120
- renderReadOnly(): Promise<void>;
1121
- }
1122
-
1123
- export declare class CommentBrick extends TextBoxBrick {
1124
- protected controller: DocController;
1125
- constructor(question: IQuestion, controller: DocController, rect: IRect, isQuestion: boolean, index?: number);
1126
- protected shouldRenderFlatBorders(): boolean;
1127
- }
1128
-
1129
- export declare class CompositeBrick implements IPdfBrick {
1130
- isPageBreak: boolean;
1131
- constructor(...bricks: IPdfBrick[]);
1132
- get xLeft(): number;
1133
- set xLeft(xLeft: number);
1134
- get xRight(): number;
1135
- set xRight(xRight: number);
1136
- get yTop(): number;
1137
- set yTop(yTop: number);
1138
- get yBot(): number;
1139
- set yBot(yBot: number);
1140
- get width(): number;
1141
- get height(): number;
1142
- render(): Promise<void>;
1143
- get isEmpty(): boolean;
1144
- addBrick(...bricks: IPdfBrick[]): void;
1145
- unfold(): IPdfBrick[];
1146
- translateX(func: TranslateXFunction): void;
1147
- }
1148
-
1149
- export declare class CustomBrick extends PdfBrick {
1150
- constructor(question: IQuestion, controller: DocController, renderFunc: (doc: any, question: any, xLeft: number, yTop: number) => IRect);
1151
- renderInteractive(): Promise<void>;
1152
- }
1153
-
1154
- export declare class DropdownBrick extends PdfBrick {
1155
- protected controller: DocController;
1156
- protected question: QuestionDropdownModel;
1157
- protected isQuestion: boolean;
1158
- protected isMultiline: boolean;
1159
- constructor(question: IQuestion, controller: DocController, rect: IRect);
1160
- renderInteractive(): Promise<void>;
1161
- }
1162
-
1163
- export declare class EmptyBrick extends PdfBrick {
1164
- protected controller: DocController;
1165
- constructor(rect: IRect, controller?: DocController, isBorderVisible?: boolean);
1166
- renderInteractive(): Promise<void>;
1167
- }
1168
-
1169
- export declare class HTMLBrick extends PdfBrick {
1170
- protected html: string;
1171
- constructor(question: IQuestion, controller: DocController, rect: IRect, html: string, isImage?: boolean);
1172
- renderInteractive(): Promise<void>;
1173
- }
1174
-
1175
- export declare class ImageBrick extends PdfBrick {
1176
- protected image: string;
1177
- protected originalWidth: number;
1178
- protected originalHeight: number;
1179
- constructor(question: IQuestion, controller: DocController, image: string, point: IPoint, originalWidth: number, originalHeight: number);
1180
- renderInteractive(): Promise<void>;
1181
- }
1182
-
1183
- export declare class LinkBrick extends TextBrick {
1184
- protected link: string;
1185
- static readonly COLOR: string;
1186
- constructor(textFlat: TextBrick, link: string);
1187
- renderInteractive(): Promise<void>;
1188
- renderReadOnly(): Promise<void>;
1189
- }
1190
-
1191
- export interface IRadiogroupWrapContext {
1192
- question: IQuestion;
1193
- readOnly: boolean;
1194
- }
1195
- export declare class RadioGroupWrap {
1196
- name: string;
1197
- constructor(name: string, controller: DocController, context: IRadiogroupWrapContext);
1198
- addToPdf(color: string): void;
1199
- get radioGroup(): any;
1200
- get readOnly(): boolean;
1201
- }
1202
- export interface IRadioGroupItemBrickContext {
1203
- question: IQuestion;
1204
- checked: boolean;
1205
- index: number;
1206
- item: ItemValue;
1207
- }
1208
- export declare class RadioItemBrick extends PdfBrick {
1209
- static readonly RADIOMARKER_READONLY_FONT_SIZE_SCALE: number;
1210
- constructor(controller: DocController, rect: IRect, context: IRadioGroupItemBrickContext, radioGroupWrap: RadioGroupWrap);
1211
- protected getShouldRenderReadOnly(): boolean;
1212
- renderInteractive(): Promise<void>;
1213
- renderReadOnly(): Promise<void>;
1214
- }
1215
-
1216
- export declare class RankingItemBrick extends PdfBrick {
1217
- protected mark: string;
1218
- protected question: QuestionRankingModel;
1219
- constructor(question: IQuestion, controller: DocController, rect: IRect, mark: string);
1220
- renderInteractive(): Promise<void>;
1221
- }
1222
-
1223
- export declare class RowlineBrick implements IPdfBrick {
1224
- protected controller: DocController;
1225
- protected color: string;
1226
- xLeft: number;
1227
- xRight: number;
1228
- yTop: number;
1229
- yBot: number;
1230
- isPageBreak: boolean;
1231
- constructor(controller: DocController, rect: IRect, color: string);
1232
- get width(): number;
1233
- get height(): number;
1234
- render(): Promise<void>;
1235
- unfold(): IPdfBrick[];
1236
- translateX(_: TranslateXFunction): void;
1237
- }
1238
-
1239
- export declare class TextFieldBrick extends PdfBrick {
1240
- protected isQuestion: boolean;
1241
- protected fieldName: string;
1242
- protected value: string;
1243
- protected placeholder: string;
1244
- isReadOnly: boolean;
1245
- protected isMultiline: boolean;
1246
- protected inputType: string;
1247
- protected question: QuestionTextModel;
1248
- constructor(question: IQuestion, controller: DocController, rect: IRect, isQuestion: boolean, fieldName: string, value: string, placeholder: string, isReadOnly: boolean, isMultiline: boolean, inputType: string);
1249
- renderInteractive(): Promise<void>;
1250
- protected shouldRenderFlatBorders(): boolean;
1251
- protected getShouldRenderReadOnly(): boolean;
1252
- get textBrick(): IPdfBrick;
1253
- set textBrick(val: IPdfBrick);
1254
- renderReadOnly(): Promise<void>;
1255
- unfold(): IPdfBrick[];
1256
- translateX(func: TranslateXFunction): void;
1257
- protected setXLeft(val: number): void;
1258
- protected setXRight(val: number): void;
1259
- protected setYTop(val: number): void;
1260
- protected setYBottom(val: number): void;
1261
- }
1262
-
1263
- export declare class TextBoldBrick extends TextBrick {
1264
- constructor(question: IQuestion, controller: DocController, rect: IRect, text: string);
1265
- renderInteractive(): Promise<void>;
1266
- }
1267
-
1268
- export declare class TextBoxBrick extends TextFieldBrick {
1269
- protected isQuestion: boolean;
1270
- protected isMultiline: boolean;
1271
- constructor(question: IQuestion, controller: DocController, rect: IRect, isQuestion?: boolean, isMultiline?: boolean, index?: number);
1272
- }
1273
-
1274
- export declare class TextBrick extends PdfBrick {
1275
- protected text: string;
1276
- protected align: any;
1277
- constructor(question: IQuestion, controller: DocController, rect: IRect, text: string);
1278
- renderInteractive(): Promise<void>;
1279
- protected alignPoint(rect: IRect): IPoint;
1280
- }
1281
-
1282
- export declare class TitlePanelBrick extends TextBoldBrick {
1283
- protected question: QuestionTextModel;
1284
- constructor(question: IQuestion, controller: DocController, rect: IRect, text: string);
1285
- renderInteractive(): Promise<void>;
1286
- }
1287
-
1288
- export declare class AdornersBaseOptions {
1289
- point: IPoint;
1290
- bricks: IPdfBrick[];
1291
- controller: DocController;
1292
- repository: FlatRepository;
1293
- module: any;
1294
- constructor(point: IPoint, bricks: IPdfBrick[], controller: DocController, repository: FlatRepository, module: any);
1295
- }
1296
- export declare class AdornersOptions extends AdornersBaseOptions {
1297
- question: Question;
1298
- constructor(point: IPoint, bricks: IPdfBrick[], question: Question, controller: DocController, repository: FlatRepository, module: any);
1299
- }
1300
- export declare class AdornersPanelOptions extends AdornersBaseOptions {
1301
- panel: PanelModel;
1302
- constructor(point: IPoint, bricks: IPdfBrick[], panel: PanelModel, controller: DocController, repository: FlatRepository, module: any);
1303
- }
1304
- export declare class AdornersPageOptions extends AdornersBaseOptions {
1305
- page: PageModel;
1306
- constructor(point: IPoint, bricks: IPdfBrick[], page: PageModel, controller: DocController, repository: FlatRepository, module: any);
1307
- }
1308
-
1309
-
1
+ /*Type definitions for SurveyJS PDF library v2.0.0-rc.2
2
+ Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
3
+ Definitions by: Devsoft Baltic OÜ <https://github.com/surveyjs/>
4
+ */
5
+ // Dependencies for this module:
6
+ // ../../../../survey-core
7
+
8
+ import { SurveyModel, EventBase } from 'survey-core';
9
+ import { IQuestion, Question, QuestionRatingModel, QuestionFileModel, LocalizableString } from 'survey-core';
10
+ import { ItemValue, QuestionBooleanModel } from 'survey-core';
11
+ import { QuestionCheckboxModel, QuestionTagboxModel } from 'survey-core';
12
+ import { QuestionCommentModel } from 'survey-core';
13
+ import { QuestionDropdownModel } from 'survey-core';
14
+ import { QuestionExpressionModel } from 'survey-core';
15
+ import { QuestionHtmlModel } from 'survey-core';
16
+ import { QuestionImageModel } from 'survey-core';
17
+ import { QuestionImagePickerModel } from 'survey-core';
18
+ import { QuestionPanelDynamicModel } from 'survey-core';
19
+ import { QuestionRadiogroupModel } from 'survey-core';
20
+ import { QuestionRankingModel } from 'survey-core';
21
+ import { QuestionCheckboxBase } from 'survey-core';
22
+ import { QuestionSignaturePadModel } from 'survey-core';
23
+ import { QuestionTextModel } from 'survey-core';
24
+ import { PanelModel } from 'survey-core';
25
+ import { QuestionMatrixModel, MatrixRowModel } from 'survey-core';
26
+ import { QuestionMatrixDropdownModelBase } from 'survey-core';
27
+ import { QuestionMultipleTextModel } from 'survey-core';
28
+ import { PageModel } from 'survey-core';
29
+
30
+ /**
31
+ * The `SurveyPDF` object enables you to export your surveys and forms to PDF documents.
32
+ *
33
+ * [View Demo](https://surveyjs.io/pdf-generator/examples/ (linkStyle))
34
+ */
35
+ export declare class SurveyPDF extends SurveyModel {
36
+ options: IDocOptions;
37
+ constructor(jsonObject: any, options?: IDocOptions);
38
+ get haveCommercialLicense(): boolean;
39
+ set haveCommercialLicense(val: boolean);
40
+ /**
41
+ * An event that is raised when SurveyJS PDF Generator renders a page header. Handle this event to customize the header.
42
+ *
43
+ * Parameters:
44
+ *
45
+ * - `sender`: `SurveyPDF`\
46
+ * A SurveyPDF instance that raised the event.
47
+ *
48
+ * - `canvas`: [`DrawCanvas`](https://surveyjs.io/pdf-generator/documentation/api-reference/drawcanvas)\
49
+ * An object that you can use to draw text and images in the page header.
50
+ *
51
+ * [View Demo](https://surveyjs.io/pdf-generator/examples/customize-header-and-footer-of-pdf-form/ (linkStyle))
52
+ */
53
+ onRenderHeader: EventAsync<SurveyPDF, DrawCanvas>;
54
+ /**
55
+ * An event that is raised when SurveyJS PDF Generator renders a page footer. Handle this event to customize the footer.
56
+ *
57
+ * Parameters:
58
+ *
59
+ * - `sender`: `SurveyPDF`\
60
+ * A SurveyPDF instance that raised the event.
61
+ *
62
+ * - `canvas`: [`DrawCanvas`](https://surveyjs.io/pdf-generator/documentation/api-reference/drawcanvas)\
63
+ * An object that you can use to draw text and images in the page footer.
64
+ *
65
+ * [View Demo](https://surveyjs.io/pdf-generator/examples/customize-header-and-footer-of-pdf-form/ (linkStyle))
66
+ */
67
+ onRenderFooter: EventAsync<SurveyPDF, DrawCanvas>;
68
+ /**
69
+ * An event that is raised when SurveyJS PDF Generator renders a survey question. Handle this event to customize question rendering.
70
+ *
71
+ * Parameters:
72
+ *
73
+ * - `sender`: `SurveyPDF`\
74
+ * A SurveyPDF instance that raised the event.
75
+ *
76
+ * - `options.question`: [`Question`](https://surveyjs.io/form-library/documentation/api-reference/question)\
77
+ * A survey question that is being rendered.
78
+ *
79
+ * - `options.point`: `IPoint`\
80
+ * An object with coordinates of the top-left corner of the element being rendered. This object contains the following properties: `{ xLeft: number, yTop: number }`.
81
+ *
82
+ * - `options.bricks`: [`PdfBrick[]`](https://surveyjs.io/pdf-generator/documentation/api-reference/pdfbrick)\
83
+ * An array of [bricks](https://surveyjs.io/pdf-generator/documentation/customize-survey-question-rendering-in-pdf-form#custom-rendering) used to render the element.
84
+ *
85
+ * - `options.controller`: [`DocController`](https://surveyjs.io/pdf-generator/documentation/api-reference/doccontroller)\
86
+ * An object that provides access to main PDF document properties (font, margins, page width and height) and allows you to modify them.
87
+ *
88
+ * - `options.repository`: `FlatRepository`\
89
+ * A repository with classes that render elements to PDF. Use its `create` method if you need to create a new instance of a rendering class.
90
+ *
91
+ * [View Demo](https://surveyjs.io/pdf-generator/examples/how-to-use-adorners-in-pdf-forms/ (linkStyle))
92
+ */
93
+ onRenderQuestion: EventAsync<SurveyPDF, AdornersOptions>;
94
+ /**
95
+ * An event that is raised when SurveyJS PDF Generator renders a panel. Handle this event to customize panel rendering.
96
+ *
97
+ * Parameters:
98
+ *
99
+ * - `sender`: `SurveyPDF`\
100
+ * A SurveyPDF instance that raised the event.
101
+ *
102
+ * - `options.panel`: [`PanelModel`](https://surveyjs.io/form-library/documentation/api-reference/panel-model)\
103
+ * A panel that is being rendered.
104
+ *
105
+ * - `options.point`: `IPoint`\
106
+ * An object with coordinates of the top-left corner of the element being rendered. This object contains the following properties: `{ xLeft: number, yTop: number }`.
107
+ *
108
+ * - `options.bricks`: [`PdfBrick[]`](https://surveyjs.io/pdf-generator/documentation/api-reference/pdfbrick)\
109
+ * An array of [bricks](https://surveyjs.io/pdf-generator/documentation/customize-survey-question-rendering-in-pdf-form#custom-rendering) used to render the element.
110
+ *
111
+ * - `options.controller`: [`DocController`](https://surveyjs.io/pdf-generator/documentation/api-reference/doccontroller)\
112
+ * An object that provides access to main PDF document properties (font, margins, page width and height) and allows you to modify them.
113
+ *
114
+ * - `options.repository`: `FlatRepository`\
115
+ * A repository with classes that render elements to PDF. Use its `create` method if you need to create a new instance of a rendering class.
116
+ *
117
+ * [View Demo](https://surveyjs.io/pdf-generator/examples/how-to-use-adorners-in-pdf-forms/ (linkStyle))
118
+ */
119
+ onRenderPanel: EventAsync<SurveyPDF, AdornersPanelOptions>;
120
+ /**
121
+ * An event that is raised when SurveyJS PDF Generator renders a page. Handle this event to customize page rendering.
122
+ *
123
+ * Parameters:
124
+ *
125
+ * - `sender`: `SurveyPDF`\
126
+ * A SurveyPDF instance that raised the event.
127
+ *
128
+ * - `options.page`: [`PageModel`](https://surveyjs.io/form-library/documentation/api-reference/page-model)\
129
+ * A page that is being rendered.
130
+ *
131
+ * - `options.point`: `IPoint`\
132
+ * An object with coordinates of the top-left corner of the element being rendered. This object contains the following properties: `{ xLeft: number, yTop: number }`.
133
+ *
134
+ * - `options.bricks`: [`PdfBrick[]`](https://surveyjs.io/pdf-generator/documentation/api-reference/pdfbrick)\
135
+ * An array of [bricks](https://surveyjs.io/pdf-generator/documentation/customize-survey-question-rendering-in-pdf-form#custom-rendering) used to render the element.
136
+ *
137
+ * - `options.controller`: [`DocController`](https://surveyjs.io/pdf-generator/documentation/api-reference/doccontroller)\
138
+ * An object that provides access to main PDF document properties (font, margins, page width and height) and allows you to modify them.
139
+ *
140
+ * - `options.repository`: `FlatRepository`\
141
+ * A repository with classes that render elements to PDF. Use its `create` method if you need to create a new instance of a rendering class.
142
+ *
143
+ * [View Demo](https://surveyjs.io/pdf-generator/examples/how-to-use-adorners-in-pdf-forms/ (linkStyle))
144
+ */
145
+ onRenderPage: EventAsync<SurveyPDF, AdornersPageOptions>;
146
+ onDocControllerCreated: EventBase<SurveyPDF, {
147
+ controller: DocController;
148
+ }>;
149
+ onRenderCheckItemAcroform: EventAsync<SurveyPDF, any>;
150
+ onRenderRadioGroupWrapAcroform: EventAsync<SurveyPDF, any>;
151
+ onRenderRadioItemAcroform: EventAsync<SurveyPDF, any>;
152
+ getUpdatedCheckItemAcroformOptions(options: any): void;
153
+ getUpdatedRadioGroupWrapOptions(options: any): void;
154
+ getUpdatedRadioItemAcroformOptions(options: any): void;
155
+ protected renderSurvey(controller: DocController): Promise<void>;
156
+ /**
157
+ * An asynchronous method that starts download of the generated PDF file in the web browser.
158
+ *
159
+ * @param fileName *(Optional)* A file name with the ".pdf" extension. Default value: `"survey_result.pdf"`.
160
+ */
161
+ save(fileName?: string): Promise<any>;
162
+ /**
163
+ * An asynchronous method that allows you to get PDF content in different formats.
164
+ *
165
+ * [View Demo](https://surveyjs.io/pdf-generator/examples/convert-pdf-form-blob-base64-raw-pdf-javascript/ (linkStyle))
166
+ *
167
+ * @param type *(Optional)* One of `"blob"`, `"bloburl"`, `"dataurlstring"`. Do not specify this parameter if you want to get raw PDF content as a string value.
168
+ *
169
+ */
170
+ raw(type?: string): Promise<string>;
171
+ }
172
+
173
+ export type IBorderDescription = IRect & ISize & Pick<PdfBrick, 'formBorderColor'> & {
174
+ rounded?: boolean;
175
+ dashStyle?: {
176
+ dashArray: [number, number] | [number];
177
+ dashPhase: number;
178
+ };
179
+ outside?: boolean;
180
+ };
181
+ export declare class SurveyHelper {
182
+ static EPSILON: number;
183
+ static TITLE_SURVEY_FONT_SIZE_SCALE: number;
184
+ static TITLE_PAGE_FONT_SIZE_SCALE: number;
185
+ static TITLE_PANEL_FONT_SIZE_SCALE: number;
186
+ static DESCRIPTION_FONT_SIZE_SCALE: number;
187
+ static OTHER_ROWS_COUNT: number;
188
+ static RATING_MIN_WIDTH: number;
189
+ static RATING_MIN_HEIGHT: number;
190
+ static RATING_COLUMN_WIDTH: number;
191
+ static MATRIX_COLUMN_WIDTH: number;
192
+ static IMAGEPICKER_COUNT: number;
193
+ static IMAGEPICKER_RATIO: number;
194
+ static MULTIPLETEXT_TEXT_PERS: number;
195
+ static HTML_TAIL_TEXT_SCALE: number;
196
+ static SELECT_ITEM_FLAT_SCALE: number;
197
+ static GAP_BETWEEN_ROWS: number;
198
+ static GAP_BETWEEN_COLUMNS: number;
199
+ static GAP_BETWEEN_ITEM_TEXT: number;
200
+ static FORM_BORDER_VISIBLE: boolean;
201
+ static BORDER_SCALE: number;
202
+ static VISIBLE_BORDER_SCALE: number;
203
+ static UNVISIBLE_BORDER_SCALE: number;
204
+ static RADIUS_SCALE: number;
205
+ static TITLE_FONT_SCALE: number;
206
+ static VALUE_READONLY_PADDING_SCALE: number;
207
+ static HTML_TO_IMAGE_QUALITY: number;
208
+ static FORM_BORDER_COLOR: string;
209
+ static TEXT_COLOR: string;
210
+ static BACKGROUND_COLOR: string;
211
+ static TITLE_LOCATION_MATRIX: string;
212
+ static STANDARD_FONT: string;
213
+ static CUSTOM_FONT_ENCODING: string;
214
+ static parseWidth(width: string, maxWidth: number, columnsCount?: number, defaultUnit?: string): number;
215
+ static pxToPt(value: number | string): number;
216
+ static mergeRects(...rects: IRect[]): IRect;
217
+ static createPoint(rect: IRect, isLeft?: boolean, isTop?: boolean): IPoint;
218
+ static createRect(point: IPoint, width: number, height: number): IRect;
219
+ static createHeaderRect(controller: DocController): IRect;
220
+ static createFooterRect(controller: DocController): IRect;
221
+ static chooseHtmlFont(controller: DocController): string;
222
+ static generateCssTextRule(fontSize: number, fontStyle: string, fontName: string): string;
223
+ static createHtmlContainerBlock(html: string, controller: DocController, renderAs: IHTMLRenderType): string;
224
+ static splitHtmlRect(controller: DocController, htmlBrick: IPdfBrick): IPdfBrick;
225
+ static createPlainTextFlat<T extends IPdfBrick>(point: IPoint, question: IQuestion, controller: DocController, text: string, fabric: new (question: IQuestion, controller: DocController, rect: IRect, text: string) => T): CompositeBrick;
226
+ static createTextFlat<T extends IPdfBrick>(point: IPoint, question: IQuestion, controller: DocController, text: string | LocalizableString, fabric: new (question: IQuestion, controller: DocController, rect: IRect, text: string) => T): Promise<IPdfBrick>;
227
+ static createHTMLRect(point: IPoint, controller: DocController, margins: {
228
+ top: number;
229
+ bottom: number;
230
+ width: number;
231
+ }, resultY: number): IRect;
232
+ static createHTMLFlat(point: IPoint, question: Question, controller: DocController, html: string): Promise<IPdfBrick>;
233
+ static generateFontFace(fontName: string, fontBase64: string, fontWeight: string): string;
234
+ static generateFontFaceWithItalicStyle(fontName: string, fontBase64: string, fontWeight: string): string;
235
+ static htmlToXml(html: string): string;
236
+ static createSvgContent(html: string, width: number, controller: DocController): {
237
+ svg: string;
238
+ divWidth: number;
239
+ divHeight: number;
240
+ };
241
+ static htmlToImage(html: string, width: number, controller: DocController): Promise<{
242
+ url: string;
243
+ aspect: number;
244
+ }>;
245
+ static createBoldTextFlat(point: IPoint, question: Question, controller: DocController, text: string | LocalizableString): Promise<IPdfBrick>;
246
+ static createTitleFlat(point: IPoint, question: Question, controller: DocController): Promise<IPdfBrick>;
247
+ static createTitleSurveyFlat(point: IPoint, controller: DocController, text: string | LocalizableString): Promise<IPdfBrick>;
248
+ static createTitlePanelFlat(point: IPoint, controller: DocController, text: string | LocalizableString, isPage?: boolean): Promise<IPdfBrick>;
249
+ static createDescFlat(point: IPoint, question: IQuestion, controller: DocController, text: string | LocalizableString): Promise<IPdfBrick>;
250
+ static getReadonlyRenderAs(question: Question, controller: DocController): 'auto' | 'text' | 'acroform';
251
+ static createCommentFlat(point: IPoint, question: Question, controller: DocController, isQuestion: boolean, options?: {
252
+ rows?: number;
253
+ index?: number;
254
+ value?: string;
255
+ readOnly?: boolean;
256
+ }): Promise<IPdfBrick>;
257
+ static getQuestionOrCommentValue(question: Question, isQuestion?: boolean): string;
258
+ static getQuestionOrCommentDisplayValue(question: Question, isQuestion?: boolean): string;
259
+ static inBrowser: boolean;
260
+ static get hasDocument(): boolean;
261
+ static getImageBase64(imageLink: string): Promise<string>;
262
+ static shouldConvertImageToPng: boolean;
263
+ static getImageLink(controller: DocController, imageOptions: {
264
+ link: string;
265
+ width: number;
266
+ height: number;
267
+ objectFit?: string;
268
+ }, applyImageFit: boolean): Promise<string>;
269
+ static createImageFlat(point: IPoint, question: any, controller: DocController, imageOptions: {
270
+ link: string;
271
+ width: number;
272
+ height: number;
273
+ objectFit?: string;
274
+ }, applyImageFit?: boolean): Promise<IPdfBrick>;
275
+ static canPreviewImage(question: QuestionFileModel, item: {
276
+ name: string;
277
+ type: string;
278
+ content: string;
279
+ }, url: string): boolean;
280
+ static getImageSize(url: string): Promise<ISize>;
281
+ static createRowlineFlat(point: IPoint, controller: DocController, width?: number, color?: string): IPdfBrick;
282
+ static createLinkFlat(point: IPoint, question: Question, controller: DocController, text: string, link: string): Promise<IPdfBrick>;
283
+ static createAcroformRect(rect: IRect): number[];
284
+ static createTextFieldRect(point: IPoint, controller: DocController, lines?: number): IRect;
285
+ static createReadOnlyTextFieldTextFlat(point: IPoint, controller: DocController, question: Question, value: string): Promise<IPdfBrick>;
286
+ static renderFlatBorders(controller: DocController, borderOptions: IBorderDescription): void;
287
+ static getLocString(text: LocalizableString): string;
288
+ static getDropdownQuestionValue(question: Question): string;
289
+ static getContentQuestion(question: Question): Question;
290
+ static getContentQuestionTypeRenderAs(question: Question, survey: SurveyPDF): string;
291
+ static getContentQuestionType(question: Question, survey: SurveyPDF): string;
292
+ static getRatingMinWidth(controller: DocController): number;
293
+ static getRatingItemText(question: QuestionRatingModel, index: number, locText: LocalizableString): LocalizableString;
294
+ static getPageAvailableWidth(controller: DocController): number;
295
+ static getImagePickerAvailableWidth(controller: DocController): number;
296
+ static getColumnWidth(controller: DocController, colCount: number): number;
297
+ static setColumnMargins(controller: DocController, colCount: number, column: number): void;
298
+ static moveRect(rect: IRect, left?: number, top?: number): IRect;
299
+ static scaleRect(rect: IRect, scale: number): IRect;
300
+ static getBorderWidth(controller: DocController): number;
301
+ static formScale(controller: DocController, flat: ISize): number;
302
+ static generateQuestionFlats(survey: SurveyPDF, controller: DocController, question: Question, point: IPoint): Promise<IPdfBrick[]>;
303
+ static isFontExist(controller: DocController, fontName: string): boolean;
304
+ static isCustomFont(controller: DocController, fontName: string): boolean;
305
+ static fixFont(controller: DocController): void;
306
+ static clone(src: any): any;
307
+ static shouldRenderReadOnly(question: IQuestion, controller: DocController, readOnly?: boolean): boolean;
308
+ static isSizeEmpty(val: any): boolean;
309
+ static isHeightEmpty(val: any): boolean;
310
+ static getCorrectedImageSize(controller: DocController, imageOptions: {
311
+ imageWidth?: any;
312
+ imageHeight?: any;
313
+ imageLink: string;
314
+ defaultImageWidth?: any;
315
+ defaultImageHeight?: any;
316
+ }): Promise<ISize>;
317
+ }
318
+
319
+ import './jspdf_plugins/acroform.js';
320
+ import './jspdf_plugins/from_html.js';
321
+ export interface IPoint {
322
+ /**
323
+ * An X-coordinate for the left element edge.
324
+ */
325
+ xLeft: number;
326
+ /**
327
+ * A Y-coordinate for the top element edge.
328
+ */
329
+ yTop: number;
330
+ }
331
+ /**
332
+ * An interface that describes a rectangle.
333
+ */
334
+ export interface IRect extends IPoint {
335
+ /**
336
+ * An X-coordinate for the right element edge.
337
+ */
338
+ xRight: number;
339
+ /**
340
+ * A Y-coordinate for the bottom element edge.
341
+ */
342
+ yBot: number;
343
+ }
344
+ export interface ISize {
345
+ width: number;
346
+ height: number;
347
+ }
348
+ export interface IMarginLR {
349
+ /**
350
+ * A left margin.
351
+ */
352
+ left?: number;
353
+ /**
354
+ * A right margin.
355
+ */
356
+ right?: number;
357
+ }
358
+ /**
359
+ * An interface that describes margins.
360
+ */
361
+ export interface IMargin extends IMarginLR {
362
+ /**
363
+ * A top margin.
364
+ */
365
+ top?: number;
366
+ /**
367
+ * A bottom margin.
368
+ */
369
+ bot?: number;
370
+ }
371
+ /**
372
+ * PDF document configuration. Pass it as the second argument to the `SurveyPDF` constructor:
373
+ *
374
+ * ```js
375
+ * const surveyPdf = new SurveyPDF.SurveyPDF(surveyJson, pdfDocOptions);
376
+ *
377
+ * // In modular applications:
378
+ import { SurveyPDF } from "survey-pdf";
379
+ * const surveyPdf = new SurveyPDF(surveyJson, pdfDocOptions);
380
+ * ```
381
+ */
382
+ export interface IDocOptions {
383
+ /**
384
+ * Page orientation.
385
+ *
386
+ * Possible values:
387
+ *
388
+ * - `"p"` (default) - Portrait orientation.
389
+ * - `"l"` - Landscape orientation.
390
+ *
391
+ * @see format
392
+ */
393
+ orientation?: 'p' | 'l';
394
+ /**
395
+ * Page format.
396
+ *
397
+ * Possible values:
398
+ *
399
+ * - `"a0"` - `"a10"` (`"a4"` is default)
400
+ * - `"b0"` - `"b10"`
401
+ * - `"c0"` - `"c10"`
402
+ * - `"dl"`
403
+ * - `"letter"`
404
+ * - `"government-letter"`
405
+ * - `"legal"`
406
+ * - `"junior-legal"`
407
+ * - `"ledger"`
408
+ * - `"tabloid"`
409
+ * - `"credit-card"`
410
+ * - Array<number> - custom page size in millimeters, for example, `[210, 297]`.
411
+ *
412
+ * @see orientation
413
+ */
414
+ format?: string | number[];
415
+ /**
416
+ * Font size in points.
417
+ *
418
+ * Default value: 14
419
+ *
420
+ * @see fontName
421
+ */
422
+ fontSize?: number;
423
+ /**
424
+ * Font name.
425
+ *
426
+ * Possible values:
427
+ *
428
+ * - `"Helvetica"` (default)
429
+ * - `"Courier"`
430
+ * - `"Times"`
431
+ * - `"Symbol"`
432
+ * - `"ZapfDingbats"`
433
+ * - [Custom font name](https://surveyjs.io/Documentation/Pdf-Export?id=Customization-ChangeFonts#use-custom-font)
434
+ *
435
+ * [View Demo](https://surveyjs.io/pdf-generator/examples/change-font-in-pdf-form/ (linkStyle))
436
+ * @see fontSize
437
+ */
438
+ fontName?: string;
439
+ base64Normal?: string;
440
+ base64Bold?: string;
441
+ /**
442
+ * Specifies whether to apply a custom font to [HTML questions](https://surveyjs.io/form-library/examples/questiontype-html/).
443
+ *
444
+ * Default value: `false`
445
+ *
446
+ * [View Demo](https://surveyjs.io/pdf-generator/examples/change-font-in-pdf-form/ (linkStyle))
447
+ * @see htmlRenderAs
448
+ */
449
+ useCustomFontInHtml?: boolean;
450
+ /**
451
+ * Page margins. Set this property to an object with the following fields: `top`, `bot`, `left`, `right`.
452
+ */
453
+ margins?: IMargin;
454
+ /**
455
+ * Specifies how to render [HTML questions](https://surveyjs.io/Documentation/Library?id=questionhtmlmodel) into PDF.
456
+ *
457
+ * Possible values:
458
+ *
459
+ * - `"standard"` - Render HTML questions as selectable text.
460
+ * - `"image"` - Render HTML questions as images.
461
+ * - `"auto"` (default) - Select between the `"standard"` and `"image"` modes automatically based on the HTML content.
462
+ *
463
+ * 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.
464
+ * @see useCustomFontInHtml
465
+ */
466
+ htmlRenderAs?: IHTMLRenderType;
467
+ /**
468
+ * 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.
469
+ *
470
+ * Possible values:
471
+ *
472
+ * - `"list"` - Render matrix-like questions as lists.
473
+ * - `"auto"` (default) - Render matrix-like questions as tables if they fit into the available space. Otherwise, render the questions as lists.
474
+ *
475
+ * You can override this property for an individual matrix-like question. Set the question's `renderAs` property to `"list"` in the survey JSON schema.
476
+ */
477
+ matrixRenderAs?: 'auto' | 'list';
478
+ useLegacyBooleanRendering?: boolean;
479
+ /**
480
+ * Specifies how to render read-only questions.
481
+ *
482
+ * Possible values:
483
+ *
484
+ * - `"text"` - Render read-only questions as plain text and custom primitives.
485
+ * - `"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.
486
+ * - `"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.
487
+ */
488
+ readonlyRenderAs?: 'auto' | 'text' | 'acroform';
489
+ textFieldRenderAs?: 'singleLine' | 'multiLine';
490
+ /**
491
+ * 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).
492
+ *
493
+ * Default value: `false`
494
+ */
495
+ compress?: boolean;
496
+ /**
497
+ * Specifies whether to apply `imageFit` settings specified in the survey JSON schema to exported images.
498
+ *
499
+ * Default value: `false`
500
+ *
501
+ * This property applies the following settings:
502
+ *
503
+ * - [`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
504
+ * - [`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
505
+ * - [`logoFit`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#logoFit) to an exported logo in the survey header
506
+ *
507
+ * 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.
508
+ */
509
+ applyImageFit?: boolean;
510
+ /**
511
+ * Specifies whether the PDF document contains text in right-to-left languages.
512
+ *
513
+ * Default value: `false`
514
+ */
515
+ isRTL?: boolean;
516
+ /**
517
+ * 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.
518
+ *
519
+ * Default value: `false` (include all choices)
520
+ */
521
+ tagboxSelectedChoicesOnly?: boolean;
522
+ }
523
+ export declare class DocOptions implements IDocOptions {
524
+ static readonly MM_TO_PT: number;
525
+ static readonly FONT_SIZE = 14;
526
+ protected _orientation: 'l' | 'p';
527
+ protected _format: string | number[];
528
+ protected _fontSize: number;
529
+ protected _fontName: string;
530
+ static SEGOE_NORMAL: string;
531
+ static SEGOE_BOLD: string;
532
+ protected _base64Normal: string;
533
+ protected _base64Bold: string;
534
+ protected _useCustomFontInHtml: boolean;
535
+ protected _margins: IMargin;
536
+ protected _htmlRenderAs: IHTMLRenderType;
537
+ protected _matrixRenderAs: 'auto' | 'list';
538
+ protected _readonlyRenderAs: 'auto' | 'text' | 'acroform';
539
+ protected _compress: boolean;
540
+ protected _applyImageFit: boolean;
541
+ protected _useLegacyBooleanRendering: boolean;
542
+ protected _isRTL: boolean;
543
+ protected _tagboxSelectedChoicesOnly: boolean;
544
+ constructor(options: IDocOptions);
545
+ get leftTopPoint(): IPoint;
546
+ get fontSize(): number;
547
+ get fontName(): string;
548
+ get base64Normal(): string;
549
+ get base64Bold(): string;
550
+ get useCustomFontInHtml(): boolean;
551
+ get margins(): IMargin;
552
+ get format(): string | number[];
553
+ get orientation(): 'l' | 'p';
554
+ get htmlRenderAs(): IHTMLRenderType;
555
+ get matrixRenderAs(): 'auto' | 'list';
556
+ get readonlyRenderAs(): 'auto' | 'text' | 'acroform';
557
+ get compress(): boolean;
558
+ get applyImageFit(): boolean;
559
+ get useLegacyBooleanRendering(): boolean;
560
+ get isRTL(): boolean;
561
+ get tagboxSelectedChoicesOnly(): boolean;
562
+ }
563
+ /**
564
+ * 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.
565
+ *
566
+ * [View Demo](https://surveyjs.io/pdf-generator/examples/how-to-use-adorners-in-pdf-forms/ (linkStyle))
567
+ */
568
+ export declare class DocController extends DocOptions {
569
+ constructor(options?: IDocOptions);
570
+ static customFonts: {
571
+ [name: string]: {
572
+ normal: string;
573
+ bold: string;
574
+ italic: string;
575
+ bolditalic: string;
576
+ };
577
+ };
578
+ static addFont(fontName: string, base64: string, fontStyle: 'normal' | 'bold' | 'italic' | 'bolditalic'): void;
579
+ get doc(): any;
580
+ get helperDoc(): any;
581
+ get fontName(): string;
582
+ set fontName(fontName: string);
583
+ get fontSize(): number;
584
+ set fontSize(fontSize: number);
585
+ get fontStyle(): string;
586
+ set fontStyle(fontStyle: string);
587
+ measureText(text?: string | LocalizableString | number, fontStyle?: string, fontSize?: number): ISize;
588
+ /**
589
+ * The width of one character in pixels.
590
+ */
591
+ get unitWidth(): number;
592
+ /**
593
+ * The heigth of one character in pixels.
594
+ */
595
+ get unitHeight(): number;
596
+ pushMargins(left?: number, right?: number): void;
597
+ popMargins(): void;
598
+ /**
599
+ * The width of a PDF page in pixels.
600
+ */
601
+ get paperWidth(): number;
602
+ /**
603
+ * The height of a PDF page in pixels.
604
+ */
605
+ get paperHeight(): number;
606
+ getNumberOfPages(): number;
607
+ addPage(): void;
608
+ getCurrentPageIndex(): number;
609
+ setPage(index: number): void;
610
+ }
611
+
612
+ export type FlatConstructor = new (survey: SurveyPDF, question: IQuestion, controller: DocController) => IFlatQuestion;
613
+ export declare class FlatRepository {
614
+ static getInstance(): FlatRepository;
615
+ register(modelType: string, rendererConstructor: FlatConstructor): void;
616
+ isTypeRegistered(type: string): boolean;
617
+ getRenderer(type: string): FlatConstructor;
618
+ create(survey: SurveyPDF, question: Question, docController: DocController, type?: string): IFlatQuestion;
619
+ static register(type: string, rendererConstructor: FlatConstructor): void;
620
+ static getRenderer(type: string): FlatConstructor;
621
+ }
622
+
623
+ export interface IFlatQuestion {
624
+ generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
625
+ generateFlats(point: IPoint): Promise<IPdfBrick[]>;
626
+ }
627
+ export declare class FlatQuestion implements IFlatQuestion {
628
+ protected survey: SurveyPDF;
629
+ protected controller: DocController;
630
+ static CONTENT_GAP_VERT_SCALE: number;
631
+ static CONTENT_GAP_HOR_SCALE: number;
632
+ static CONTENT_INDENT_SCALE: number;
633
+ static DESC_GAP_SCALE: number;
634
+ protected question: Question;
635
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
636
+ generateFlatsComposite(point: IPoint): Promise<IPdfBrick[]>;
637
+ generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
638
+ generateFlatsContentWithOptionalElements(point: IPoint): Promise<IPdfBrick[]>;
639
+ generateFlats(point: IPoint): Promise<IPdfBrick[]>;
640
+ protected get shouldRenderAsComment(): boolean;
641
+ }
642
+
643
+ export declare class FlatQuestionDefault extends FlatQuestion {
644
+ generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
645
+ }
646
+
647
+ export declare class FlatBooleanCheckbox extends FlatQuestion {
648
+ protected survey: SurveyPDF;
649
+ protected controller: DocController;
650
+ protected question: QuestionBooleanModel;
651
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
652
+ generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
653
+ }
654
+ export declare class FlatBoolean extends FlatRadiogroup {
655
+ protected survey: SurveyPDF;
656
+ protected controller: DocController;
657
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
658
+ protected getVisibleChoices(): Array<ItemValue>;
659
+ protected getColCount(): number;
660
+ }
661
+
662
+ export declare class FlatCheckbox extends FlatSelectBase {
663
+ protected survey: SurveyPDF;
664
+ protected controller: DocController;
665
+ protected question: QuestionCheckboxModel;
666
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
667
+ generateFlatItem(rect: IRect, item: ItemValue, index: number): IPdfBrick;
668
+ }
669
+ export declare class FlatTagbox extends FlatCheckbox {
670
+ protected survey: SurveyPDF;
671
+ protected controller: DocController;
672
+ protected question: QuestionTagboxModel;
673
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
674
+ protected getVisibleChoices(): Array<ItemValue>;
675
+ }
676
+
677
+ export declare class FlatCustomModel extends FlatQuestion {
678
+ protected survey: SurveyPDF;
679
+ protected controller: DocController;
680
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
681
+ generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
682
+ }
683
+
684
+ export declare class FlatComment extends FlatQuestion {
685
+ protected survey: SurveyPDF;
686
+ protected controller: DocController;
687
+ protected question: QuestionCommentModel;
688
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
689
+ generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
690
+ }
691
+
692
+ export declare class FlatDropdown extends FlatQuestion {
693
+ protected survey: SurveyPDF;
694
+ protected controller: DocController;
695
+ protected question: QuestionDropdownModel;
696
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
697
+ generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
698
+ }
699
+
700
+ export declare class FlatExpression extends FlatQuestion {
701
+ protected survey: SurveyPDF;
702
+ protected question: QuestionExpressionModel;
703
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
704
+ generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
705
+ }
706
+
707
+ export declare class FlatFile extends FlatQuestion {
708
+ protected survey: SurveyPDF;
709
+ static readonly IMAGE_GAP_SCALE: number;
710
+ static readonly TEXT_MIN_SCALE: number;
711
+ static DEFAULT_IMAGE_FIT: string;
712
+ protected question: QuestionFileModel;
713
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
714
+ generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
715
+ }
716
+
717
+ export type IHTMLRenderType = 'auto' | 'standard' | 'image';
718
+ export declare class FlatHTML extends FlatQuestion {
719
+ protected survey: SurveyPDF;
720
+ protected question: QuestionHtmlModel;
721
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
722
+ protected correctHtml(html: string): string;
723
+ generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
724
+ }
725
+
726
+ export declare class FlatImage extends FlatQuestion {
727
+ protected survey: SurveyPDF;
728
+ protected question: QuestionImageModel;
729
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
730
+ generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
731
+ }
732
+
733
+ export declare class FlatImagePicker extends FlatQuestion {
734
+ protected survey: SurveyPDF;
735
+ protected question: QuestionImagePickerModel;
736
+ protected radio: FlatRadiogroup;
737
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
738
+ generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
739
+ }
740
+
741
+ export declare class FlatPanelDynamic extends FlatQuestion {
742
+ protected survey: SurveyPDF;
743
+ protected controller: DocController;
744
+ protected question: QuestionPanelDynamicModel;
745
+ static readonly GAP_BETWEEN_PANELS: number;
746
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
747
+ generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
748
+ }
749
+
750
+ export declare class FlatRadiogroup extends FlatSelectBase {
751
+ protected survey: SurveyPDF;
752
+ protected controller: DocController;
753
+ protected question: QuestionRadiogroupModel;
754
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
755
+ protected isItemSelected(item: ItemValue, checked?: boolean): boolean;
756
+ generateFlatItem(rect: IRect, item: ItemValue, index: number, key?: string, checked?: boolean, context?: any): IPdfBrick;
757
+ }
758
+
759
+ export declare class FlatRanking extends FlatQuestion {
760
+ protected survey: SurveyPDF;
761
+ protected controller: DocController;
762
+ protected question: QuestionRankingModel;
763
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
764
+ protected generateFlatComposite(point: IPoint, item: ItemValue, index: number, unrankedItem?: boolean): Promise<IPdfBrick>;
765
+ generateChoicesColumn(point: IPoint, choices: ItemValue[], unrankedChoices?: boolean): Promise<IPdfBrick[]>;
766
+ generateSelectToRankItemsVertically(point: IPoint): Promise<IPdfBrick[]>;
767
+ generateSelectToRankItemsHorizontally(point: IPoint): Promise<IPdfBrick[]>;
768
+ generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
769
+ }
770
+
771
+ export declare class FlatRating extends FlatRadiogroup {
772
+ protected survey: SurveyPDF;
773
+ protected controller: DocController;
774
+ protected questionRating: QuestionRatingModel;
775
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
776
+ protected generateFlatHorisontalComposite(point: IPoint, item: ItemValue, index: number): Promise<IPdfBrick>;
777
+ protected generateFlatComposite(point: IPoint, item: ItemValue, index: number): Promise<IPdfBrick>;
778
+ protected generateHorisontallyItems(point: IPoint): Promise<CompositeBrick[]>;
779
+ generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
780
+ }
781
+
782
+ export declare abstract class FlatSelectBase extends FlatQuestion {
783
+ protected survey: SurveyPDF;
784
+ protected controller: DocController;
785
+ protected question: QuestionCheckboxBase;
786
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
787
+ abstract generateFlatItem(rect: IRect, item: ItemValue, index: number): IPdfBrick;
788
+ protected generateFlatComposite(point: IPoint, item: ItemValue, index: number): Promise<IPdfBrick>;
789
+ protected getVisibleChoices(): Array<ItemValue>;
790
+ protected getColCount(): number;
791
+ generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
792
+ protected generateVerticallyItems(point: IPoint, itemValues: ItemValue[]): Promise<IPdfBrick[]>;
793
+ protected generateHorisontallyItems(point: IPoint, colCount: number): Promise<IPdfBrick[]>;
794
+ }
795
+
796
+ export declare class FlatSignaturePad extends FlatQuestion {
797
+ protected survey: SurveyPDF;
798
+ protected question: QuestionSignaturePadModel;
799
+ static BORDER_STYLE: 'dashed' | 'solid' | 'none';
800
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
801
+ generateBackgroundImage(point: IPoint): Promise<IPdfBrick>;
802
+ generateSign(point: IPoint): Promise<IPdfBrick>;
803
+ generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
804
+ }
805
+
806
+ export declare class FlatTextbox extends FlatQuestion {
807
+ protected survey: SurveyPDF;
808
+ static readonly MULTILINE_TEXT_ROWS_COUNT: number;
809
+ protected question: QuestionTextModel;
810
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
811
+ generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
812
+ }
813
+
814
+ export declare class FlatSurvey {
815
+ static QUES_GAP_VERT_SCALE: number;
816
+ static PANEL_CONT_GAP_SCALE: number;
817
+ static PANEL_DESC_GAP_SCALE: number;
818
+ static generateFlatsPanel(survey: SurveyPDF, controller: DocController, panel: PanelModel, point: IPoint): Promise<IPdfBrick[]>;
819
+ static generateFlats(survey: SurveyPDF, controller: DocController): Promise<IPdfBrick[][]>;
820
+ }
821
+
822
+ export declare class FlatMatrix extends FlatQuestion {
823
+ protected survey: SurveyPDF;
824
+ protected controller: DocController;
825
+ static readonly GAP_BETWEEN_ROWS: number;
826
+ protected question: QuestionMatrixModel;
827
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
828
+ protected generateFlatsHeader(point: IPoint): Promise<IPdfBrick[]>;
829
+ protected generateFlatsRows(point: IPoint, isVertical: boolean): Promise<IPdfBrick[]>;
830
+ generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
831
+ }
832
+ export declare class FlatMatrixRow extends FlatRadiogroup {
833
+ protected survey: SurveyPDF;
834
+ protected controller: DocController;
835
+ protected isFirst: boolean;
836
+ protected isVertical: boolean;
837
+ protected questionMatrix: QuestionMatrixModel;
838
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController, row: MatrixRowModel, rowIndex: number, key: string, isFirst: boolean, isVertical: boolean, rowTitleWidth: number, columnWidth: number);
839
+ generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
840
+ protected generateTextComposite(point: IPoint, column: ItemValue, index: number): Promise<IPdfBrick>;
841
+ protected generateItemCompoiste(point: IPoint, column: ItemValue, index: number): Promise<IPdfBrick>;
842
+ protected generateFlatsHorizontallyCells(point: IPoint): Promise<(IPdfBrick | CompositeBrick)[]>;
843
+ protected generateFlatsVerticallyCells(point: IPoint): Promise<IPdfBrick[]>;
844
+ }
845
+
846
+ export declare class FlatMatrixMultiple extends FlatQuestion {
847
+ protected survey: SurveyPDF;
848
+ protected isMultiple: boolean;
849
+ static readonly GAP_BETWEEN_ROWS: number;
850
+ protected question: QuestionMatrixDropdownModelBase;
851
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController, isMultiple?: boolean);
852
+ generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
853
+ }
854
+
855
+ export declare class FlatMatrixDynamic extends FlatMatrixMultiple {
856
+ protected survey: SurveyPDF;
857
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
858
+ }
859
+
860
+ export declare class FlatMultipleText extends FlatQuestion {
861
+ protected survey: SurveyPDF;
862
+ protected controller: DocController;
863
+ static readonly ROWS_GAP_SCALE: number;
864
+ protected question: QuestionMultipleTextModel;
865
+ constructor(survey: SurveyPDF, question: IQuestion, controller: DocController);
866
+ generateFlatsContent(point: IPoint): Promise<IPdfBrick[]>;
867
+ }
868
+
869
+ export declare class PagePacker {
870
+ static pack(flats: IPdfBrick[][], controller: DocController): IPdfBrick[][];
871
+ }
872
+
873
+ export declare class EventAsync<Sender, Options> extends EventBase<Sender, Options> {
874
+ unshift(func: (sender: Sender, options: Options) => any): void;
875
+ fire(sender: Sender, options: Options): Promise<void>;
876
+ }
877
+ export declare class EventHandler {
878
+ static process_header_events(survey: SurveyPDF, controller: DocController, packs: IPdfBrick[][]): Promise<void>;
879
+ }
880
+
881
+ /**
882
+ * Horizontal alignment types in onRenderHeader and onRenderFooter events
883
+ */
884
+ export declare enum HorizontalAlign {
885
+ NotSet = "notset",
886
+ Left = "left",
887
+ Center = "center",
888
+ Right = "right"
889
+ }
890
+ /**
891
+ * Vertical alignment types in onRenderHeader and onRenderFooter events
892
+ */
893
+ export declare enum VerticalAlign {
894
+ NotSet = "notset",
895
+ Top = "top",
896
+ Middle = "middle",
897
+ Bottom = "bottom"
898
+ }
899
+ export interface IDrawRectOptions {
900
+ /**
901
+ * Horizontal alignment within the rectangle that limits the drawing area.
902
+ *
903
+ * Possible values:
904
+ *
905
+ * - `"center"` (default)
906
+ * - `"left"`
907
+ * - `"right"`
908
+ */
909
+ horizontalAlign?: HorizontalAlign;
910
+ /**
911
+ * Vertical alignment within the rectangle that limits the drawing area.
912
+ *
913
+ * Possible values:
914
+ *
915
+ * - `"middle"` (default)
916
+ * - `"top"`
917
+ * - `"bottom"`
918
+ */
919
+ verticalAlign?: VerticalAlign;
920
+ /**
921
+ * 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.
922
+ */
923
+ margins?: IMargin;
924
+ /**
925
+ * An object with coordinates of the rectangle.
926
+ */
927
+ rect?: IRect;
928
+ }
929
+ /**
930
+ * An object that configures rendering a piece of text.
931
+ */
932
+ export interface IDrawTextOptions extends IDrawRectOptions {
933
+ /**
934
+ * A text string to be drawn.
935
+ */
936
+ text: string;
937
+ /**
938
+ * Font size in points.
939
+ *
940
+ * Default value: 14
941
+ */
942
+ fontSize?: number;
943
+ /**
944
+ * Enable this property to render the text string bold.
945
+ *
946
+ * Default value: `false`
947
+ */
948
+ isBold?: boolean;
949
+ }
950
+ /**
951
+ * An object that configures rendering an image.
952
+ */
953
+ export interface IDrawImageOptions extends IDrawRectOptions {
954
+ /**
955
+ * An image width in pixels. Defaults to the [rectangle width](https://surveyjs.io/pdf-generator/documentation/api-reference/idrawimageoptions#rect).
956
+ */
957
+ width?: number;
958
+ /**
959
+ * An image height in pixels. Defaults to the [rectangle height](https://surveyjs.io/pdf-generator/documentation/api-reference/idrawimageoptions#rect).
960
+ */
961
+ height?: number;
962
+ /**
963
+ * A string value with a base64-encoded image to be drawn.
964
+ */
965
+ base64: string;
966
+ /**
967
+ * Specifies how to resize the image to fit it into its container.
968
+ *
969
+ * Default value: `"contain"` if [`applyImageFit`](https://surveyjs.io/pdf-generator/documentation/api-reference/idocoptions#applyImageFit) is enabled or `undefined` if not.
970
+ *
971
+ * Refer to the [`object-fit`](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit) CSS property description for information on accepted values.
972
+ */
973
+ imageFit?: string;
974
+ }
975
+ /**
976
+ * 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.
977
+ *
978
+ * [View Demo](https://surveyjs.io/pdf-generator/examples/customize-header-and-footer-of-pdf-form/ (linkStyle))
979
+ */
980
+ export declare class DrawCanvas {
981
+ protected packs: IPdfBrick[];
982
+ controller: DocController;
983
+ protected _rect: IRect;
984
+ protected _countPages: number;
985
+ protected _pageNumber: number;
986
+ constructor(packs: IPdfBrick[], controller: DocController, _rect: IRect, _countPages: number, _pageNumber: number);
987
+ /**
988
+ * A total number of pages in the document.
989
+ */
990
+ get pageCount(): number;
991
+ get countPages(): number;
992
+ /**
993
+ * The number of the page that contains the drawing area. Enumeration starts with 1.
994
+ */
995
+ get pageNumber(): number;
996
+ /**
997
+ * An object with coordinates of a rectangle that limits the drawing area. This object contain the following fields: `xLeft`, `xRight`, `yTop`, `yBot`.
998
+ */
999
+ get rect(): IRect;
1000
+ /**
1001
+ * Draws a piece of text within the drawing area.
1002
+ * @param textOptions An [`IDrawTextOptions`](https://surveyjs.io/pdf-generator/documentation/api-reference/idrawtextoptions) object that configures the drawing.
1003
+ */
1004
+ drawText(textOptions: IDrawTextOptions): void;
1005
+ /**
1006
+ * Draws an image within the drawing area.
1007
+ * @param imageOptions An [`IDrawImageOptions`](https://surveyjs.io/pdf-generator/documentation/api-reference/idrawimageoptions) object that configures drawing.
1008
+ */
1009
+ drawImage(imageOptions: IDrawImageOptions): Promise<void>;
1010
+ }
1011
+
1012
+ export type TranslateXFunction = (xLeft: number, xRight: number) => {
1013
+ xLeft: number;
1014
+ xRight: number;
1015
+ };
1016
+ export interface IPdfBrick extends IRect, ISize {
1017
+ render(): Promise<void>;
1018
+ unfold(): IPdfBrick[];
1019
+ translateX(func: TranslateXFunction): void;
1020
+ isPageBreak: boolean;
1021
+ }
1022
+ /**
1023
+ * An object that describes a PDF brick&mdash;a simple element with specified content, size, and location. Bricks are fundamental elements used to construct a PDF document.
1024
+ *
1025
+ * You can access `PdfBrick` objects within functions that handle `SurveyPDF`'s [`onRenderQuestion`](https://surveyjs.io/pdf-generator/documentation/api-reference/surveypdf#onRenderQuestion), [`onRenderPanel`](https://surveyjs.io/pdf-generator/documentation/api-reference/surveypdf#onRenderPanel), and [`onRenderPage`](https://surveyjs.io/pdf-generator/documentation/api-reference/surveypdf#onRenderPage) events.
1026
+ *
1027
+ * [View Demo](https://surveyjs.io/pdf-generator/examples/add-markup-to-customize-pdf-forms/ (linkStyle))
1028
+ */
1029
+ export declare class PdfBrick implements IPdfBrick {
1030
+ protected question: IQuestion;
1031
+ protected controller: DocController;
1032
+ protected _xLeft: number;
1033
+ protected _xRight: number;
1034
+ protected _yTop: number;
1035
+ protected _yBot: number;
1036
+ /**
1037
+ * An X-coordinate for the left brick edge.
1038
+ */
1039
+ get xLeft(): number;
1040
+ set xLeft(val: number);
1041
+ /**
1042
+ * An X-coordinate for the right brick edge.
1043
+ */
1044
+ get xRight(): number;
1045
+ set xRight(val: number);
1046
+ /**
1047
+ * A Y-coordinate for the top brick edge.
1048
+ */
1049
+ get yTop(): number;
1050
+ set yTop(val: number);
1051
+ /**
1052
+ * A Y-coordinate for the bottom brick edge.
1053
+ */
1054
+ get yBot(): number;
1055
+ set yBot(val: number);
1056
+ /**
1057
+ * Font size in points.
1058
+ *
1059
+ * Default value: 14 (inherited from the parent PDF document)
1060
+ */
1061
+ fontSize: number;
1062
+ /**
1063
+ * The color of text within the brick.
1064
+ *
1065
+ * Default value: `"#404040"`
1066
+ */
1067
+ textColor: string;
1068
+ formBorderColor: string;
1069
+ isPageBreak: boolean;
1070
+ constructor(question: IQuestion, controller: DocController, rect: IRect);
1071
+ translateX(func: TranslateXFunction): void;
1072
+ /**
1073
+ * The brick's width in pixels.
1074
+ */
1075
+ get width(): number;
1076
+ /**
1077
+ * The brick's height in pixels.
1078
+ */
1079
+ get height(): number;
1080
+ protected getShouldRenderReadOnly(): boolean;
1081
+ afterRenderCallback: () => void;
1082
+ render(): Promise<void>;
1083
+ renderInteractive(): Promise<void>;
1084
+ renderReadOnly(): Promise<void>;
1085
+ /**
1086
+ * Allows you to get a flat array of nested PDF bricks.
1087
+ * @returns A flat array of nested PDF bricks.
1088
+ */
1089
+ unfold(): IPdfBrick[];
1090
+ protected getCorrectedText(val: string): string;
1091
+ protected setXLeft(val: number): void;
1092
+ protected setXRight(val: number): void;
1093
+ protected setYTop(val: number): void;
1094
+ protected setYBottom(val: number): void;
1095
+ }
1096
+
1097
+ export declare class BooleanItemBrick extends CheckItemBrick {
1098
+ constructor(question: IQuestion, controller: DocController, rect: IRect);
1099
+ }
1100
+
1101
+ export declare class CheckboxItemBrick extends CheckItemBrick {
1102
+ constructor(question: IQuestion, controller: DocController, rect: IRect, item: ItemValue, index: number);
1103
+ }
1104
+
1105
+ export interface ICheckItemBrickContext {
1106
+ question: IQuestion;
1107
+ readOnly: boolean;
1108
+ checked: boolean;
1109
+ item?: ItemValue;
1110
+ index?: number;
1111
+ }
1112
+ export declare class CheckItemBrick extends PdfBrick {
1113
+ protected fieldName: string;
1114
+ protected context: ICheckItemBrickContext;
1115
+ static readonly CHECKMARK_READONLY_FONT_SIZE_SCALE: number;
1116
+ protected question: QuestionCheckboxModel;
1117
+ constructor(controller: DocController, rect: IRect, fieldName: string, context: ICheckItemBrickContext);
1118
+ protected getShouldRenderReadOnly(): boolean;
1119
+ renderInteractive(): Promise<void>;
1120
+ renderReadOnly(): Promise<void>;
1121
+ }
1122
+
1123
+ export declare class CommentBrick extends TextBoxBrick {
1124
+ protected controller: DocController;
1125
+ constructor(question: IQuestion, controller: DocController, rect: IRect, isQuestion: boolean, index?: number);
1126
+ protected shouldRenderFlatBorders(): boolean;
1127
+ }
1128
+
1129
+ export declare class CompositeBrick implements IPdfBrick {
1130
+ isPageBreak: boolean;
1131
+ constructor(...bricks: IPdfBrick[]);
1132
+ get xLeft(): number;
1133
+ set xLeft(xLeft: number);
1134
+ get xRight(): number;
1135
+ set xRight(xRight: number);
1136
+ get yTop(): number;
1137
+ set yTop(yTop: number);
1138
+ get yBot(): number;
1139
+ set yBot(yBot: number);
1140
+ get width(): number;
1141
+ get height(): number;
1142
+ render(): Promise<void>;
1143
+ get isEmpty(): boolean;
1144
+ addBrick(...bricks: IPdfBrick[]): void;
1145
+ unfold(): IPdfBrick[];
1146
+ translateX(func: TranslateXFunction): void;
1147
+ }
1148
+
1149
+ export declare class CustomBrick extends PdfBrick {
1150
+ constructor(question: IQuestion, controller: DocController, renderFunc: (doc: any, question: any, xLeft: number, yTop: number) => IRect);
1151
+ renderInteractive(): Promise<void>;
1152
+ }
1153
+
1154
+ export declare class DropdownBrick extends PdfBrick {
1155
+ protected controller: DocController;
1156
+ protected question: QuestionDropdownModel;
1157
+ protected isQuestion: boolean;
1158
+ protected isMultiline: boolean;
1159
+ constructor(question: IQuestion, controller: DocController, rect: IRect);
1160
+ renderInteractive(): Promise<void>;
1161
+ }
1162
+
1163
+ export declare class EmptyBrick extends PdfBrick {
1164
+ protected controller: DocController;
1165
+ constructor(rect: IRect, controller?: DocController, isBorderVisible?: boolean);
1166
+ renderInteractive(): Promise<void>;
1167
+ }
1168
+
1169
+ export declare class HTMLBrick extends PdfBrick {
1170
+ protected html: string;
1171
+ constructor(question: IQuestion, controller: DocController, rect: IRect, html: string, isImage?: boolean);
1172
+ renderInteractive(): Promise<void>;
1173
+ }
1174
+
1175
+ export declare class ImageBrick extends PdfBrick {
1176
+ protected image: string;
1177
+ protected originalWidth: number;
1178
+ protected originalHeight: number;
1179
+ constructor(question: IQuestion, controller: DocController, image: string, point: IPoint, originalWidth: number, originalHeight: number);
1180
+ renderInteractive(): Promise<void>;
1181
+ }
1182
+
1183
+ export declare class LinkBrick extends TextBrick {
1184
+ protected link: string;
1185
+ static readonly COLOR: string;
1186
+ constructor(textFlat: TextBrick, link: string);
1187
+ renderInteractive(): Promise<void>;
1188
+ renderReadOnly(): Promise<void>;
1189
+ }
1190
+
1191
+ export interface IRadiogroupWrapContext {
1192
+ question: IQuestion;
1193
+ readOnly: boolean;
1194
+ }
1195
+ export declare class RadioGroupWrap {
1196
+ name: string;
1197
+ constructor(name: string, controller: DocController, context: IRadiogroupWrapContext);
1198
+ addToPdf(color: string): void;
1199
+ get radioGroup(): any;
1200
+ get readOnly(): boolean;
1201
+ }
1202
+ export interface IRadioGroupItemBrickContext {
1203
+ question: IQuestion;
1204
+ checked: boolean;
1205
+ index: number;
1206
+ item: ItemValue;
1207
+ }
1208
+ export declare class RadioItemBrick extends PdfBrick {
1209
+ static readonly RADIOMARKER_READONLY_FONT_SIZE_SCALE: number;
1210
+ constructor(controller: DocController, rect: IRect, context: IRadioGroupItemBrickContext, radioGroupWrap: RadioGroupWrap);
1211
+ protected getShouldRenderReadOnly(): boolean;
1212
+ renderInteractive(): Promise<void>;
1213
+ renderReadOnly(): Promise<void>;
1214
+ }
1215
+
1216
+ export declare class RankingItemBrick extends PdfBrick {
1217
+ protected mark: string;
1218
+ protected question: QuestionRankingModel;
1219
+ constructor(question: IQuestion, controller: DocController, rect: IRect, mark: string);
1220
+ renderInteractive(): Promise<void>;
1221
+ }
1222
+
1223
+ export declare class RowlineBrick implements IPdfBrick {
1224
+ protected controller: DocController;
1225
+ protected color: string;
1226
+ xLeft: number;
1227
+ xRight: number;
1228
+ yTop: number;
1229
+ yBot: number;
1230
+ isPageBreak: boolean;
1231
+ constructor(controller: DocController, rect: IRect, color: string);
1232
+ get width(): number;
1233
+ get height(): number;
1234
+ render(): Promise<void>;
1235
+ unfold(): IPdfBrick[];
1236
+ translateX(_: TranslateXFunction): void;
1237
+ }
1238
+
1239
+ export declare class TextFieldBrick extends PdfBrick {
1240
+ protected isQuestion: boolean;
1241
+ protected fieldName: string;
1242
+ protected value: string;
1243
+ protected placeholder: string;
1244
+ isReadOnly: boolean;
1245
+ protected isMultiline: boolean;
1246
+ protected inputType: string;
1247
+ protected question: QuestionTextModel;
1248
+ constructor(question: IQuestion, controller: DocController, rect: IRect, isQuestion: boolean, fieldName: string, value: string, placeholder: string, isReadOnly: boolean, isMultiline: boolean, inputType: string);
1249
+ renderInteractive(): Promise<void>;
1250
+ protected shouldRenderFlatBorders(): boolean;
1251
+ protected getShouldRenderReadOnly(): boolean;
1252
+ get textBrick(): IPdfBrick;
1253
+ set textBrick(val: IPdfBrick);
1254
+ renderReadOnly(): Promise<void>;
1255
+ unfold(): IPdfBrick[];
1256
+ translateX(func: TranslateXFunction): void;
1257
+ protected setXLeft(val: number): void;
1258
+ protected setXRight(val: number): void;
1259
+ protected setYTop(val: number): void;
1260
+ protected setYBottom(val: number): void;
1261
+ }
1262
+
1263
+ export declare class TextBoldBrick extends TextBrick {
1264
+ constructor(question: IQuestion, controller: DocController, rect: IRect, text: string);
1265
+ renderInteractive(): Promise<void>;
1266
+ }
1267
+
1268
+ export declare class TextBoxBrick extends TextFieldBrick {
1269
+ protected isQuestion: boolean;
1270
+ protected isMultiline: boolean;
1271
+ constructor(question: IQuestion, controller: DocController, rect: IRect, isQuestion?: boolean, isMultiline?: boolean, index?: number);
1272
+ }
1273
+
1274
+ export declare class TextBrick extends PdfBrick {
1275
+ protected text: string;
1276
+ protected align: any;
1277
+ constructor(question: IQuestion, controller: DocController, rect: IRect, text: string);
1278
+ renderInteractive(): Promise<void>;
1279
+ protected alignPoint(rect: IRect): IPoint;
1280
+ }
1281
+
1282
+ export declare class TitlePanelBrick extends TextBoldBrick {
1283
+ protected question: QuestionTextModel;
1284
+ constructor(question: IQuestion, controller: DocController, rect: IRect, text: string);
1285
+ renderInteractive(): Promise<void>;
1286
+ }
1287
+
1288
+ export declare class AdornersBaseOptions {
1289
+ point: IPoint;
1290
+ bricks: IPdfBrick[];
1291
+ controller: DocController;
1292
+ repository: FlatRepository;
1293
+ module: any;
1294
+ constructor(point: IPoint, bricks: IPdfBrick[], controller: DocController, repository: FlatRepository, module: any);
1295
+ }
1296
+ export declare class AdornersOptions extends AdornersBaseOptions {
1297
+ question: Question;
1298
+ constructor(point: IPoint, bricks: IPdfBrick[], question: Question, controller: DocController, repository: FlatRepository, module: any);
1299
+ }
1300
+ export declare class AdornersPanelOptions extends AdornersBaseOptions {
1301
+ panel: PanelModel;
1302
+ constructor(point: IPoint, bricks: IPdfBrick[], panel: PanelModel, controller: DocController, repository: FlatRepository, module: any);
1303
+ }
1304
+ export declare class AdornersPageOptions extends AdornersBaseOptions {
1305
+ page: PageModel;
1306
+ constructor(point: IPoint, bricks: IPdfBrick[], page: PageModel, controller: DocController, repository: FlatRepository, module: any);
1307
+ }
1308
+
1309
+