survey-pdf 2.0.10 → 2.1.0
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/fesm/pdf-form-filler-shared.mjs +16 -11
- package/fesm/pdf-form-filler-shared.mjs.map +1 -1
- package/fesm/pdf-form-filler.mjs +10 -1
- package/fesm/pdf-form-filler.mjs.map +1 -1
- package/fesm/pdf-form-filler.node.mjs +1 -1
- package/fesm/survey.pdf.fonts.mjs +1 -1
- package/fesm/survey.pdf.mjs +3 -3
- package/fesm/survey.pdf.mjs.map +1 -1
- package/forms-typings/entries/helpers.d.ts +7 -0
- package/{typings → forms-typings}/pdf_forms/adapters/pdf-lib.d.ts +1 -1
- package/{typings → forms-typings}/pdf_forms/adapters/pdfjs.d.ts +1 -1
- package/forms-typings/pdf_forms/forms-base.d.ts +123 -0
- package/forms-typings/pdf_forms/forms.d.ts +13 -0
- package/package.json +3 -2
- package/pdf-form-filler.js +27 -14
- package/pdf-form-filler.js.map +1 -1
- package/pdf-form-filler.min.js +1 -1
- package/pdf-form-filler.min.js.LICENSE.txt +1 -1
- package/pdf-form-filler.node.js +18 -14
- package/pdf-form-filler.node.js.map +1 -1
- package/pdf-form-filler.node.min.js +1 -1
- package/pdf-form-filler.node.min.js.LICENSE.txt +1 -1
- package/survey.pdf.fonts.js +1 -1
- package/survey.pdf.fonts.min.js.LICENSE.txt +1 -1
- package/survey.pdf.js +3 -3
- package/survey.pdf.js.map +1 -1
- package/survey.pdf.min.js +1 -1
- package/survey.pdf.min.js.LICENSE.txt +1 -1
- package/typings/survey.d.ts +1 -1
- package/typings/helper_test.d.ts +0 -21
- package/typings/pdf_forms/forms-base.d.ts +0 -32
- package/typings/pdf_forms/forms.d.ts +0 -4
- /package/{typings → forms-typings}/entries/forms-node.d.ts +0 -0
- /package/{typings → forms-typings}/entries/forms.d.ts +0 -0
- /package/{typings → forms-typings}/pdf_forms/adapters/adapter.d.ts +0 -0
- /package/{typings → forms-typings}/pdf_forms/forms-node.d.ts +0 -0
- /package/{typings → forms-typings}/pdf_forms/map.d.ts +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function __extends(d: any, b: any): void;
|
|
2
|
+
export declare var __assign: () => any;
|
|
3
|
+
export declare function __rest(s: any, e: any): any;
|
|
4
|
+
export declare function __decorate(decorators: any, target: any, key: any, desc: any): any;
|
|
5
|
+
export declare function __awaiter(thisArg: any, _arguments: any, P: any, generator: any): any;
|
|
6
|
+
export declare function __generator(thisArg: any, body: any): any;
|
|
7
|
+
export declare function __spreadArray(to: any, from: any, pack: any): any;
|
|
@@ -2,5 +2,5 @@ import { IPDFFormAdapter } from './adapter';
|
|
|
2
2
|
export declare class PDFLibAdapter implements IPDFFormAdapter {
|
|
3
3
|
private pdfLibrary;
|
|
4
4
|
constructor(pdfLibrary: any);
|
|
5
|
-
fillForm(template:
|
|
5
|
+
fillForm(template: any, data: any): Promise<any>;
|
|
6
6
|
}
|
|
@@ -2,5 +2,5 @@ import { IPDFFormAdapter } from './adapter';
|
|
|
2
2
|
export declare class PDFJSAdapter implements IPDFFormAdapter {
|
|
3
3
|
private pdfLibrary;
|
|
4
4
|
constructor(pdfLibrary: any);
|
|
5
|
-
fillForm(template:
|
|
5
|
+
fillForm(template: any, data: any): Promise<any>;
|
|
6
6
|
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { IPDFFormAdapter } from './adapters/adapter';
|
|
2
|
+
/**
|
|
3
|
+
* An object that configures the [`PDFFormFiller`](https://surveyjs.io/pdf-generator/documentation/api-reference/pdfformfiller) plugin.
|
|
4
|
+
*
|
|
5
|
+
* Pass this object to the `PDFFormFiller` constructor:
|
|
6
|
+
*
|
|
7
|
+
* ```js
|
|
8
|
+
* const form = new PDFFormFiller.PDFFormFiller(pdfFormFillerOptions);
|
|
9
|
+
*
|
|
10
|
+
* // In modular applications:
|
|
11
|
+
* import { PDFFormFiller } from "survey-pdf/pdf-form-filler";
|
|
12
|
+
* const form = new PDFFormFiller(pdfFormFillerOptions);
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* [View pdf-lib Demo](https://surveyjs.io/pdf-generator/examples/map-survey-responses-to-pdf-fields-using-pdflib/ (linkStyle))
|
|
16
|
+
*
|
|
17
|
+
* [View PDF.js Demo](https://surveyjs.io/pdf-generator/examples/fill-in-pdf-form-fields-with-dynamic-survey-data-using-pdfjs/ (linkStyle))
|
|
18
|
+
*/
|
|
19
|
+
interface IPDFFormFillerOptions {
|
|
20
|
+
/**
|
|
21
|
+
* An object that maps survey fields to PDF form fields. Object keys are survey field names and object values are PDF form field IDs.
|
|
22
|
+
*
|
|
23
|
+
* The easiest way to build a field map is to access the data object with respondent answers using the `SurveyModel`'s `data` property and replace the values with the PDF form field IDs. To find the IDs, open your PDF document in any editor that allows viewing them. Note that certain field types, such as [Checkboxes](https://surveyjs.io/form-library/examples/create-checkboxes-question-in-javascript/), [Dynamic Matrix](https://surveyjs.io/form-library/examples/dynamic-matrix-add-new-rows/), and [Dynamic Panel](https://surveyjs.io/form-library/examples/duplicate-group-of-fields-in-form/) require a different configuration. Refer to the following demos for code examples.
|
|
24
|
+
*
|
|
25
|
+
* [View pdf-lib Demo](https://surveyjs.io/pdf-generator/examples/map-survey-responses-to-pdf-fields-using-pdflib/ (linkStyle))
|
|
26
|
+
*
|
|
27
|
+
* [View PDF.js Demo](https://surveyjs.io/pdf-generator/examples/fill-in-pdf-form-fields-with-dynamic-survey-data-using-pdfjs/ (linkStyle))
|
|
28
|
+
*/
|
|
29
|
+
fieldMap?: any;
|
|
30
|
+
/**
|
|
31
|
+
* An object with data used to populate the PDF document.
|
|
32
|
+
*
|
|
33
|
+
* Use the [`SurveyModel`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model)'s [`data`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#data) property to access this data object.
|
|
34
|
+
*
|
|
35
|
+
* [View pdf-lib Demo](https://surveyjs.io/pdf-generator/examples/map-survey-responses-to-pdf-fields-using-pdflib/ (linkStyle))
|
|
36
|
+
*
|
|
37
|
+
* [View PDF.js Demo](https://surveyjs.io/pdf-generator/examples/fill-in-pdf-form-fields-with-dynamic-survey-data-using-pdfjs/ (linkStyle))
|
|
38
|
+
*/
|
|
39
|
+
data?: any;
|
|
40
|
+
/**
|
|
41
|
+
* A PDF document with interactive form fields that you want to fill.
|
|
42
|
+
*
|
|
43
|
+
* Because this document is passed on to a third-party library, the type of accepted values depends on this library.
|
|
44
|
+
*
|
|
45
|
+
* [View pdf-lib Demo](https://surveyjs.io/pdf-generator/examples/map-survey-responses-to-pdf-fields-using-pdflib/ (linkStyle))
|
|
46
|
+
*
|
|
47
|
+
* [View PDF.js Demo](https://surveyjs.io/pdf-generator/examples/fill-in-pdf-form-fields-with-dynamic-survey-data-using-pdfjs/ (linkStyle))
|
|
48
|
+
*/
|
|
49
|
+
pdfTemplate?: any;
|
|
50
|
+
/**
|
|
51
|
+
* An adapter that serves as a bridge between the `PDFFormFiller` plugin and a specific third-party library.
|
|
52
|
+
*
|
|
53
|
+
* SurveyJS PDF Generator provides adapters for [`pdf-lib`](https://pdf-lib.js.org/) and [PDF.js](https://mozilla.github.io/pdf.js/) out of the box. Pass the libraries to the `PDFLibAdapter` or `PDFJSAdapter` constructor and assign the resulting instance to the `pdfLibraryAdapter` property.
|
|
54
|
+
*
|
|
55
|
+
* [View pdf-lib Demo](https://surveyjs.io/pdf-generator/examples/map-survey-responses-to-pdf-fields-using-pdflib/ (linkStyle))
|
|
56
|
+
*
|
|
57
|
+
* [View PDF.js Demo](https://surveyjs.io/pdf-generator/examples/fill-in-pdf-form-fields-with-dynamic-survey-data-using-pdfjs/ (linkStyle))
|
|
58
|
+
*/
|
|
59
|
+
pdfLibraryAdapter?: IPDFFormAdapter;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A base class for the `PDFFormFiller` plugin.
|
|
63
|
+
*/
|
|
64
|
+
export declare abstract class PDFFormFillerBase {
|
|
65
|
+
constructor(options?: IPDFFormFillerOptions);
|
|
66
|
+
/**
|
|
67
|
+
* A PDF document with interactive form fields that you want to fill.
|
|
68
|
+
*
|
|
69
|
+
* Because this document is passed on to a third-party library, the type of accepted values depends on this library.
|
|
70
|
+
*
|
|
71
|
+
* [View pdf-lib Demo](https://surveyjs.io/pdf-generator/examples/map-survey-responses-to-pdf-fields-using-pdflib/ (linkStyle))
|
|
72
|
+
*
|
|
73
|
+
* [View PDF.js Demo](https://surveyjs.io/pdf-generator/examples/fill-in-pdf-form-fields-with-dynamic-survey-data-using-pdfjs/ (linkStyle))
|
|
74
|
+
*/
|
|
75
|
+
pdfTemplate: any;
|
|
76
|
+
/**
|
|
77
|
+
* An object that maps survey fields to PDF form fields. Object keys are survey field names and object values are PDF form field IDs.
|
|
78
|
+
*
|
|
79
|
+
* The easiest way to build a field map is to access the data object with respondent answers using the `SurveyModel`'s `data` property and replace the values with the PDF form field IDs. To find the IDs, open your PDF document in any editor that allows viewing them. Note that certain field types, such as [Checkboxes](https://surveyjs.io/form-library/examples/create-checkboxes-question-in-javascript/), [Dynamic Matrix](https://surveyjs.io/form-library/examples/dynamic-matrix-add-new-rows/), and [Dynamic Panel](https://surveyjs.io/form-library/examples/duplicate-group-of-fields-in-form/) require a different configuration. Refer to the following demos for code examples.
|
|
80
|
+
*
|
|
81
|
+
* [View pdf-lib Demo](https://surveyjs.io/pdf-generator/examples/map-survey-responses-to-pdf-fields-using-pdflib/ (linkStyle))
|
|
82
|
+
*
|
|
83
|
+
* [View PDF.js Demo](https://surveyjs.io/pdf-generator/examples/fill-in-pdf-form-fields-with-dynamic-survey-data-using-pdfjs/ (linkStyle))
|
|
84
|
+
*/
|
|
85
|
+
fieldMap: any;
|
|
86
|
+
/**
|
|
87
|
+
* An object with data used to populate the PDF document.
|
|
88
|
+
*
|
|
89
|
+
* Use the [`SurveyModel`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model)'s [`data`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#data) property to access this data object.
|
|
90
|
+
*
|
|
91
|
+
* [View pdf-lib Demo](https://surveyjs.io/pdf-generator/examples/map-survey-responses-to-pdf-fields-using-pdflib/ (linkStyle))
|
|
92
|
+
*
|
|
93
|
+
* [View PDF.js Demo](https://surveyjs.io/pdf-generator/examples/fill-in-pdf-form-fields-with-dynamic-survey-data-using-pdfjs/ (linkStyle))
|
|
94
|
+
*/
|
|
95
|
+
data: any;
|
|
96
|
+
/**
|
|
97
|
+
* An adapter that serves as a bridge between the `PDFFormFiller` plugin and a specific third-party library.
|
|
98
|
+
*
|
|
99
|
+
* SurveyJS PDF Generator provides adapters for [`pdf-lib`](https://pdf-lib.js.org/) and [PDF.js](https://mozilla.github.io/pdf.js/) out of the box. Pass the libraries to the `PDFLibAdapter` or `PDFJSAdapter` constructor and assign the resulting instance to the `pdfLibraryAdapter` property.
|
|
100
|
+
*
|
|
101
|
+
* [View pdf-lib Demo](https://surveyjs.io/pdf-generator/examples/map-survey-responses-to-pdf-fields-using-pdflib/ (linkStyle))
|
|
102
|
+
*
|
|
103
|
+
* [View PDF.js Demo](https://surveyjs.io/pdf-generator/examples/fill-in-pdf-form-fields-with-dynamic-survey-data-using-pdfjs/ (linkStyle))
|
|
104
|
+
*/
|
|
105
|
+
pdfLibraryAdapter?: IPDFFormAdapter;
|
|
106
|
+
protected getPDFBytes(): Promise<string>;
|
|
107
|
+
/**
|
|
108
|
+
* An asynchronous method that allows you to get PDF content in different formats.
|
|
109
|
+
* @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.
|
|
110
|
+
*/
|
|
111
|
+
raw(type?: 'blob' | 'bloburl' | 'dataurlstring'): Promise<string | Blob>;
|
|
112
|
+
protected abstract saveToFile(pdfBytes: string, fileName: string): Promise<void>;
|
|
113
|
+
/**
|
|
114
|
+
* An asynchronous method that starts to download the filled PDF form in the web browser.
|
|
115
|
+
*
|
|
116
|
+
* [View pdf-lib Demo](https://surveyjs.io/pdf-generator/examples/map-survey-responses-to-pdf-fields-using-pdflib/ (linkStyle))
|
|
117
|
+
*
|
|
118
|
+
* [View PDF.js Demo](https://surveyjs.io/pdf-generator/examples/fill-in-pdf-form-fields-with-dynamic-survey-data-using-pdfjs/ (linkStyle))
|
|
119
|
+
* @param fileName *(Optional)* A file name with the ".pdf" extension. Default value: `"FilledForm.pdf"`.
|
|
120
|
+
*/
|
|
121
|
+
save(fileName?: string): Promise<void>;
|
|
122
|
+
}
|
|
123
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PDFFormFillerBase } from './forms-base';
|
|
2
|
+
/**
|
|
3
|
+
* A plugin that enables you to fill interactive fields in existing PDF forms.
|
|
4
|
+
*
|
|
5
|
+
* This plugin requires a third-party library, such as [`pdf-lib`](https://pdf-lib.js.org/) or [PDF.js](https://mozilla.github.io/pdf.js/):
|
|
6
|
+
*
|
|
7
|
+
* [View pdf-lib Demo](https://surveyjs.io/pdf-generator/examples/map-survey-responses-to-pdf-fields-using-pdflib/ (linkStyle))
|
|
8
|
+
*
|
|
9
|
+
* [View PDF.js Demo](https://surveyjs.io/pdf-generator/examples/fill-in-pdf-form-fields-with-dynamic-survey-data-using-pdfjs/ (linkStyle))
|
|
10
|
+
*/
|
|
11
|
+
export declare class PDFFormFiller extends PDFFormFillerBase {
|
|
12
|
+
protected saveToFile(pdfBytes: string, fileName: string): Promise<void>;
|
|
13
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "survey-pdf",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "survey.pdf.js is a SurveyJS PDF Library. It is a easy way to export SurveyJS surveys to PDF. It uses JSON for survey metadata.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Survey",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"typings": "./typings/entries/pdf.d.ts",
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"survey-core": "2.0
|
|
22
|
+
"survey-core": "2.1.0"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"jspdf": "^2.3.0 || ^3"
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"require": "./survey.pdf.fonts.js"
|
|
36
36
|
},
|
|
37
37
|
"./pdf-form-filler": {
|
|
38
|
+
"types": "./forms-typings/entries/forms.d.ts",
|
|
38
39
|
"node": {
|
|
39
40
|
"import": "./fesm/pdf-form-filler.node.mjs",
|
|
40
41
|
"require": "./pdf-form-filler.node.js"
|
package/pdf-form-filler.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* surveyjs - SurveyJS PDF library v2.0
|
|
2
|
+
* surveyjs - SurveyJS PDF library v2.1.0
|
|
3
3
|
* Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
|
|
4
4
|
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
|
|
5
5
|
*/
|
|
@@ -326,9 +326,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
326
326
|
/* harmony import */ var _map__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./map */ "./src/pdf_forms/map.ts");
|
|
327
327
|
|
|
328
328
|
|
|
329
|
+
/**
|
|
330
|
+
* A base class for the `PDFFormFiller` plugin.
|
|
331
|
+
*/
|
|
329
332
|
var PDFFormFillerBase = /** @class */ (function () {
|
|
330
333
|
function PDFFormFillerBase(options) {
|
|
331
|
-
if (options === void 0) { options = null; }
|
|
332
334
|
if (options) {
|
|
333
335
|
this.data = options.data;
|
|
334
336
|
this.fieldMap = options.fieldMap;
|
|
@@ -339,24 +341,21 @@ var PDFFormFillerBase = /** @class */ (function () {
|
|
|
339
341
|
PDFFormFillerBase.prototype.getPDFBytes = function () {
|
|
340
342
|
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () {
|
|
341
343
|
var map, plainData;
|
|
342
|
-
|
|
343
|
-
|
|
344
|
+
var _a;
|
|
345
|
+
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_b) {
|
|
346
|
+
switch (_b.label) {
|
|
344
347
|
case 0:
|
|
345
348
|
map = new _map__WEBPACK_IMPORTED_MODULE_1__["default"](this.fieldMap);
|
|
346
349
|
plainData = map.mapData(this.data);
|
|
347
|
-
return [4 /*yield*/, this.pdfLibraryAdapter.fillForm(this.pdfTemplate, plainData)];
|
|
348
|
-
case 1: return [2 /*return*/,
|
|
350
|
+
return [4 /*yield*/, ((_a = this.pdfLibraryAdapter) === null || _a === void 0 ? void 0 : _a.fillForm(this.pdfTemplate, plainData))];
|
|
351
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
349
352
|
}
|
|
350
353
|
});
|
|
351
354
|
});
|
|
352
355
|
};
|
|
353
356
|
/**
|
|
354
357
|
* An asynchronous method that allows you to get PDF content in different formats.
|
|
355
|
-
*
|
|
356
|
-
* [View Demo](https://surveyjs.io/pdf-generator/examples/convert-pdf-form-blob-base64-raw-pdf-javascript/ (linkStyle))
|
|
357
|
-
*
|
|
358
358
|
* @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.
|
|
359
|
-
*
|
|
360
359
|
*/
|
|
361
360
|
PDFFormFillerBase.prototype.raw = function (type) {
|
|
362
361
|
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () {
|
|
@@ -366,7 +365,7 @@ var PDFFormFillerBase = /** @class */ (function () {
|
|
|
366
365
|
case 0: return [4 /*yield*/, this.getPDFBytes()];
|
|
367
366
|
case 1:
|
|
368
367
|
pdfBytes = _a.sent();
|
|
369
|
-
if (!type)
|
|
368
|
+
if (!type || !pdfBytes)
|
|
370
369
|
return [2 /*return*/, pdfBytes];
|
|
371
370
|
if (type == 'dataurlstring')
|
|
372
371
|
return [2 /*return*/, 'data:application/pdf;base64,' + btoa(String.fromCharCode.apply(null, pdfBytes))];
|
|
@@ -381,19 +380,24 @@ var PDFFormFillerBase = /** @class */ (function () {
|
|
|
381
380
|
});
|
|
382
381
|
};
|
|
383
382
|
/**
|
|
384
|
-
* An asynchronous method that starts download
|
|
383
|
+
* An asynchronous method that starts to download the filled PDF form in the web browser.
|
|
385
384
|
*
|
|
386
|
-
*
|
|
385
|
+
* [View pdf-lib Demo](https://surveyjs.io/pdf-generator/examples/map-survey-responses-to-pdf-fields-using-pdflib/ (linkStyle))
|
|
386
|
+
*
|
|
387
|
+
* [View PDF.js Demo](https://surveyjs.io/pdf-generator/examples/fill-in-pdf-form-fields-with-dynamic-survey-data-using-pdfjs/ (linkStyle))
|
|
388
|
+
* @param fileName *(Optional)* A file name with the ".pdf" extension. Default value: `"FilledForm.pdf"`.
|
|
387
389
|
*/
|
|
388
390
|
PDFFormFillerBase.prototype.save = function () {
|
|
389
391
|
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, arguments, void 0, function (fileName) {
|
|
390
392
|
var pdfBytes;
|
|
391
|
-
if (fileName === void 0) { fileName = '
|
|
393
|
+
if (fileName === void 0) { fileName = 'FilledForm.pdf'; }
|
|
392
394
|
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) {
|
|
393
395
|
switch (_a.label) {
|
|
394
396
|
case 0: return [4 /*yield*/, this.getPDFBytes()];
|
|
395
397
|
case 1:
|
|
396
398
|
pdfBytes = _a.sent();
|
|
399
|
+
if (!pdfBytes)
|
|
400
|
+
return [2 /*return*/];
|
|
397
401
|
return [4 /*yield*/, this.saveToFile(pdfBytes, fileName)];
|
|
398
402
|
case 2:
|
|
399
403
|
_a.sent();
|
|
@@ -423,6 +427,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
423
427
|
/* harmony import */ var _forms_base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./forms-base */ "./src/pdf_forms/forms-base.ts");
|
|
424
428
|
|
|
425
429
|
|
|
430
|
+
/**
|
|
431
|
+
* A plugin that enables you to fill interactive fields in existing PDF forms.
|
|
432
|
+
*
|
|
433
|
+
* This plugin requires a third-party library, such as [`pdf-lib`](https://pdf-lib.js.org/) or [PDF.js](https://mozilla.github.io/pdf.js/):
|
|
434
|
+
*
|
|
435
|
+
* [View pdf-lib Demo](https://surveyjs.io/pdf-generator/examples/map-survey-responses-to-pdf-fields-using-pdflib/ (linkStyle))
|
|
436
|
+
*
|
|
437
|
+
* [View PDF.js Demo](https://surveyjs.io/pdf-generator/examples/fill-in-pdf-form-fields-with-dynamic-survey-data-using-pdfjs/ (linkStyle))
|
|
438
|
+
*/
|
|
426
439
|
var PDFFormFiller = /** @class */ (function (_super) {
|
|
427
440
|
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(PDFFormFiller, _super);
|
|
428
441
|
function PDFFormFiller() {
|
package/pdf-form-filler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pdf-form-filler.js","mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;;;;;;;;;;;;;;;;;;;ACRA,IAAI,aAAa,GAAG,UAAS,CAAM,EAAE,CAAM;IACvC,aAAa,GAAG,MAAM,CAAC,cAAc;QACrC,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,YAAY,KAAK,IAAI,UAAU,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5E,UAAU,CAAC,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC;YAAE,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;gBAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;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OAAO;QACX,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,aAAG;YACzB,KAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACP,CAAC;IACD,0BAAO,GAAP,UAAQ,IAAS;QACb,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;QACd,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC,GAAG,CAAC;IACpB,CAAC;IACL,eAAC;AAAD,CAAC;;;;;;;;UClCD;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;;;;;ACNmD;AACW;AACH","sources":["webpack://PDFFormFiller/webpack/universalModuleDefinition","webpack://PDFFormFiller/./src/entries/helpers.ts","webpack://PDFFormFiller/./src/pdf_forms/adapters/pdf-lib.ts","webpack://PDFFormFiller/./src/pdf_forms/adapters/pdfjs.ts","webpack://PDFFormFiller/./src/pdf_forms/forms-base.ts","webpack://PDFFormFiller/./src/pdf_forms/forms.ts","webpack://PDFFormFiller/./src/pdf_forms/map.ts","webpack://PDFFormFiller/webpack/bootstrap","webpack://PDFFormFiller/webpack/runtime/define property getters","webpack://PDFFormFiller/webpack/runtime/hasOwnProperty shorthand","webpack://PDFFormFiller/webpack/runtime/make namespace object","webpack://PDFFormFiller/./src/entries/forms.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"PDFFormFiller\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"PDFFormFiller\"] = factory();\n\telse\n\t\troot[\"PDFFormFiller\"] = factory();\n})(this, () => {\nreturn ","declare var Reflect: any;\n\nvar extendStatics = function(d: any, b: any): any {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n};\n\nexport function __extends(d: any, b: any) {\n if (typeof b !== 'function' && b !== null)\n throw new TypeError('Class extends value ' + String(b) + ' is not a constructor or null');\n extendStatics(d, b);\n function __() { this.constructor = d; }\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nexport var __assign = function() {\n __assign = (<any>Object).assign || function __assign(t: any) {\n for (var s: any, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\n\nexport function __rest(s: any, e: any) {\n var t: any = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === 'function')\n for (var i = 0, q = Object.getOwnPropertySymbols(s); i < q.length; i++) {\n if (e.indexOf(q[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, q[i]))\n t[q[i]] = s[q[i]];\n }\n return t;\n}\n\nexport function __decorate(decorators: any, target: any, key: any, desc: any) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === 'object' && typeof Reflect.decorate === 'function') r = Reflect.decorate(decorators, target, key, desc);\n // eslint-disable-next-line no-cond-assign\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\n\nexport function __awaiter(thisArg: any, _arguments: any, P: any, generator: any) {\n function adopt(value: any) { return value instanceof P ? value : new P(function (resolve: any) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve: any, reject: any) {\n function fulfilled(value: any) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value: any) { try { step(generator['throw'](value)); } catch (e) { reject(e); } }\n function step(result: any) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\n\nexport function __generator(thisArg: any, body: any) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: <any>[], ops: <any>[] }, f: any, y: any, t: any, g: any;\n return g = { next: verb(0), 'throw': verb(1), 'return': verb(2) }, typeof Symbol === 'function' && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n: any) { return function (v: any) { return step([n, v]); }; }\n function step(op: any) {\n if (f) throw new TypeError('Generator is already executing.');\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y['return'] : op[0] ? y['throw'] || ((t = y['return']) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { (<any>_) = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n}\n\nexport function __spreadArray (to: any, from: any, pack: any) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar: any; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n}","import { IPDFFormAdapter } from './adapter';\nexport class PDFLibAdapter implements IPDFFormAdapter {\n constructor (private pdfLibrary: any) { }\n public async fillForm(template: string, data: any) {\n const { PDFDocument, PDFTextField, PDFCheckBox, PDFRadioGroup, PDFDropdown } = this.pdfLibrary;\n const pdfDoc = await PDFDocument.load(template);\n const form = pdfDoc.getForm();\n const fields = form.getFields();\n fields.forEach((field: any) => {\n const fieldName = field.getName();\n const value = data[fieldName];\n if(value === null || value === undefined) return;\n if (field instanceof PDFTextField) {\n field.setText(value);\n }\n else if (field instanceof PDFCheckBox) {\n if (value) field.check(); else field.uncheck();\n }\n else if (field instanceof PDFRadioGroup || field instanceof PDFDropdown) {\n field.select(value.toString());\n }\n });\n\n return await pdfDoc.save();\n }\n}\n","import { IPDFFormAdapter } from './adapter';\nexport class PDFJSAdapter implements IPDFFormAdapter {\n constructor (private pdfLibrary: any) { }\n public async fillForm(template: string, data: any) {\n const pdfjsLib = this.pdfLibrary;\n const doc = await pdfjsLib.getDocument(template).promise;\n const numPages = doc.numPages;\n\n // Process all pages\n for (let pageNum = 1; pageNum <= numPages; pageNum++) {\n const page = await doc.getPage(pageNum);\n const annotations = await page.getAnnotations();\n annotations.forEach((field: any) => {\n if (field.fieldType == undefined) return;\n const value = data[field.fieldName];\n if (value) {\n if(field.radioButton && field.buttonValue != value) {\n return;\n }\n doc.annotationStorage.setValue(field.id, { value });\n }\n });\n }\n\n return await doc.saveDocument();\n }\n}\n","import FormMap from './map';\r\nimport { IPDFFormAdapter } from './adapters/adapter';\r\nimport { writeFileSync } from 'fs';\r\n\r\ninterface IPDFFormFillerOptions{\r\n fieldMap: any;\r\n data: any;\r\n pdfTemplate: string;\r\n pdfLibraryAdapter: IPDFFormAdapter;\r\n}\r\nexport abstract class PDFFormFillerBase {\r\n constructor (options: IPDFFormFillerOptions = null) {\r\n if(options) {\r\n this.data = options.data;\r\n this.fieldMap = options.fieldMap;\r\n this.pdfTemplate = options.pdfTemplate;\r\n this.pdfLibraryAdapter = options.pdfLibraryAdapter;\r\n }\r\n }\r\n public pdfTemplate: string;\r\n public fieldMap: any;\r\n public data: any;\r\n public pdfLibraryAdapter: IPDFFormAdapter;\r\n\r\n protected async getPDFBytes() {\r\n const map = new FormMap(this.fieldMap);\r\n const plainData = map.mapData(this.data);\r\n return await this.pdfLibraryAdapter.fillForm(this.pdfTemplate, plainData);\r\n }\r\n /**\r\n * An asynchronous method that allows you to get PDF content in different formats.\r\n *\r\n * [View Demo](https://surveyjs.io/pdf-generator/examples/convert-pdf-form-blob-base64-raw-pdf-javascript/ (linkStyle))\r\n *\r\n * @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.\r\n *\r\n */\r\n public async raw(type?: 'blob' | 'bloburl' | 'dataurlstring') {\r\n const pdfBytes = await this.getPDFBytes();\r\n if (!type) return pdfBytes;\r\n if (type == 'dataurlstring') return 'data:application/pdf;base64,' + btoa(String.fromCharCode.apply(null, pdfBytes));\r\n const blob = new Blob([pdfBytes], { type: 'application/pdf' });\r\n if (type == 'blob') return blob;\r\n if (type == 'bloburl') return URL.createObjectURL(blob);\r\n return pdfBytes;\r\n }\r\n\r\n protected abstract saveToFile(pdfBytes:string, fileName: string): Promise<void>;\r\n /**\r\n * An asynchronous method that starts download of the generated PDF file in the web browser.\r\n *\r\n * @param fileName *(Optional)* A file name with the \".pdf\" extension. Default value: `\"survey_result.pdf\"`.\r\n */\r\n public async save(fileName: string = 'survey_result.pdf') {\r\n const pdfBytes = await this.getPDFBytes();\r\n await this.saveToFile(pdfBytes, fileName);\r\n }\r\n}","import { PDFFormFillerBase } from './forms-base';\n\nexport class PDFFormFiller extends PDFFormFillerBase {\n protected async saveToFile(pdfBytes: string, fileName: string) {\n const blob = new Blob([pdfBytes], { type: 'application/pdf' });\n const link = document.createElement('a');\n link.href = URL.createObjectURL(blob);\n link.download = fileName;\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n URL.revokeObjectURL(link.href);\n }\n}","export default class FormsMap {\n private res: any = {};\n constructor(private map: any) { }\n private mapDataRecursive(data: any, map: any) {\n if(data === undefined || data === null) return;\n if (typeof(data) !== 'object') {\n if(Array.isArray(map)) {\n map.forEach((m) => {\n this.mapDataRecursive(data, m);\n });\n return;\n }\n if (typeof(map) !== 'object') {\n this.res[map] = data;\n } else {\n this.res[map[data].field] = map[data].value;\n }\n return;\n }\n if (Array.isArray(data)) {\n data.forEach((d, i) => {\n this.mapDataRecursive(d, Array.isArray(map) ? map[i] : map);\n });\n return;\n }\n Object.keys(data).forEach(key => {\n this.mapDataRecursive(data[key], map[key]);\n });\n }\n mapData(data: any) {\n this.res = {};\n this.mapDataRecursive(data, this.map);\n return this.res;\n }\n}","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export { PDFFormFiller } from '../pdf_forms/forms';\nexport { PDFLibAdapter } from '../pdf_forms/adapters/pdf-lib';\nexport { PDFJSAdapter } from '../pdf_forms/adapters/pdfjs';\n"],"names":[],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"pdf-form-filler.js","mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;;;;;;;;;;;;;;;;;;;ACRA,IAAI,aAAa,GAAG,UAAS,CAAM,EAAE,CAAM;IACvC,aAAa,GAAG,MAAM,CAAC,cAAc;QACrC,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,YAAY,KAAK,IAAI,UAAU,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5E,UAAU,CAAC,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC;YAAE,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;gBAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAClG,OAAO,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC/B,CAAC,CAAC;AAEK,SAAS,SAAS,CAAC,CAAM,EAAE,CAAM;I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,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,aAAG;YACzB,KAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACP,CAAC;IACD,0BAAO,GAAP,UAAQ,IAAS;QACb,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;QACd,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC,GAAG,CAAC;IACpB,CAAC;IACL,eAAC;AAAD,CAAC;;;;;;;;UClCD;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;;;;;ACNmD;AACW;AACH","sources":["webpack://PDFFormFiller/webpack/universalModuleDefinition","webpack://PDFFormFiller/./src/entries/helpers.ts","webpack://PDFFormFiller/./src/pdf_forms/adapters/pdf-lib.ts","webpack://PDFFormFiller/./src/pdf_forms/adapters/pdfjs.ts","webpack://PDFFormFiller/./src/pdf_forms/forms-base.ts","webpack://PDFFormFiller/./src/pdf_forms/forms.ts","webpack://PDFFormFiller/./src/pdf_forms/map.ts","webpack://PDFFormFiller/webpack/bootstrap","webpack://PDFFormFiller/webpack/runtime/define property getters","webpack://PDFFormFiller/webpack/runtime/hasOwnProperty shorthand","webpack://PDFFormFiller/webpack/runtime/make namespace object","webpack://PDFFormFiller/./src/entries/forms.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"PDFFormFiller\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"PDFFormFiller\"] = factory();\n\telse\n\t\troot[\"PDFFormFiller\"] = factory();\n})(this, () => {\nreturn ","declare var Reflect: any;\n\nvar extendStatics = function(d: any, b: any): any {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n};\n\nexport function __extends(d: any, b: any) {\n if (typeof b !== 'function' && b !== null)\n throw new TypeError('Class extends value ' + String(b) + ' is not a constructor or null');\n extendStatics(d, b);\n function __() { this.constructor = d; }\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nexport var __assign = function() {\n __assign = (<any>Object).assign || function __assign(t: any) {\n for (var s: any, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\n\nexport function __rest(s: any, e: any) {\n var t: any = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === 'function')\n for (var i = 0, q = Object.getOwnPropertySymbols(s); i < q.length; i++) {\n if (e.indexOf(q[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, q[i]))\n t[q[i]] = s[q[i]];\n }\n return t;\n}\n\nexport function __decorate(decorators: any, target: any, key: any, desc: any) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === 'object' && typeof Reflect.decorate === 'function') r = Reflect.decorate(decorators, target, key, desc);\n // eslint-disable-next-line no-cond-assign\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\n\nexport function __awaiter(thisArg: any, _arguments: any, P: any, generator: any) {\n function adopt(value: any) { return value instanceof P ? value : new P(function (resolve: any) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve: any, reject: any) {\n function fulfilled(value: any) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value: any) { try { step(generator['throw'](value)); } catch (e) { reject(e); } }\n function step(result: any) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\n\nexport function __generator(thisArg: any, body: any) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: <any>[], ops: <any>[] }, f: any, y: any, t: any, g: any;\n return g = { next: verb(0), 'throw': verb(1), 'return': verb(2) }, typeof Symbol === 'function' && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n: any) { return function (v: any) { return step([n, v]); }; }\n function step(op: any) {\n if (f) throw new TypeError('Generator is already executing.');\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y['return'] : op[0] ? y['throw'] || ((t = y['return']) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { (<any>_) = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n}\n\nexport function __spreadArray (to: any, from: any, pack: any) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar: any; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n}","import { IPDFFormAdapter } from './adapter';\nexport class PDFLibAdapter implements IPDFFormAdapter {\n constructor (private pdfLibrary: any) { }\n public async fillForm(template: any, data: any) {\n const { PDFDocument, PDFTextField, PDFCheckBox, PDFRadioGroup, PDFDropdown } = this.pdfLibrary;\n const pdfDoc = await PDFDocument.load(template);\n const form = pdfDoc.getForm();\n const fields = form.getFields();\n fields.forEach((field: any) => {\n const fieldName = field.getName();\n const value = data[fieldName];\n if(value === null || value === undefined) return;\n if (field instanceof PDFTextField) {\n field.setText(value);\n }\n else if (field instanceof PDFCheckBox) {\n if (value) field.check(); else field.uncheck();\n }\n else if (field instanceof PDFRadioGroup || field instanceof PDFDropdown) {\n field.select(value.toString());\n }\n });\n\n return await pdfDoc.save();\n }\n}\n","import { IPDFFormAdapter } from './adapter';\nexport class PDFJSAdapter implements IPDFFormAdapter {\n constructor (private pdfLibrary: any) { }\n public async fillForm(template: any, data: any) {\n const pdfjsLib = this.pdfLibrary;\n const doc = await pdfjsLib.getDocument(template).promise;\n const numPages = doc.numPages;\n\n // Process all pages\n for (let pageNum = 1; pageNum <= numPages; pageNum++) {\n const page = await doc.getPage(pageNum);\n const annotations = await page.getAnnotations();\n annotations.forEach((field: any) => {\n if (field.fieldType == undefined) return;\n const value = data[field.fieldName];\n if (value) {\n if(field.radioButton && field.buttonValue != value) {\n return;\n }\n doc.annotationStorage.setValue(field.id, { value });\n }\n });\n }\n\n return await doc.saveDocument();\n }\n}\n","import FormMap from './map';\r\nimport { IPDFFormAdapter } from './adapters/adapter';\r\n\r\n/**\r\n * An object that configures the [`PDFFormFiller`](https://surveyjs.io/pdf-generator/documentation/api-reference/pdfformfiller) plugin.\r\n *\r\n * Pass this object to the `PDFFormFiller` constructor:\r\n *\r\n * ```js\r\n * const form = new PDFFormFiller.PDFFormFiller(pdfFormFillerOptions);\r\n *\r\n * // In modular applications:\r\n * import { PDFFormFiller } from \"survey-pdf/pdf-form-filler\";\r\n * const form = new PDFFormFiller(pdfFormFillerOptions);\r\n * ```\r\n *\r\n * [View pdf-lib Demo](https://surveyjs.io/pdf-generator/examples/map-survey-responses-to-pdf-fields-using-pdflib/ (linkStyle))\r\n *\r\n * [View PDF.js Demo](https://surveyjs.io/pdf-generator/examples/fill-in-pdf-form-fields-with-dynamic-survey-data-using-pdfjs/ (linkStyle))\r\n */\r\ninterface IPDFFormFillerOptions {\r\n /**\r\n * An object that maps survey fields to PDF form fields. Object keys are survey field names and object values are PDF form field IDs.\r\n *\r\n * The easiest way to build a field map is to access the data object with respondent answers using the `SurveyModel`'s `data` property and replace the values with the PDF form field IDs. To find the IDs, open your PDF document in any editor that allows viewing them. Note that certain field types, such as [Checkboxes](https://surveyjs.io/form-library/examples/create-checkboxes-question-in-javascript/), [Dynamic Matrix](https://surveyjs.io/form-library/examples/dynamic-matrix-add-new-rows/), and [Dynamic Panel](https://surveyjs.io/form-library/examples/duplicate-group-of-fields-in-form/) require a different configuration. Refer to the following demos for code examples.\r\n *\r\n * [View pdf-lib Demo](https://surveyjs.io/pdf-generator/examples/map-survey-responses-to-pdf-fields-using-pdflib/ (linkStyle))\r\n *\r\n * [View PDF.js Demo](https://surveyjs.io/pdf-generator/examples/fill-in-pdf-form-fields-with-dynamic-survey-data-using-pdfjs/ (linkStyle))\r\n */\r\n fieldMap?: any;\r\n /**\r\n * An object with data used to populate the PDF document.\r\n *\r\n * Use the [`SurveyModel`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model)'s [`data`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#data) property to access this data object.\r\n *\r\n * [View pdf-lib Demo](https://surveyjs.io/pdf-generator/examples/map-survey-responses-to-pdf-fields-using-pdflib/ (linkStyle))\r\n *\r\n * [View PDF.js Demo](https://surveyjs.io/pdf-generator/examples/fill-in-pdf-form-fields-with-dynamic-survey-data-using-pdfjs/ (linkStyle))\r\n */\r\n data?: any;\r\n /**\r\n * A PDF document with interactive form fields that you want to fill.\r\n *\r\n * Because this document is passed on to a third-party library, the type of accepted values depends on this library.\r\n *\r\n * [View pdf-lib Demo](https://surveyjs.io/pdf-generator/examples/map-survey-responses-to-pdf-fields-using-pdflib/ (linkStyle))\r\n *\r\n * [View PDF.js Demo](https://surveyjs.io/pdf-generator/examples/fill-in-pdf-form-fields-with-dynamic-survey-data-using-pdfjs/ (linkStyle))\r\n */\r\n pdfTemplate?: any;\r\n /**\r\n * An adapter that serves as a bridge between the `PDFFormFiller` plugin and a specific third-party library.\r\n *\r\n * SurveyJS PDF Generator provides adapters for [`pdf-lib`](https://pdf-lib.js.org/) and [PDF.js](https://mozilla.github.io/pdf.js/) out of the box. Pass the libraries to the `PDFLibAdapter` or `PDFJSAdapter` constructor and assign the resulting instance to the `pdfLibraryAdapter` property.\r\n *\r\n * [View pdf-lib Demo](https://surveyjs.io/pdf-generator/examples/map-survey-responses-to-pdf-fields-using-pdflib/ (linkStyle))\r\n *\r\n * [View PDF.js Demo](https://surveyjs.io/pdf-generator/examples/fill-in-pdf-form-fields-with-dynamic-survey-data-using-pdfjs/ (linkStyle))\r\n */\r\n pdfLibraryAdapter?: IPDFFormAdapter;\r\n}\r\n/**\r\n * A base class for the `PDFFormFiller` plugin.\r\n */\r\nexport abstract class PDFFormFillerBase {\r\n constructor (options?: IPDFFormFillerOptions) {\r\n if(options) {\r\n this.data = options.data;\r\n this.fieldMap = options.fieldMap;\r\n this.pdfTemplate = options.pdfTemplate;\r\n this.pdfLibraryAdapter = options.pdfLibraryAdapter;\r\n }\r\n }\r\n /**\r\n * A PDF document with interactive form fields that you want to fill.\r\n *\r\n * Because this document is passed on to a third-party library, the type of accepted values depends on this library.\r\n *\r\n * [View pdf-lib Demo](https://surveyjs.io/pdf-generator/examples/map-survey-responses-to-pdf-fields-using-pdflib/ (linkStyle))\r\n *\r\n * [View PDF.js Demo](https://surveyjs.io/pdf-generator/examples/fill-in-pdf-form-fields-with-dynamic-survey-data-using-pdfjs/ (linkStyle))\r\n */\r\n public pdfTemplate: any;\r\n /**\r\n * An object that maps survey fields to PDF form fields. Object keys are survey field names and object values are PDF form field IDs.\r\n *\r\n * The easiest way to build a field map is to access the data object with respondent answers using the `SurveyModel`'s `data` property and replace the values with the PDF form field IDs. To find the IDs, open your PDF document in any editor that allows viewing them. Note that certain field types, such as [Checkboxes](https://surveyjs.io/form-library/examples/create-checkboxes-question-in-javascript/), [Dynamic Matrix](https://surveyjs.io/form-library/examples/dynamic-matrix-add-new-rows/), and [Dynamic Panel](https://surveyjs.io/form-library/examples/duplicate-group-of-fields-in-form/) require a different configuration. Refer to the following demos for code examples.\r\n *\r\n * [View pdf-lib Demo](https://surveyjs.io/pdf-generator/examples/map-survey-responses-to-pdf-fields-using-pdflib/ (linkStyle))\r\n *\r\n * [View PDF.js Demo](https://surveyjs.io/pdf-generator/examples/fill-in-pdf-form-fields-with-dynamic-survey-data-using-pdfjs/ (linkStyle))\r\n */\r\n public fieldMap: any;\r\n /**\r\n * An object with data used to populate the PDF document.\r\n *\r\n * Use the [`SurveyModel`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model)'s [`data`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#data) property to access this data object.\r\n *\r\n * [View pdf-lib Demo](https://surveyjs.io/pdf-generator/examples/map-survey-responses-to-pdf-fields-using-pdflib/ (linkStyle))\r\n *\r\n * [View PDF.js Demo](https://surveyjs.io/pdf-generator/examples/fill-in-pdf-form-fields-with-dynamic-survey-data-using-pdfjs/ (linkStyle))\r\n */\r\n public data: any;\r\n /**\r\n * An adapter that serves as a bridge between the `PDFFormFiller` plugin and a specific third-party library.\r\n *\r\n * SurveyJS PDF Generator provides adapters for [`pdf-lib`](https://pdf-lib.js.org/) and [PDF.js](https://mozilla.github.io/pdf.js/) out of the box. Pass the libraries to the `PDFLibAdapter` or `PDFJSAdapter` constructor and assign the resulting instance to the `pdfLibraryAdapter` property.\r\n *\r\n * [View pdf-lib Demo](https://surveyjs.io/pdf-generator/examples/map-survey-responses-to-pdf-fields-using-pdflib/ (linkStyle))\r\n *\r\n * [View PDF.js Demo](https://surveyjs.io/pdf-generator/examples/fill-in-pdf-form-fields-with-dynamic-survey-data-using-pdfjs/ (linkStyle))\r\n */\r\n public pdfLibraryAdapter?: IPDFFormAdapter;\r\n\r\n protected async getPDFBytes() {\r\n const map = new FormMap(this.fieldMap);\r\n const plainData = map.mapData(this.data);\r\n return await this.pdfLibraryAdapter?.fillForm(this.pdfTemplate, plainData);\r\n }\r\n /**\r\n * An asynchronous method that allows you to get PDF content in different formats.\r\n * @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.\r\n */\r\n public async raw(type?: 'blob' | 'bloburl' | 'dataurlstring') {\r\n const pdfBytes = await this.getPDFBytes();\r\n if (!type || !pdfBytes) return pdfBytes;\r\n if (type == 'dataurlstring') return 'data:application/pdf;base64,' + btoa(String.fromCharCode.apply(null, pdfBytes));\r\n const blob = new Blob([pdfBytes], { type: 'application/pdf' });\r\n if (type == 'blob') return blob;\r\n if (type == 'bloburl') return URL.createObjectURL(blob);\r\n return pdfBytes;\r\n }\r\n\r\n protected abstract saveToFile(pdfBytes:string, fileName: string): Promise<void>;\r\n /**\r\n * An asynchronous method that starts to download the filled PDF form in the web browser.\r\n *\r\n * [View pdf-lib Demo](https://surveyjs.io/pdf-generator/examples/map-survey-responses-to-pdf-fields-using-pdflib/ (linkStyle))\r\n *\r\n * [View PDF.js Demo](https://surveyjs.io/pdf-generator/examples/fill-in-pdf-form-fields-with-dynamic-survey-data-using-pdfjs/ (linkStyle))\r\n * @param fileName *(Optional)* A file name with the \".pdf\" extension. Default value: `\"FilledForm.pdf\"`.\r\n */\r\n public async save(fileName: string = 'FilledForm.pdf') {\r\n const pdfBytes = await this.getPDFBytes();\r\n if(!pdfBytes) return;\r\n await this.saveToFile(pdfBytes, fileName);\r\n }\r\n}","import { PDFFormFillerBase } from './forms-base';\n\n/**\n * A plugin that enables you to fill interactive fields in existing PDF forms.\n *\n * This plugin requires a third-party library, such as [`pdf-lib`](https://pdf-lib.js.org/) or [PDF.js](https://mozilla.github.io/pdf.js/):\n *\n * [View pdf-lib Demo](https://surveyjs.io/pdf-generator/examples/map-survey-responses-to-pdf-fields-using-pdflib/ (linkStyle))\n *\n * [View PDF.js Demo](https://surveyjs.io/pdf-generator/examples/fill-in-pdf-form-fields-with-dynamic-survey-data-using-pdfjs/ (linkStyle))\n */\nexport class PDFFormFiller extends PDFFormFillerBase {\n protected async saveToFile(pdfBytes: string, fileName: string) {\n const blob = new Blob([pdfBytes], { type: 'application/pdf' });\n const link = document.createElement('a');\n link.href = URL.createObjectURL(blob);\n link.download = fileName;\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n URL.revokeObjectURL(link.href);\n }\n}","export default class FormsMap {\n private res: any = {};\n constructor(private map: any) { }\n private mapDataRecursive(data: any, map: any) {\n if(data === undefined || data === null) return;\n if (typeof(data) !== 'object') {\n if(Array.isArray(map)) {\n map.forEach((m) => {\n this.mapDataRecursive(data, m);\n });\n return;\n }\n if (typeof(map) !== 'object') {\n this.res[map] = data;\n } else {\n this.res[map[data].field] = map[data].value;\n }\n return;\n }\n if (Array.isArray(data)) {\n data.forEach((d, i) => {\n this.mapDataRecursive(d, Array.isArray(map) ? map[i] : map);\n });\n return;\n }\n Object.keys(data).forEach(key => {\n this.mapDataRecursive(data[key], map[key]);\n });\n }\n mapData(data: any) {\n this.res = {};\n this.mapDataRecursive(data, this.map);\n return this.res;\n }\n}","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export { PDFFormFiller } from '../pdf_forms/forms';\nexport { PDFLibAdapter } from '../pdf_forms/adapters/pdf-lib';\nexport { PDFJSAdapter } from '../pdf_forms/adapters/pdfjs';\n"],"names":[],"sourceRoot":""}
|
package/pdf-form-filler.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see pdf-form-filler.min.js.LICENSE.txt */
|
|
2
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("PDFFormFiller",[],e):"object"==typeof exports?exports.PDFFormFiller=e():t.PDFFormFiller=e()}(this,(()=>(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{PDFFormFiller:()=>a,PDFJSAdapter:()=>c,PDFLibAdapter:()=>u});var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},r(t,e)};function n(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function u(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,u)}c((n=n.apply(t,e||[])).next())}))}function o(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}const i=function(){function t(t){this.map=t,this.res={}}return t.prototype.mapDataRecursive=function(t,e){var r=this;if(null!=t)return"object"!=typeof t?Array.isArray(e)?void e.forEach((function(e){r.mapDataRecursive(t,e)})):void("object"!=typeof e?this.res[e]=t:this.res[e[t].field]=e[t].value):void(Array.isArray(t)?t.forEach((function(t,n){r.mapDataRecursive(t,Array.isArray(e)?e[n]:e)})):Object.keys(t).forEach((function(n){r.mapDataRecursive(t[n],e[n])})))},t.prototype.mapData=function(t){return this.res={},this.mapDataRecursive(t,this.map),this.res},t}();var a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.saveToFile=function(t,e){return n(this,void 0,void 0,(function(){var r,n;return o(this,(function(o){return r=new Blob([t],{type:"application/pdf"}),(n=document.createElement("a")).href=URL.createObjectURL(r),n.download=e,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(n.href),[2]}))}))},e}(function(){function t(t){
|
|
2
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("PDFFormFiller",[],e):"object"==typeof exports?exports.PDFFormFiller=e():t.PDFFormFiller=e()}(this,(()=>(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{PDFFormFiller:()=>a,PDFJSAdapter:()=>c,PDFLibAdapter:()=>u});var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},r(t,e)};function n(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function u(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,u)}c((n=n.apply(t,e||[])).next())}))}function o(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}const i=function(){function t(t){this.map=t,this.res={}}return t.prototype.mapDataRecursive=function(t,e){var r=this;if(null!=t)return"object"!=typeof t?Array.isArray(e)?void e.forEach((function(e){r.mapDataRecursive(t,e)})):void("object"!=typeof e?this.res[e]=t:this.res[e[t].field]=e[t].value):void(Array.isArray(t)?t.forEach((function(t,n){r.mapDataRecursive(t,Array.isArray(e)?e[n]:e)})):Object.keys(t).forEach((function(n){r.mapDataRecursive(t[n],e[n])})))},t.prototype.mapData=function(t){return this.res={},this.mapDataRecursive(t,this.map),this.res},t}();var a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.saveToFile=function(t,e){return n(this,void 0,void 0,(function(){var r,n;return o(this,(function(o){return r=new Blob([t],{type:"application/pdf"}),(n=document.createElement("a")).href=URL.createObjectURL(r),n.download=e,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(n.href),[2]}))}))},e}(function(){function t(t){t&&(this.data=t.data,this.fieldMap=t.fieldMap,this.pdfTemplate=t.pdfTemplate,this.pdfLibraryAdapter=t.pdfLibraryAdapter)}return t.prototype.getPDFBytes=function(){return n(this,void 0,void 0,(function(){var t,e,r;return o(this,(function(n){switch(n.label){case 0:return t=new i(this.fieldMap),e=t.mapData(this.data),[4,null===(r=this.pdfLibraryAdapter)||void 0===r?void 0:r.fillForm(this.pdfTemplate,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.raw=function(t){return n(this,void 0,void 0,(function(){var e,r;return o(this,(function(n){switch(n.label){case 0:return[4,this.getPDFBytes()];case 1:return e=n.sent(),t&&e?"dataurlstring"==t?[2,"data:application/pdf;base64,"+btoa(String.fromCharCode.apply(null,e))]:(r=new Blob([e],{type:"application/pdf"}),"blob"==t?[2,r]:"bloburl"==t?[2,URL.createObjectURL(r)]:[2,e]):[2,e]}}))}))},t.prototype.save=function(){return n(this,arguments,void 0,(function(t){var e;return void 0===t&&(t="FilledForm.pdf"),o(this,(function(r){switch(r.label){case 0:return[4,this.getPDFBytes()];case 1:return(e=r.sent())?[4,this.saveToFile(e,t)]:[2];case 2:return r.sent(),[2]}}))}))},t}()),u=function(){function t(t){this.pdfLibrary=t}return t.prototype.fillForm=function(t,e){return n(this,void 0,void 0,(function(){var r,n,i,a,u,c,s;return o(this,(function(o){switch(o.label){case 0:return r=this.pdfLibrary,n=r.PDFDocument,i=r.PDFTextField,a=r.PDFCheckBox,u=r.PDFRadioGroup,c=r.PDFDropdown,[4,n.load(t)];case 1:return s=o.sent(),s.getForm().getFields().forEach((function(t){var r=t.getName(),n=e[r];null!=n&&(t instanceof i?t.setText(n):t instanceof a?n?t.check():t.uncheck():(t instanceof u||t instanceof c)&&t.select(n.toString()))})),[4,s.save()];case 2:return[2,o.sent()]}}))}))},t}(),c=function(){function t(t){this.pdfLibrary=t}return t.prototype.fillForm=function(t,e){return n(this,void 0,void 0,(function(){var r,n,i;return o(this,(function(o){switch(o.label){case 0:return[4,this.pdfLibrary.getDocument(t).promise];case 1:r=o.sent(),n=r.numPages,i=1,o.label=2;case 2:return i<=n?[4,r.getPage(i)]:[3,6];case 3:return[4,o.sent().getAnnotations()];case 4:o.sent().forEach((function(t){if(null!=t.fieldType){var n=e[t.fieldName];if(n){if(t.radioButton&&t.buttonValue!=n)return;r.annotationStorage.setValue(t.id,{value:n})}}})),o.label=5;case 5:return i++,[3,2];case 6:return[4,r.saveDocument()];case 7:return[2,o.sent()]}}))}))},t}();return e})()));
|
package/pdf-form-filler.node.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* surveyjs - SurveyJS PDF library v2.0
|
|
2
|
+
* surveyjs - SurveyJS PDF library v2.1.0
|
|
3
3
|
* Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
|
|
4
4
|
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
|
|
5
5
|
*/
|
|
@@ -326,9 +326,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
326
326
|
/* harmony import */ var _map__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./map */ "./src/pdf_forms/map.ts");
|
|
327
327
|
|
|
328
328
|
|
|
329
|
+
/**
|
|
330
|
+
* A base class for the `PDFFormFiller` plugin.
|
|
331
|
+
*/
|
|
329
332
|
var PDFFormFillerBase = /** @class */ (function () {
|
|
330
333
|
function PDFFormFillerBase(options) {
|
|
331
|
-
if (options === void 0) { options = null; }
|
|
332
334
|
if (options) {
|
|
333
335
|
this.data = options.data;
|
|
334
336
|
this.fieldMap = options.fieldMap;
|
|
@@ -339,24 +341,21 @@ var PDFFormFillerBase = /** @class */ (function () {
|
|
|
339
341
|
PDFFormFillerBase.prototype.getPDFBytes = function () {
|
|
340
342
|
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () {
|
|
341
343
|
var map, plainData;
|
|
342
|
-
|
|
343
|
-
|
|
344
|
+
var _a;
|
|
345
|
+
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_b) {
|
|
346
|
+
switch (_b.label) {
|
|
344
347
|
case 0:
|
|
345
348
|
map = new _map__WEBPACK_IMPORTED_MODULE_1__["default"](this.fieldMap);
|
|
346
349
|
plainData = map.mapData(this.data);
|
|
347
|
-
return [4 /*yield*/, this.pdfLibraryAdapter.fillForm(this.pdfTemplate, plainData)];
|
|
348
|
-
case 1: return [2 /*return*/,
|
|
350
|
+
return [4 /*yield*/, ((_a = this.pdfLibraryAdapter) === null || _a === void 0 ? void 0 : _a.fillForm(this.pdfTemplate, plainData))];
|
|
351
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
349
352
|
}
|
|
350
353
|
});
|
|
351
354
|
});
|
|
352
355
|
};
|
|
353
356
|
/**
|
|
354
357
|
* An asynchronous method that allows you to get PDF content in different formats.
|
|
355
|
-
*
|
|
356
|
-
* [View Demo](https://surveyjs.io/pdf-generator/examples/convert-pdf-form-blob-base64-raw-pdf-javascript/ (linkStyle))
|
|
357
|
-
*
|
|
358
358
|
* @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.
|
|
359
|
-
*
|
|
360
359
|
*/
|
|
361
360
|
PDFFormFillerBase.prototype.raw = function (type) {
|
|
362
361
|
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () {
|
|
@@ -366,7 +365,7 @@ var PDFFormFillerBase = /** @class */ (function () {
|
|
|
366
365
|
case 0: return [4 /*yield*/, this.getPDFBytes()];
|
|
367
366
|
case 1:
|
|
368
367
|
pdfBytes = _a.sent();
|
|
369
|
-
if (!type)
|
|
368
|
+
if (!type || !pdfBytes)
|
|
370
369
|
return [2 /*return*/, pdfBytes];
|
|
371
370
|
if (type == 'dataurlstring')
|
|
372
371
|
return [2 /*return*/, 'data:application/pdf;base64,' + btoa(String.fromCharCode.apply(null, pdfBytes))];
|
|
@@ -381,19 +380,24 @@ var PDFFormFillerBase = /** @class */ (function () {
|
|
|
381
380
|
});
|
|
382
381
|
};
|
|
383
382
|
/**
|
|
384
|
-
* An asynchronous method that starts download
|
|
383
|
+
* An asynchronous method that starts to download the filled PDF form in the web browser.
|
|
384
|
+
*
|
|
385
|
+
* [View pdf-lib Demo](https://surveyjs.io/pdf-generator/examples/map-survey-responses-to-pdf-fields-using-pdflib/ (linkStyle))
|
|
385
386
|
*
|
|
386
|
-
*
|
|
387
|
+
* [View PDF.js Demo](https://surveyjs.io/pdf-generator/examples/fill-in-pdf-form-fields-with-dynamic-survey-data-using-pdfjs/ (linkStyle))
|
|
388
|
+
* @param fileName *(Optional)* A file name with the ".pdf" extension. Default value: `"FilledForm.pdf"`.
|
|
387
389
|
*/
|
|
388
390
|
PDFFormFillerBase.prototype.save = function () {
|
|
389
391
|
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, arguments, void 0, function (fileName) {
|
|
390
392
|
var pdfBytes;
|
|
391
|
-
if (fileName === void 0) { fileName = '
|
|
393
|
+
if (fileName === void 0) { fileName = 'FilledForm.pdf'; }
|
|
392
394
|
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) {
|
|
393
395
|
switch (_a.label) {
|
|
394
396
|
case 0: return [4 /*yield*/, this.getPDFBytes()];
|
|
395
397
|
case 1:
|
|
396
398
|
pdfBytes = _a.sent();
|
|
399
|
+
if (!pdfBytes)
|
|
400
|
+
return [2 /*return*/];
|
|
397
401
|
return [4 /*yield*/, this.saveToFile(pdfBytes, fileName)];
|
|
398
402
|
case 2:
|
|
399
403
|
_a.sent();
|