You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Document-Processing/PDF/PDF-Viewer/javascript-es6/form-designer/import-export-formfields/export-formfields.md
+32-61Lines changed: 32 additions & 61 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,26 +7,33 @@ control: PDF Viewer
7
7
documentation: ug
8
8
---
9
9
10
-
# Export form data from PDF
10
+
# Export PDF Form Data from TypeScript PDF Viewer
11
11
12
-
The PDF Viewer component supports exporting and importing form field data using the importFormFields, exportFormFields, and exportFormFieldsAsObject methods in the following formats:
12
+
The PDF Viewer allows you to export form field data in multiple formats for easy storage or integration. Supported formats:
Using the `exportFormFields` method, the form field data can be exported in the specified data format. This method accepts two parameters:
21
+
-[exportFormFields](https://ej2.syncfusion.com/documentation/api/pdfviewer/index-default#exportformfields)(destination?, format) — Exports data to a file in the specified format.
22
+
-[exportFormFieldsAsObject](https://ej2.syncfusion.com/documentation/api/pdfviewer/index-default#exportformfieldsasobject)(format) — Exports data as a JavaScript object for custom handling.
23
+
-[importFormFields](https://ej2.syncfusion.com/documentation/api/pdfviewer/index-default#importformfields)(sourceOrObject, format) — Import data back into the PDF.
21
24
22
-
* The first one must be the destination path for the exported data. If the path is not specified, it will ask for the location while exporting.
23
-
* The second parameter should be the format type of the form data.
25
+
## How to export
24
26
25
-
The following example exports and imports form field data as FDF.
27
+
Use [exportFormFields()](https://ej2.syncfusion.com/documentation/api/pdfviewer/index-default#exportformfields) with an optional destination path and the format type.
28
+
29
+
### Export as FDF
30
+
The following example exports form field data as FDF.
Export the form data to a JavaScript object for custom persistence (database, API, or client storage).
103
-
The following example exports and imports form field data as Object.
85
+
Use [exportFormFieldsAsObject()](https://ej2.syncfusion.com/documentation/api/pdfviewer/index-default#exportformfieldsasobject) to obtain form data as a JavaScript object for database or API integration.
-Persist user-entered data to your server without modifying the original PDF.
137
-
- Export as JSON for easy integration with REST APIs.
138
-
- Export as FDF/XFDF for interoperability with other PDF tools.
139
-
- Export as object to combine with your app state and store securely.
140
-
- Automate exports after [validation](../form-validation) using validateFormFields.
109
+
-Save user-entered data to your server without altering the original PDF.
110
+
- Export as JSON for REST API integration.
111
+
- Export as FDF/XFDF for compatibility with other PDF tools.
112
+
- Export as Object to merge with app state or store securely.
113
+
- Automate exports after [validation](../form-validation) using [validateFormFields()](https://ej2.syncfusion.com/documentation/api/pdfviewer/index-default#validateformfields)
141
114
142
115
[View Sample on GitHub](https://github.com/SyncfusionExamples/typescript-pdf-viewer-examples)
Copy file name to clipboardExpand all lines: Document-Processing/PDF/PDF-Viewer/javascript-es6/form-designer/import-export-formfields/import-export-events.md
+35-22Lines changed: 35 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,64 +7,77 @@ control: PDF Viewer
7
7
documentation: ug
8
8
---
9
9
10
-
# Import/Export events
10
+
# PDF Form Import and Export Events in TypeScript
11
11
12
-
Import/Export events let you track and customize the full lifecycle of form field data flowing into and out of the PDF Viewer.
12
+
Import/Export events let you **track and customize the entire lifecycle** of form data being imported into or exported from the PDF Viewer.
13
+
Use these events to:
14
+
- Validate inputs before processing.
15
+
- Show progress indicators.
16
+
- Log audit trails.
17
+
- Block operations based on business rules.
13
18
14
-
Use them to validate inputs, show progress UI, log audit trails, or block operations based on your business rules. Each event exposes typed event-args (ImportStartEventArgs, ImportSuccessEventArgs, ImportFailureEventArgs, ExportStartEventArgs, ExportSuccessEventArgs, ExportFailureEventArgs) describing the operation context.
19
+
Each event provides detailed context through typed event arguments such as [ImportStartEventArgs](https://ej2.syncfusion.com/documentation/api/pdfviewer/importstarteventargs), [ImportSuccessEventArgs](https://ej2.syncfusion.com/documentation/api/pdfviewer/importsuccesseventargs), [ImportFailureEventArgs](https://ej2.syncfusion.com/documentation/api/pdfviewer/importfailureeventargs), [ExportStartEventArgs](https://ej2.syncfusion.com/documentation/api/pdfviewer/exportstarteventargs), [ExportSuccessEventArgs](https://ej2.syncfusion.com/documentation/api/pdfviewer/exportsuccesseventargs), and [ExportFailureEventArgs](https://ej2.syncfusion.com/documentation/api/pdfviewer/exportfailureeventargs).
15
20
16
-
Use these events to monitor and customize form field import/export operations.
21
+
## Import Events
22
+
-[importStart](https://ej2.syncfusion.com/documentation/api/pdfviewer/index-default#importstart) — Fires when an import begins.
23
+
-[importSuccess](https://ej2.syncfusion.com/documentation/api/pdfviewer/index-default#importsuccess) — Fires when form fields are successfully imported.
24
+
-[importFailed](https://ej2.syncfusion.com/documentation/api/pdfviewer/index-default#importfailed) — Fires if the import fails.
17
25
18
-
## Import events
19
-
-[importStart](https://ej2.syncfusion.com/documentation/api/pdfviewer/index-default#importstart): Triggers when an import operation starts.
20
-
-[importSuccess](https://ej2.syncfusion.com/documentation/api/pdfviewer/index-default#importsuccess): Triggers when form fields are successfully imported.
21
-
-[importFailed](https://ej2.syncfusion.com/documentation/api/pdfviewer/index-default#importfailed): Triggers when importing form fields fails.
26
+
**Example: Handle Import Events**
22
27
23
-
## Handle import events
24
28
```ts
29
+
// ...viewer initialization...
25
30
viewer.importStart= (args:any) => {
26
31
console.log('Import started', args);
32
+
// e.g. show spinner, validate inputs
27
33
};
28
34
viewer.importSuccess= (args:any) => {
29
35
console.log('Import success', args);
36
+
// e.g. hide spinner, show toast
30
37
};
31
38
viewer.importFailed= (args:any) => {
32
39
console.error('Import failed', args);
40
+
// e.g. show error dialog
33
41
};
34
42
```
35
43
36
-
## Export events
37
-
-[exportStart](https://ej2.syncfusion.com/documentation/api/pdfviewer/index-default#exportstart): Triggers when an export operation starts.
38
-
-[exportSuccess](https://ej2.syncfusion.com/documentation/api/pdfviewer/index-default#exportsuccess): Triggers when form fields are successfully exported.
39
-
-[exportFailed](https://ej2.syncfusion.com/documentation/api/pdfviewer/index-default#exportfailed): Triggers when exporting form fields fails.
44
+
## Export Events
45
+
-[exportStart](https://ej2.syncfusion.com/documentation/api/pdfviewer/index-default#exportstart) — Fires when an export begins.
46
+
-[exportSuccess](https://ej2.syncfusion.com/documentation/api/pdfviewer/index-default#exportsuccess) — Fires when form fields are successfully exported.
47
+
-[exportFailed](https://ej2.syncfusion.com/documentation/api/pdfviewer/index-default#exportfailed) — Fires if the export fails.
48
+
49
+
**Example: Handle Export Events**
40
50
41
-
## Handle export events
42
51
```ts
52
+
// ...viewer initialization...
43
53
viewer.exportStart= (args:any) => {
44
54
console.log('Export started', args);
55
+
// e.g. disable export UI
45
56
};
46
57
viewer.exportSuccess= (args:any) => {
47
58
console.log('Export success', args);
59
+
// e.g. enable UI, provide download link
48
60
};
49
61
viewer.exportFailed= (args:any) => {
50
62
console.error('Export failed', args);
63
+
// e.g. re-enable UI, notify user
51
64
};
52
65
```
53
66
54
-
Notes:
55
-
- importStart/importSuccess/importFailed cover the lifecycle of form field imports.
56
-
- exportStart/exportSuccess/exportFailed cover the lifecycle of form field exports.
67
+
## Key Notes
68
+
- importStart, importSuccess, importFailed cover the full import lifecycle.
69
+
- exportStart, exportSuccess, exportFailed cover the full export lifecycle.
0 commit comments