Skip to content

Commit 57f1c62

Browse files
Merge pull request #2146 from syncfusion-content/1004880-FormsCorrectionsTS
1004880: Forms Import Statement Alignment and Corrections
2 parents 2d7df7f + 72821f4 commit 57f1c62

11 files changed

Lines changed: 102 additions & 355 deletions

File tree

Document-Processing/PDF/PDF-Viewer/javascript-es6/forms/custom-data.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ documentation: ug
99

1010
# Add Custom Data to PDF Form Fields in TypeScript PDF Viewer
1111

12-
The Syncfusion **TypeScript PDF Viewer** allows you to attach **custom application-specific data** to form fields by using the customData property. This enables you to associate business identifiers, tags, validation hints, or workflow metadata with form fields.
12+
The **Syncfusion TypeScript PDF Viewer** allows you to attach **custom application-specific data** to form fields by using the customData property. This enables you to associate business identifiers, tags, validation hints, or workflow metadata with form fields.
1313

1414
The custom data remains linked to the form field throughout the viewer session and can be accessed or updated whenever the field is queried or modified.
1515

@@ -30,16 +30,6 @@ This page explains how to:
3030
You can attach custom data at the time of field creation by passing a **customData** object in the settings parameter of **addFormField()**.
3131

3232
```ts
33-
import { PdfViewer, FormDesigner, FormFields, Toolbar, Navigation, Magnification, TextSelection } from '@syncfusion/ej2-pdfviewer';
34-
35-
PdfViewer.Inject(Toolbar, Navigation, Magnification, TextSelection, FormFields, FormDesigner);
36-
37-
const viewer = new PdfViewer({
38-
documentPath: 'https://cdn.syncfusion.com/content/pdf/form-designer.pdf',
39-
resourceUrl: 'https://cdn.syncfusion.com/ej2/31.1.23/dist/ej2-pdfviewer-lib'
40-
});
41-
viewer.appendTo('#pdfViewer');
42-
4333
viewer.documentLoad = () => {
4434
const meta = { businessId: 'C-1024', tags: ['profile','kiosk'], requiredRole: 'admin' };
4535
viewer.formDesignerModule.addFormField('Textbox', {

Document-Processing/PDF/PDF-Viewer/javascript-es6/forms/form-constrain.md

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,6 @@ The following flags are supported in the PDF Viewer:
3737
Use the **isReadOnly** property to prevent users from modifying a form field through the UI. This is useful for displaying pre filled or calculated values that should not be changed by the user.
3838

3939
```ts
40-
import { PdfViewer, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView,
41-
TextSelection, Annotation, FormDesigner, FormFields, TextFieldSettings, SignatureFieldSettings } from '@syncfusion/ej2-pdfviewer';
42-
43-
PdfViewer.Inject(Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView,
44-
TextSelection, Annotation, FormDesigner, FormFields);
45-
46-
let pdfviewer: PdfViewer = new PdfViewer({
47-
documentPath: 'https://cdn.syncfusion.com/content/pdf/form-designer.pdf',
48-
resourceUrl: 'https://cdn.syncfusion.com/ej2/31.1.23/dist/ej2-pdfviewer-lib'
49-
});
50-
pdfviewer.appendTo('#PdfViewer');
51-
5240
//Use this setting to make Read-only as Default for new Textbox fields
5341
//pdfviewer.textFieldSettings = { isReadOnly: true };
5442

@@ -80,22 +68,6 @@ Use the **isRequired** property to mark form fields as mandatory. To enforce thi
8068
If required fields are empty, validation can prevent further actions.
8169

