survey-pdf 1.9.74 → 1.9.76
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/survey.pdf.d.ts +266 -85
- package/survey.pdf.fonts.js +1 -1
- package/survey.pdf.fonts.min.js +1 -1
- package/survey.pdf.js +157 -39
- package/survey.pdf.min.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "survey-pdf",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.76",
|
|
4
4
|
"description": "survey.pdf.js is a SurveyJS PDF Library. It is a easy way to export SurveyJS surveys to PDF. It uses JSON for survey metadata.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Survey",
|
|
@@ -26,6 +26,6 @@
|
|
|
26
26
|
"typings": "survey.pdf.d.ts",
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"jspdf": "^2.3.0",
|
|
29
|
-
"survey-core": "1.9.
|
|
29
|
+
"survey-core": "1.9.76"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/survey.pdf.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*Type definitions for SurveyJS PDF library v1.9.
|
|
1
|
+
/*Type definitions for SurveyJS PDF library v1.9.76
|
|
2
2
|
Copyright (c) 2015-2023 Devsoft Baltic OÜ - http://surveyjs.io/
|
|
3
3
|
Definitions by: Devsoft Baltic OÜ <https://github.com/surveyjs/>
|
|
4
4
|
*/
|
|
@@ -29,46 +29,120 @@ import { EventBase } from 'survey-core';
|
|
|
29
29
|
import { PageModel } from 'survey-core';
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
|
-
* SurveyPDF object
|
|
32
|
+
* The `SurveyPDF` object enables you to export your surveys and forms to PDF documents.
|
|
33
|
+
*
|
|
34
|
+
* [View Demo](https://surveyjs.io/pdf-generator/examples/ (linkStyle))
|
|
33
35
|
*/
|
|
34
36
|
export declare class SurveyPDF extends SurveyModel {
|
|
35
37
|
options: IDocOptions;
|
|
36
38
|
constructor(jsonObject: any, options?: IDocOptions);
|
|
37
39
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
40
|
+
* Removes watermarks from the exported document.
|
|
41
|
+
*
|
|
42
|
+
* > You can enable this property only if you have a SurveyJS PDF Generator [commercial license](https://surveyjs.io/pricing). It is illegal to enable this property without a license.
|
|
41
43
|
*/
|
|
42
44
|
get haveCommercialLicense(): boolean;
|
|
43
45
|
set haveCommercialLicense(val: boolean);
|
|
44
46
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
47
|
+
* An event that is raised when SurveyJS PDF Generator renders a page header. Handle this event to customize the header.
|
|
48
|
+
*
|
|
49
|
+
* Parameters:
|
|
50
|
+
*
|
|
51
|
+
* - `sender`: `SurveyPDF`\
|
|
52
|
+
* A SurveyPDF instance that raised the event.
|
|
53
|
+
*
|
|
54
|
+
* - `canvas`: [`DrawCanvas`](https://surveyjs.io/pdf-generator/documentation/api-reference/drawcanvas)\
|
|
55
|
+
* An object that you can use to draw text and images in the page header.
|
|
56
|
+
*
|
|
57
|
+
* [View Demo](https://surveyjs.io/pdf-generator/examples/customize-header-and-footer-of-pdf-form/ (linkStyle))
|
|
48
58
|
*/
|
|
49
59
|
onRenderHeader: EventAsync<SurveyPDF, DrawCanvas>;
|
|
50
60
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
61
|
+
* An event that is raised when SurveyJS PDF Generator renders a page footer. Handle this event to customize the footer.
|
|
62
|
+
*
|
|
63
|
+
* Parameters:
|
|
64
|
+
*
|
|
65
|
+
* - `sender`: `SurveyPDF`\
|
|
66
|
+
* A SurveyPDF instance that raised the event.
|
|
67
|
+
*
|
|
68
|
+
* - `canvas`: [`DrawCanvas`](https://surveyjs.io/pdf-generator/documentation/api-reference/drawcanvas)\
|
|
69
|
+
* An object that you can use to draw text and images in the page footer.
|
|
70
|
+
*
|
|
71
|
+
* [View Demo](https://surveyjs.io/pdf-generator/examples/customize-header-and-footer-of-pdf-form/ (linkStyle))
|
|
54
72
|
*/
|
|
55
73
|
onRenderFooter: EventAsync<SurveyPDF, DrawCanvas>;
|
|
56
74
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
75
|
+
* An event that is raised when SurveyJS PDF Generator renders a survey question. Handle this event to customize question rendering.
|
|
76
|
+
*
|
|
77
|
+
* Parameters:
|
|
78
|
+
*
|
|
79
|
+
* - `sender`: `SurveyPDF`\
|
|
80
|
+
* A SurveyPDF instance that raised the event.
|
|
81
|
+
*
|
|
82
|
+
* - `options.question`: [`Question`](https://surveyjs.io/form-library/documentation/api-reference/question)\
|
|
83
|
+
* A survey question that is being rendered.
|
|
84
|
+
*
|
|
85
|
+
* - `options.point`: `IPoint`\
|
|
86
|
+
* An object with coordinates of the top-left corner of the element being rendered. This object contains the following properties: `{ xLeft: number, yTop: number }`.
|
|
87
|
+
*
|
|
88
|
+
* - `options.bricks`: [`PdfBrick[]`](https://surveyjs.io/pdf-generator/documentation/api-reference/pdfbrick)\
|
|
89
|
+
* An array of [bricks](https://surveyjs.io/pdf-generator/documentation/customization-customrender-questionelements#bricks) used to render the element.
|
|
90
|
+
*
|
|
91
|
+
* - `options.controller`: [`DocController`](https://surveyjs.io/pdf-generator/documentation/api-reference/doccontroller)\
|
|
92
|
+
* An object that provides access to main PDF document properties (font, margins, page width and height) and allows you to modify them.
|
|
93
|
+
*
|
|
94
|
+
* - `options.repository`: `FlatRepository`\
|
|
95
|
+
* 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.
|
|
96
|
+
*
|
|
97
|
+
* [View Demo](https://surveyjs.io/pdf-generator/examples/customize-header-and-footer-of-pdf-form/ (linkStyle))
|
|
60
98
|
*/
|
|
61
99
|
onRenderQuestion: EventAsync<SurveyPDF, AdornersOptions>;
|
|
62
100
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
101
|
+
* An event that is raised when SurveyJS PDF Generator renders a panel. Handle this event to customize panel rendering.
|
|
102
|
+
*
|
|
103
|
+
* Parameters:
|
|
104
|
+
*
|
|
105
|
+
* - `sender`: `SurveyPDF`\
|
|
106
|
+
* A SurveyPDF instance that raised the event.
|
|
107
|
+
*
|
|
108
|
+
* - `options.panel`: [`PanelModel`](https://surveyjs.io/form-library/documentation/api-reference/panel-model)\
|
|
109
|
+
* A panel that is being rendered.
|
|
110
|
+
*
|
|
111
|
+
* - `options.point`: `IPoint`\
|
|
112
|
+
* An object with coordinates of the top-left corner of the element being rendered. This object contains the following properties: `{ xLeft: number, yTop: number }`.
|
|
113
|
+
*
|
|
114
|
+
* - `options.bricks`: [`PdfBrick[]`](https://surveyjs.io/pdf-generator/documentation/api-reference/pdfbrick)\
|
|
115
|
+
* An array of [bricks](https://surveyjs.io/pdf-generator/documentation/customization-customrender-questionelements#bricks) used to render the element.
|
|
116
|
+
*
|
|
117
|
+
* - `options.controller`: [`DocController`](https://surveyjs.io/pdf-generator/documentation/api-reference/doccontroller)\
|
|
118
|
+
* An object that provides access to main PDF document properties (font, margins, page width and height) and allows you to modify them.
|
|
119
|
+
*
|
|
120
|
+
* - `options.repository`: `FlatRepository`\
|
|
121
|
+
* 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.
|
|
66
122
|
*/
|
|
67
123
|
onRenderPanel: EventAsync<SurveyPDF, AdornersPanelOptions>;
|
|
68
124
|
/**
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
125
|
+
* An event that is raised when SurveyJS PDF Generator renders a page. Handle this event to customize page rendering.
|
|
126
|
+
*
|
|
127
|
+
* Parameters:
|
|
128
|
+
*
|
|
129
|
+
* - `sender`: `SurveyPDF`\
|
|
130
|
+
* A SurveyPDF instance that raised the event.
|
|
131
|
+
*
|
|
132
|
+
* - `options.page`: [`PageModel`](https://surveyjs.io/form-library/documentation/api-reference/page-model)\
|
|
133
|
+
* A page that is being rendered.
|
|
134
|
+
*
|
|
135
|
+
* - `options.point`: `IPoint`\
|
|
136
|
+
* An object with coordinates of the top-left corner of the element being rendered. This object contains the following properties: `{ xLeft: number, yTop: number }`.
|
|
137
|
+
*
|
|
138
|
+
* - `options.bricks`: [`PdfBrick[]`](https://surveyjs.io/pdf-generator/documentation/api-reference/pdfbrick)\
|
|
139
|
+
* An array of [bricks](https://surveyjs.io/pdf-generator/documentation/customization-customrender-questionelements#bricks) used to render the element.
|
|
140
|
+
*
|
|
141
|
+
* - `options.controller`: [`DocController`](https://surveyjs.io/pdf-generator/documentation/api-reference/doccontroller)\
|
|
142
|
+
* An object that provides access to main PDF document properties (font, margins, page width and height) and allows you to modify them.
|
|
143
|
+
*
|
|
144
|
+
* - `options.repository`: `FlatRepository`\
|
|
145
|
+
* 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.
|
|
72
146
|
*/
|
|
73
147
|
onRenderPage: EventAsync<SurveyPDF, AdornersPageOptions>;
|
|
74
148
|
onRenderCheckItemAcroform: EventAsync<SurveyPDF, any>;
|
|
@@ -79,13 +153,18 @@ export declare class SurveyPDF extends SurveyModel {
|
|
|
79
153
|
getUpdatedRadioItemAcroformOptions(options: any): void;
|
|
80
154
|
protected renderSurvey(controller: DocController): Promise<void>;
|
|
81
155
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
156
|
+
* An asynchronous method that starts download of the generated PDF file in the web browser.
|
|
157
|
+
*
|
|
158
|
+
* @param fileName *(Optional)* A file name with the ".pdf" extension. Default value: `"survey_result.pdf"`.
|
|
84
159
|
*/
|
|
85
160
|
save(fileName?: string): Promise<any>;
|
|
86
161
|
/**
|
|
87
|
-
*
|
|
88
|
-
*
|
|
162
|
+
* An asynchronous method that allows you to get PDF content in different formats.
|
|
163
|
+
*
|
|
164
|
+
* [View Demo](https://surveyjs.io/pdf-generator/examples/convert-pdf-form-blob-base64-raw-pdf-javascript/ (linkStyle))
|
|
165
|
+
*
|
|
166
|
+
* @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.
|
|
167
|
+
*
|
|
89
168
|
*/
|
|
90
169
|
raw(type?: string): Promise<string>;
|
|
91
170
|
}
|
|
@@ -202,11 +281,26 @@ export declare class SurveyHelper {
|
|
|
202
281
|
import './jspdf_plugins/acroform.js';
|
|
203
282
|
import './jspdf_plugins/from_html.js';
|
|
204
283
|
export interface IPoint {
|
|
284
|
+
/**
|
|
285
|
+
* An X-coordinate for the left element edge.
|
|
286
|
+
*/
|
|
205
287
|
xLeft: number;
|
|
288
|
+
/**
|
|
289
|
+
* A Y-coordinate for the top element edge.
|
|
290
|
+
*/
|
|
206
291
|
yTop: number;
|
|
207
292
|
}
|
|
293
|
+
/**
|
|
294
|
+
* An interface that describes a rectangle.
|
|
295
|
+
*/
|
|
208
296
|
export interface IRect extends IPoint {
|
|
297
|
+
/**
|
|
298
|
+
* An X-coordinate for the right element edge.
|
|
299
|
+
*/
|
|
209
300
|
xRight: number;
|
|
301
|
+
/**
|
|
302
|
+
* A Y-coordinate for the bottom element edge.
|
|
303
|
+
*/
|
|
210
304
|
yBot: number;
|
|
211
305
|
}
|
|
212
306
|
export interface ISize {
|
|
@@ -214,11 +308,26 @@ export interface ISize {
|
|
|
214
308
|
height: number;
|
|
215
309
|
}
|
|
216
310
|
export interface IMarginLR {
|
|
311
|
+
/**
|
|
312
|
+
* A left margin.
|
|
313
|
+
*/
|
|
217
314
|
left?: number;
|
|
315
|
+
/**
|
|
316
|
+
* A right margin.
|
|
317
|
+
*/
|
|
218
318
|
right?: number;
|
|
219
319
|
}
|
|
320
|
+
/**
|
|
321
|
+
* An interface that describes margins.
|
|
322
|
+
*/
|
|
220
323
|
export interface IMargin extends IMarginLR {
|
|
324
|
+
/**
|
|
325
|
+
* A top margin.
|
|
326
|
+
*/
|
|
221
327
|
top?: number;
|
|
328
|
+
/**
|
|
329
|
+
* A bottom margin.
|
|
330
|
+
*/
|
|
222
331
|
bot?: number;
|
|
223
332
|
}
|
|
224
333
|
/**
|
|
@@ -226,14 +335,19 @@ export interface IMargin extends IMarginLR {
|
|
|
226
335
|
*
|
|
227
336
|
* ```js
|
|
228
337
|
* const surveyPdf = new SurveyPDF.SurveyPDF(surveyJson, pdfDocOptions);
|
|
338
|
+
*
|
|
339
|
+
* // In modular applications:
|
|
340
|
+
import { SurveyPDF } from "survey-pdf";
|
|
341
|
+
* const surveyPdf = new SurveyPDF(surveyJson, pdfDocOptions);
|
|
229
342
|
* ```
|
|
230
343
|
*/
|
|
231
344
|
export interface IDocOptions {
|
|
232
345
|
/**
|
|
233
346
|
* Page orientation.
|
|
234
|
-
* Accepted values:
|
|
235
347
|
*
|
|
236
|
-
*
|
|
348
|
+
* Possible values:
|
|
349
|
+
*
|
|
350
|
+
* - `"p"` (default) - Portrait orientation.
|
|
237
351
|
* - `"l"` - Landscape orientation.
|
|
238
352
|
*
|
|
239
353
|
* @see format
|
|
@@ -241,7 +355,8 @@ export interface IDocOptions {
|
|
|
241
355
|
orientation?: 'p' | 'l';
|
|
242
356
|
/**
|
|
243
357
|
* Page format.
|
|
244
|
-
*
|
|
358
|
+
*
|
|
359
|
+
* Possible values:
|
|
245
360
|
*
|
|
246
361
|
* - `"a0"` - `"a10"` (`"a4"` is default)
|
|
247
362
|
* - `"b0"` - `"b10"`
|
|
@@ -262,12 +377,15 @@ export interface IDocOptions {
|
|
|
262
377
|
/**
|
|
263
378
|
* Font size in points.
|
|
264
379
|
*
|
|
380
|
+
* Default value: 14
|
|
381
|
+
*
|
|
265
382
|
* @see fontName
|
|
266
383
|
*/
|
|
267
384
|
fontSize?: number;
|
|
268
385
|
/**
|
|
269
386
|
* Font name.
|
|
270
|
-
*
|
|
387
|
+
*
|
|
388
|
+
* Possible values:
|
|
271
389
|
*
|
|
272
390
|
* - `"Helvetica"` (default)
|
|
273
391
|
* - `"Courier"`
|
|
@@ -284,19 +402,20 @@ export interface IDocOptions {
|
|
|
284
402
|
base64Bold?: string;
|
|
285
403
|
useCustomFontInHtml?: boolean;
|
|
286
404
|
/**
|
|
287
|
-
* Page margins. Set this property to an object with the following fields: `top`, `
|
|
405
|
+
* Page margins. Set this property to an object with the following fields: `top`, `bot`, `left`, `right`.
|
|
288
406
|
*/
|
|
289
407
|
margins?: IMargin;
|
|
290
408
|
commercial?: boolean;
|
|
291
409
|
/**
|
|
292
410
|
* Removes watermarks from the exported document.
|
|
293
411
|
*
|
|
294
|
-
* > You can enable this property only if you have a SurveyJS PDF Generator commercial license. It is illegal to enable this property without a license.
|
|
412
|
+
* > You can enable this property only if you have a SurveyJS PDF Generator [commercial license](https://surveyjs.io/pricing). It is illegal to enable this property without a license.
|
|
295
413
|
*/
|
|
296
414
|
haveCommercialLicense?: boolean;
|
|
297
415
|
/**
|
|
298
416
|
* Specifies how to render [HTML questions](https://surveyjs.io/Documentation/Library?id=questionhtmlmodel) into PDF.
|
|
299
|
-
*
|
|
417
|
+
*
|
|
418
|
+
* Possible values:
|
|
300
419
|
*
|
|
301
420
|
* - `"standard"` - Render HTML questions as selectable text.
|
|
302
421
|
* - `"image"` - Render HTML questions as images.
|
|
@@ -307,7 +426,8 @@ export interface IDocOptions {
|
|
|
307
426
|
htmlRenderAs?: IHTMLRenderType;
|
|
308
427
|
/**
|
|
309
428
|
* 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.
|
|
310
|
-
*
|
|
429
|
+
*
|
|
430
|
+
* Possible values:
|
|
311
431
|
*
|
|
312
432
|
* - `"list"` - Render matrix-like questions as lists.
|
|
313
433
|
* - `"auto"` (default) - Render matrix-like questions as tables if they fit into the available space. Otherwise, render the questions as lists.
|
|
@@ -318,7 +438,8 @@ export interface IDocOptions {
|
|
|
318
438
|
useLegacyBooleanRendering?: boolean;
|
|
319
439
|
/**
|
|
320
440
|
* Specifies how to render read-only questions.
|
|
321
|
-
*
|
|
441
|
+
*
|
|
442
|
+
* Possible values:
|
|
322
443
|
*
|
|
323
444
|
* - `"text"` - Render read-only questions as plain text and custom primitives.
|
|
324
445
|
* - `"acroform"` - Use Acrobat Forms (AcroForms) to render questions that support them. Other questions are rendered in `"text"` mode.
|
|
@@ -327,19 +448,16 @@ export interface IDocOptions {
|
|
|
327
448
|
readonlyRenderAs?: 'auto' | 'text' | 'acroform';
|
|
328
449
|
textFieldRenderAs?: 'singleLine' | 'multiLine';
|
|
329
450
|
/**
|
|
330
|
-
* Specifies whether to compress the PDF document.
|
|
331
|
-
* Compressed documents do not support [custom fonts](https://surveyjs.io/Documentation/Pdf-Export?id=Customization-ChangeFonts#use-custom-font).
|
|
451
|
+
* 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).
|
|
332
452
|
*/
|
|
333
453
|
compress?: boolean;
|
|
334
454
|
/**
|
|
335
455
|
* Specifies whether to apply the [imageFit](https://surveyjs.io/Documentation/Library?id=questionimagemodel#imageFit) property to exported [Image](https://surveyjs.io/Documentation/Library?id=questionimagemodel) questions.
|
|
456
|
+
*
|
|
336
457
|
* 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.
|
|
337
458
|
*/
|
|
338
459
|
applyImageFit?: boolean;
|
|
339
460
|
}
|
|
340
|
-
/**
|
|
341
|
-
* Contains a set of options that affect the appearance of a PDF document rendered by SurveyPDF.
|
|
342
|
-
*/
|
|
343
461
|
export declare class DocOptions implements IDocOptions {
|
|
344
462
|
static readonly MM_TO_PT: number;
|
|
345
463
|
static readonly FONT_SIZE = 14;
|
|
@@ -378,6 +496,11 @@ export declare class DocOptions implements IDocOptions {
|
|
|
378
496
|
get applyImageFit(): boolean;
|
|
379
497
|
get useLegacyBooleanRendering(): boolean;
|
|
380
498
|
}
|
|
499
|
+
/**
|
|
500
|
+
* 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.
|
|
501
|
+
*
|
|
502
|
+
* [View Demo](https://surveyjs.io/pdf-generator/examples/how-to-use-adorners-in-pdf-forms/ (linkStyle))
|
|
503
|
+
*/
|
|
381
504
|
export declare class DocController extends DocOptions {
|
|
382
505
|
constructor(options?: IDocOptions);
|
|
383
506
|
static customFonts: {
|
|
@@ -398,11 +521,23 @@ export declare class DocController extends DocOptions {
|
|
|
398
521
|
get fontStyle(): string;
|
|
399
522
|
set fontStyle(fontStyle: string);
|
|
400
523
|
measureText(text?: string | LocalizableString | number, fontStyle?: string, fontSize?: number): ISize;
|
|
524
|
+
/**
|
|
525
|
+
* The width of one character in pixels.
|
|
526
|
+
*/
|
|
401
527
|
get unitWidth(): number;
|
|
528
|
+
/**
|
|
529
|
+
* The heigth of one character in pixels.
|
|
530
|
+
*/
|
|
402
531
|
get unitHeight(): number;
|
|
403
532
|
pushMargins(left?: number, right?: number): void;
|
|
404
533
|
popMargins(): void;
|
|
534
|
+
/**
|
|
535
|
+
* The width of a PDF page in pixels.
|
|
536
|
+
*/
|
|
405
537
|
get paperWidth(): number;
|
|
538
|
+
/**
|
|
539
|
+
* The height of a PDF page in pixels.
|
|
540
|
+
*/
|
|
406
541
|
get paperHeight(): number;
|
|
407
542
|
getNumberOfPages(): number;
|
|
408
543
|
addPage(): void;
|
|
@@ -673,63 +808,78 @@ export declare enum VerticalAlign {
|
|
|
673
808
|
Middle = "middle",
|
|
674
809
|
Bottom = "bottom"
|
|
675
810
|
}
|
|
676
|
-
/**
|
|
677
|
-
* Common options of rendering text and images in onRenderHeader and onRenderFooter events
|
|
678
|
-
*/
|
|
679
811
|
export interface IDrawRectOptions {
|
|
680
812
|
/**
|
|
681
|
-
*
|
|
813
|
+
* Horizontal alignment within the rectangle that limits the drawing area.
|
|
814
|
+
*
|
|
815
|
+
* Possible values:
|
|
816
|
+
*
|
|
817
|
+
* - `"center"` (default)
|
|
818
|
+
* - `"left"`
|
|
819
|
+
* - `"right"`
|
|
682
820
|
*/
|
|
683
821
|
horizontalAlign?: HorizontalAlign;
|
|
684
822
|
/**
|
|
685
|
-
*
|
|
823
|
+
* Vertical alignment within the rectangle that limits the drawing area.
|
|
824
|
+
*
|
|
825
|
+
* Possible values:
|
|
826
|
+
*
|
|
827
|
+
* - `"middle"` (default)
|
|
828
|
+
* - `"top"`
|
|
829
|
+
* - `"bottom"`
|
|
686
830
|
*/
|
|
687
831
|
verticalAlign?: VerticalAlign;
|
|
688
832
|
/**
|
|
689
|
-
*
|
|
833
|
+
* 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.
|
|
690
834
|
*/
|
|
691
835
|
margins?: IMargin;
|
|
692
836
|
/**
|
|
693
|
-
*
|
|
837
|
+
* An object with coordinates of the rectangle.
|
|
694
838
|
*/
|
|
695
839
|
rect?: IRect;
|
|
696
840
|
}
|
|
697
841
|
/**
|
|
698
|
-
*
|
|
842
|
+
* An object that configures rendering a piece of text.
|
|
699
843
|
*/
|
|
700
844
|
export interface IDrawTextOptions extends IDrawRectOptions {
|
|
701
845
|
/**
|
|
702
|
-
*
|
|
846
|
+
* A text string to be drawn.
|
|
703
847
|
*/
|
|
704
848
|
text: string;
|
|
705
849
|
/**
|
|
706
|
-
* Font size
|
|
850
|
+
* Font size in points.
|
|
851
|
+
*
|
|
852
|
+
* Default value: 14
|
|
707
853
|
*/
|
|
708
854
|
fontSize?: number;
|
|
709
855
|
/**
|
|
710
|
-
*
|
|
856
|
+
* Enable this property to render the text string bold.
|
|
857
|
+
*
|
|
858
|
+
* Default value: `false`
|
|
711
859
|
*/
|
|
712
860
|
isBold?: boolean;
|
|
713
861
|
}
|
|
714
862
|
/**
|
|
715
|
-
*
|
|
863
|
+
* An object that configures rendering an image.
|
|
716
864
|
*/
|
|
717
865
|
export interface IDrawImageOptions extends IDrawRectOptions {
|
|
718
866
|
/**
|
|
719
|
-
*
|
|
867
|
+
* An image width in pixels. Defaults to the [rectangle width](https://surveyjs.io/pdf-generator/documentation/api-reference/idrawimageoptions#rect).
|
|
720
868
|
*/
|
|
721
869
|
width?: number;
|
|
722
870
|
/**
|
|
723
|
-
*
|
|
871
|
+
* An image height in pixels. Defaults to the [rectangle height](https://surveyjs.io/pdf-generator/documentation/api-reference/idrawimageoptions#rect).
|
|
724
872
|
*/
|
|
725
873
|
height?: number;
|
|
726
874
|
/**
|
|
727
|
-
*
|
|
875
|
+
* A string value with a base64-encoded image to be drawn.
|
|
728
876
|
*/
|
|
729
877
|
base64: string;
|
|
730
878
|
}
|
|
731
879
|
/**
|
|
732
|
-
*
|
|
880
|
+
* 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.
|
|
881
|
+
*
|
|
882
|
+
* [View Demo](https://surveyjs.io/pdf-generator/examples/customize-header-and-footer-of-pdf-form/ (linkStyle))
|
|
733
883
|
*/
|
|
734
884
|
export declare class DrawCanvas {
|
|
735
885
|
protected packs: IPdfBrick[];
|
|
@@ -739,56 +889,87 @@ export declare class DrawCanvas {
|
|
|
739
889
|
protected _pageNumber: number;
|
|
740
890
|
constructor(packs: IPdfBrick[], controller: DocController, _rect: IRect, _countPages: number, _pageNumber: number);
|
|
741
891
|
/**
|
|
742
|
-
*
|
|
892
|
+
* A total number of pages in the document.
|
|
743
893
|
*/
|
|
894
|
+
get pageCount(): number;
|
|
744
895
|
get countPages(): number;
|
|
745
896
|
/**
|
|
746
|
-
*
|
|
897
|
+
* The number of the page that contains the drawing area. Enumeration starts with 1.
|
|
747
898
|
*/
|
|
748
899
|
get pageNumber(): number;
|
|
749
900
|
/**
|
|
750
|
-
*
|
|
751
|
-
* @see IRect
|
|
901
|
+
* An object with coordinates of a rectangle that limits the drawing area.
|
|
752
902
|
*/
|
|
753
903
|
get rect(): IRect;
|
|
754
904
|
/**
|
|
755
|
-
*
|
|
756
|
-
* @param textOptions
|
|
905
|
+
* Draws a piece of text within the drawing area.
|
|
906
|
+
* @param textOptions An object that configures the drawing.
|
|
757
907
|
*/
|
|
758
908
|
drawText(textOptions: IDrawTextOptions): void;
|
|
759
909
|
/**
|
|
760
|
-
*
|
|
761
|
-
* @param imageOptions
|
|
910
|
+
* Draws an image within the drawing area.
|
|
911
|
+
* @param imageOptions An object that configures drawing.
|
|
762
912
|
*/
|
|
763
913
|
drawImage(imageOptions: IDrawImageOptions): Promise<void>;
|
|
764
914
|
}
|
|
765
915
|
|
|
766
916
|
export interface IPdfBrick extends IRect, ISize {
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
917
|
+
render(): Promise<void>;
|
|
918
|
+
unfold(): IPdfBrick[];
|
|
919
|
+
isPageBreak: boolean;
|
|
770
920
|
}
|
|
921
|
+
/**
|
|
922
|
+
* An object that describes a PDF brick—a simple element with specified content, size, and location. Bricks are fundamental elements used to construct a PDF document.
|
|
923
|
+
*
|
|
924
|
+
* 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.
|
|
925
|
+
*
|
|
926
|
+
* [View Demo](https://surveyjs.io/pdf-generator/examples/add-markup-to-customize-pdf-forms/ (linkStyle))
|
|
927
|
+
*/
|
|
771
928
|
export declare class PdfBrick implements IPdfBrick {
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
929
|
+
protected question: IQuestion;
|
|
930
|
+
protected controller: DocController;
|
|
931
|
+
/**
|
|
932
|
+
* An X-coordinate for the left brick edge.
|
|
933
|
+
*/
|
|
934
|
+
xLeft: number;
|
|
935
|
+
/**
|
|
936
|
+
* An X-coordinate for the right brick edge.
|
|
937
|
+
*/
|
|
938
|
+
xRight: number;
|
|
939
|
+
/**
|
|
940
|
+
* A Y-coordinate for the top brick edge.
|
|
941
|
+
*/
|
|
942
|
+
yTop: number;
|
|
943
|
+
/**
|
|
944
|
+
* A Y-coordinate for the bottom brick edge.
|
|
945
|
+
*/
|
|
946
|
+
yBot: number;
|
|
947
|
+
/**
|
|
948
|
+
* Font size in points.
|
|
949
|
+
*
|
|
950
|
+
* Default value: 14 (inherited from the parent PDF document)
|
|
951
|
+
*/
|
|
952
|
+
fontSize: number;
|
|
953
|
+
textColor: string;
|
|
954
|
+
formBorderColor: string;
|
|
955
|
+
isPageBreak: boolean;
|
|
956
|
+
constructor(question: IQuestion, controller: DocController, rect: IRect);
|
|
957
|
+
/**
|
|
958
|
+
* The brick's width in pixels.
|
|
959
|
+
*/
|
|
960
|
+
get width(): number;
|
|
961
|
+
/**
|
|
962
|
+
* The brick's height in pixels.
|
|
963
|
+
*/
|
|
964
|
+
get height(): number;
|
|
965
|
+
render(): Promise<void>;
|
|
966
|
+
renderInteractive(): Promise<void>;
|
|
967
|
+
renderReadOnly(): Promise<void>;
|
|
968
|
+
/**
|
|
969
|
+
* Allows you to get a flat array of nested PDF bricks.
|
|
970
|
+
* @returns A flat array of nested PDF bricks.
|
|
971
|
+
*/
|
|
972
|
+
unfold(): IPdfBrick[];
|
|
792
973
|
}
|
|
793
974
|
|
|
794
975
|
export declare class BooleanItemBrick extends CheckItemBrick {
|
package/survey.pdf.fonts.js
CHANGED
package/survey.pdf.fonts.min.js
CHANGED