8270
```ts
83-
import {
84-
PdfViewer, Toolbar, Magnification, Navigation, LinkAnnotation, BookmarkView, ThumbnailView,
85-
TextSelection, TextSearch, Print, Annotation, FormDesigner, FormFields,
86-
TextFieldSettings
87-
} from '@syncfusion/ej2-pdfviewer';
88-
89-
PdfViewer.Inject(
90-
Toolbar, Magnification, Navigation, LinkAnnotation, BookmarkView, ThumbnailView,
91-
TextSelection, TextSearch, Print, Annotation, FormDesigner, FormFields
92-
);
93-
94-
// Create and configure the viewer
95-
let pdfviewer: PdfViewer = new PdfViewer({
96-
documentPath: 'https://cdn.syncfusion.com/content/pdf/form-designer.pdf',
97-
resourceUrl: 'https://cdn.syncfusion.com/ej2/31.1.23/dist/ej2-pdfviewer-lib'
98-
});
9971
// 1) Default for new Textbox fields
10072
pdfviewer.textFieldSettings = { isRequired: true };
10173

@@ -126,23 +98,6 @@ pdfviewer.appendTo('#pdfViewer'); // Ensure an element with id="pdfViewer" exist
12698
Use the **isPrint** property to control whether a form field appears in the printed output of the PDF document.
12799

128100
```ts
129-
import {
130-
PdfViewer, Toolbar, Magnification, Navigation, LinkAnnotation, BookmarkView, ThumbnailView,
131-
TextSelection, TextSearch, Print, Annotation, FormDesigner, FormFields,
132-
SignatureFieldSettings
133-
} from '@syncfusion/ej2-pdfviewer';
134-
135-
PdfViewer.Inject(
136-
Toolbar, Magnification, Navigation, LinkAnnotation, BookmarkView, ThumbnailView,
137-
TextSelection, TextSearch, Print, Annotation, FormDesigner, FormFields
138-
);
139-
140-
// Create and configure the viewer
141-
let pdfviewer: PdfViewer = new PdfViewer({
142-
documentPath: 'https://cdn.syncfusion.com/content/pdf/form-designer.pdf',
143-
resourceUrl: 'https://cdn.syncfusion.com/ej2/31.1.23/dist/ej2-pdfviewer-lib'
144-
});
145-
146101
// 1) Default for new signature fields
147102
pdfviewer.signatureFieldSettings = { isPrint: false };
148103

@@ -186,18 +141,6 @@ You can apply or modify form field flags in the following ways.
186141
### Apply flags When Creating Fields
187142
Pass the flags properties in the settings object when creating form fields using **addFormField()**.
188143
```ts
189-
import { PdfViewer, Toolbar, Magnification, Navigation, Annotation, LinkAnnotation, ThumbnailView,
190-
BookmarkView, TextSelection, FormDesigner, FormFields } from '@syncfusion/ej2-pdfviewer';
191-
192-
PdfViewer.Inject(Toolbar, Magnification, Navigation, Annotation, LinkAnnotation, ThumbnailView,
193-
BookmarkView, TextSelection, FormDesigner, FormFields);
194-
195-
let pdfviewer: PdfViewer = new PdfViewer({
196-
documentPath: 'https://cdn.syncfusion.com/content/pdf/form-designer.pdf',
197-
resourceUrl: 'https://cdn.syncfusion.com/ej2/31.1.23/dist/ej2-pdfviewer-lib'
198-
});
199-
pdfviewer.appendTo('#PdfViewer');
200-
201144
pdfviewer.documentLoad = () => {
202145
// Read-only Textbox that is printed but not required
203146
pdfviewer.formDesignerModule.addFormField('Textbox', {
@@ -225,18 +168,6 @@ pdfviewer.documentLoad = () => {
225168
Use the [updateFormField()](https://ej2.syncfusion.com/documentation/api/pdfviewer/index-default#updateformfields) method to modify constraint values on existing form fields.
226169

227170
```ts
228-
import { PdfViewer, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView,
229-
TextSelection, Annotation, FormDesigner, FormFields, TextFieldSettings } from '@syncfusion/ej2-pdfviewer';
230-
231-
PdfViewer.Inject(Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView,
232-
TextSelection, Annotation, FormDesigner, FormFields);
233-
234-
let pdfviewer: PdfViewer = new PdfViewer({
235-
documentPath: 'https://cdn.syncfusion.com/content/pdf/form-designer.pdf',
236-
resourceUrl: 'https://cdn.syncfusion.com/ej2/31.1.23/dist/ej2-pdfviewer-lib'
237-
});
238-
pdfviewer.appendTo('#PdfViewer');
239-
240171
pdfviewer.documentLoad = () => {
241172
// Add a sample textbox
242173
pdfviewer.formDesignerModule.addFormField('Textbox', {
@@ -261,15 +192,6 @@ pdfviewer.documentLoad = () => {
261192
You can configure default flag values so that form fields added using the [Form Designer toolbar](../toolbar-customization/form-designer-toolbar) automatically inherit them. This helps ensure consistent behavior for all newly created fields.
262193

263194
```ts
264-
import { PdfViewer, Toolbar, Magnification, Navigation, Annotation, LinkAnnotation, ThumbnailView,
265-
BookmarkView, TextSelection, FormDesigner, FormFields } from '@syncfusion/ej2-pdfviewer';
266-
267-
PdfViewer.Inject(Toolbar, Magnification, Navigation, Annotation, LinkAnnotation, ThumbnailView,
268-
BookmarkView, TextSelection, FormDesigner, FormFields);
269-
270-
let pdfviewer: PdfViewer = new PdfViewer({ documentPath: 'https://cdn.syncfusion.com/content/pdf/form-designer.pdf' });
271-
pdfviewer.appendTo('#PdfViewer');
272-
273195
// Textbox fields will be editable, required, and included in print by default
274196
pdfviewer.textFieldSettings = {
275197
isReadOnly: false,

Document-Processing/PDF/PDF-Viewer/javascript-es6/forms/form-designer.md

Lines changed: 52 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,33 @@ Designed form fields can be saved into the PDF document and printed with their a
4848
To enable form design features, inject the [FormDesigner](https://ej2.syncfusion.com/documentation/api/pdfviewer/formdesigner) module into the PDF Viewer. After injecting the module, use the [enableFormDesigner](https://ej2.syncfusion.com/documentation/api/pdfviewer/index-default#enableformdesigner) API to show or hide the Form Designer option in the main toolbar.
4949

5050
```ts
51-
import { PdfViewer, Toolbar, Magnification, Navigation, Annotation, LinkAnnotation,
52-
ThumbnailView, BookmarkView, TextSelection, TextSearch,
53-
FormFields, FormDesigner, TextFieldSettings } from '@syncfusion/ej2-pdfviewer';
54-
PdfViewer.Inject(Toolbar, Magnification, Navigation, Annotation, LinkAnnotation,
55-
ThumbnailView, BookmarkView, TextSelection, TextSearch, FormFields, FormDesigner);
51+
import {
52+
PdfViewer,
53+
FormFields,
54+
FormDesigner,
55+
Toolbar,
56+
Magnification,
57+
Navigation,
58+
Annotation,
59+
TextSelection,
60+
TextSearch,
61+
} from '@syncfusion/ej2-pdfviewer';
62+
PdfViewer.Inject(
63+
FormFields,
64+
FormDesigner,
65+
Toolbar,
66+
Magnification,
67+
Navigation,
68+
Annotation,
69+
TextSelection,
70+
TextSearch
71+
);
5672
let pdfviewer: PdfViewer = new PdfViewer();
57-
pdfviewer.documentPath = "https://cdn.syncfusion.com/content/pdf/form-filling-document.pdf";
58-
pdfviewer.resourceUrl = "https://cdn.syncfusion.com/ej2/31.1.23/dist/ej2-pdfviewer-lib";
59-
pdfviewer.enableFormDesigner= false,
73+
pdfviewer.documentPath =
74+
'https://cdn.syncfusion.com/content/pdf/form-filling-document.pdf';
75+
pdfviewer.resourceUrl =
76+
'https://cdn.syncfusion.com/ej2/31.1.23/dist/ej2-pdfviewer-lib';
77+
pdfviewer.enableFormDesigner = false;
6078
pdfviewer.appendTo('#PdfViewer');
6179
```
6280

@@ -90,16 +108,33 @@ Each toolbar item allows users to place the corresponding form field by selectin
90108
Use the following Code-snippet to enable Form Designer by injecting **Form Designer mode** Module.
91109

92110
```ts
93-
import { PdfViewer, Toolbar, Magnification, Navigation, Annotation, LinkAnnotation,
94-
ThumbnailView, BookmarkView, TextSelection, TextSearch,
95-
FormFields, FormDesigner } from '@syncfusion/ej2-pdfviewer';
96-
97-
PdfViewer.Inject(Toolbar, Magnification, Navigation, Annotation, LinkAnnotation,
98-
ThumbnailView, BookmarkView, TextSelection, TextSearch, FormFields, FormDesigner);
99-
111+
import {
112+
PdfViewer,
113+
FormFields,
114+
FormDesigner,
115+
Toolbar,
116+
Magnification,
117+
Navigation,
118+
Annotation,
119+
TextSelection,
120+
TextSearch,
121+
} from '@syncfusion/ej2-pdfviewer';
122+
PdfViewer.Inject(
123+
FormFields,
124+
FormDesigner,
125+
Toolbar,
126+
Magnification,
127+
Navigation,
128+
Annotation,
129+
TextSelection,
130+
TextSearch
131+
);
100132
let pdfviewer: PdfViewer = new PdfViewer();
101-
pdfviewer.documentPath = "https://cdn.syncfusion.com/content/pdf/form-filling-document.pdf";
102-
pdfviewer.resourceUrl = "https://cdn.syncfusion.com/ej2/31.1.23/dist/ej2-pdfviewer-lib";
133+
pdfviewer.documentPath =
134+
'https://cdn.syncfusion.com/content/pdf/form-filling-document.pdf';
135+
pdfviewer.resourceUrl =
136+
'https://cdn.syncfusion.com/ej2/31.1.23/dist/ej2-pdfviewer-lib';
137+
pdfviewer.enableFormDesigner = false;
103138
pdfviewer.appendTo('#PdfViewer');
104139
```
105140

@@ -114,23 +149,11 @@ You can control the visibility of the Form Designer toolbar using the [isFormDes
114149
- Hide the toolbar to provide cleaner viewing experience
115150

116151
```html
117-
<div id="PdfViewer" style="height:600px;width:100%;"></div>
118-
119152
<!-- Buttons to toggle the Form Designer toolbar -->
120153
<button id="showDesignerBtn">Show Form Designer Toolbar</button>
121154
<button id="hideDesignerBtn">Hide Form Designer Toolbar</button>
122155
```
123156
```ts
124-
import { PdfViewer, Toolbar, Magnification, Navigation, Annotation, LinkAnnotation,
125-
ThumbnailView, BookmarkView, TextSelection, TextSearch,
126-
FormFields, FormDesigner, TextFieldSettings } from '@syncfusion/ej2-pdfviewer';
127-
PdfViewer.Inject(Toolbar, Magnification, Navigation, Annotation, LinkAnnotation,
128-
ThumbnailView, BookmarkView, TextSelection, TextSearch, FormFields, FormDesigner);
129-
let pdfviewer: PdfViewer = new PdfViewer();
130-
pdfviewer.documentPath = "https://cdn.syncfusion.com/content/pdf/form-filling-document.pdf";
131-
pdfviewer.resourceUrl = "https://cdn.syncfusion.com/ej2/31.1.23/dist/ej2-pdfviewer-lib";
132-
pdfviewer.appendTo('#PdfViewer');
133-
134157
// Wire up buttons
135158
document.getElementById('showDesignerBtn')!.onclick = () => {
136159
pdfviewer.isFormDesignerToolbarVisible=true;
@@ -151,14 +174,6 @@ This customization helps you limit the available tools and simplify the user int
151174
- Any toolbar items not listed remain hidden, resulting in a cleaner and more focused UI.
152175

153176
```ts
154-
import { PdfViewer, Toolbar, Magnification, Navigation, Annotation, LinkAnnotation,
155-
ThumbnailView, BookmarkView, TextSelection, TextSearch,
156-
FormFields, FormDesigner, TextFieldSettings } from '@syncfusion/ej2-pdfviewer';
157-
PdfViewer.Inject(Toolbar, Magnification, Navigation, Annotation, LinkAnnotation,
158-
ThumbnailView, BookmarkView, TextSelection, TextSearch, FormFields, FormDesigner);
159-
let pdfviewer: PdfViewer = new PdfViewer();
160-
pdfviewer.documentPath = "https://cdn.syncfusion.com/content/pdf/form-filling-document.pdf";
161-
pdfviewer.resourceUrl = "https://cdn.syncfusion.com/ej2/31.1.23/dist/ej2-pdfviewer-lib";
162177
//Customize the Built-in Form Designer Toolbar
163178
pdfviewer.toolbarSettings = {
164179
formDesignerToolbarItems: [
@@ -172,7 +187,6 @@ pdfviewer.toolbarSettings = {
172187
"DeleteTool"
173188
]
174189
};
175-
pdfviewer.appendTo('#PdfViewer');
176190
```
177191

178192
## Move, Resize, and Edit Form Fields

0 commit comments

Comments
 (0)