diff --git a/Document-Processing-toc.html b/Document-Processing-toc.html index cf843168f9..781ffc068d 100644 --- a/Document-Processing-toc.html +++ b/Document-Processing-toc.html @@ -2166,7 +2166,28 @@
  • Printing PDF Files
  • Exporting PDF pages
  • Extract Text from PDF Files
  • -
  • Form Filling in PDF Files
  • +
  • Forms + +
  • Working with PDF Layers
  • Redaction
  • Organize Pages
  • diff --git a/Document-Processing/PDF/PDF-Viewer/wpf/Form-Filling-in-PDF.md b/Document-Processing/PDF/PDF-Viewer/wpf/Form-Filling-in-PDF.md deleted file mode 100644 index f6686088a8..0000000000 --- a/Document-Processing/PDF/PDF-Viewer/wpf/Form-Filling-in-PDF.md +++ /dev/null @@ -1,278 +0,0 @@ ---- -layout: post -title: Form Filling in PDF Files in WPF Pdf Viewer | Syncfusion® -description: Learn about Form Filling in PDF Files support in Syncfusion®; WPF Pdf Viewer control, its elements and more. -platform: document-processing -control: PDF Viewer -documentation: ug ---- - -# Form Filling in PDF Files in WPF Pdf Viewer - -PDF Viewer provides the ability to Fill, Edit, Flatten, and Save the `AcroForm` fields in PDF files. - -![WPF PDF Viewer Form Filling](form-filling-images/wpf-pdf-viewer-form-filling.png) - -## Supported form fields - -You can load and fill the following form fields in a PDF document using the PDF Viewer. - -1. Text box. -2. Password box. -3. Checkbox. -4. Radio button. -5. Combo box. -6. List box. -7. Signature box. - -## Retrieve the form field details - -You can retrieve the details of a form field through the [FormFieldClicked](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.PdfViewerControl.html#Syncfusion_Windows_PdfViewer_PdfViewerControl_FormFieldClicked) event of [PdfViewerControl](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.PdfViewerControl.html) by simply clicking on the field. The [FormField](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.FormFieldClickedEventArgs.html#Syncfusion_Windows_PdfViewer_FormFieldClickedEventArgs_FormField) property of the [FormFieldClickedEventArgs](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.FormFieldClickedEventArgs.html) needs to be typecast to the respective control.The following code snippet explains how to retrieve details for all [supported form fields](https://help.syncfusion.com/wpf/pdf-viewer/form-filling-in-pdf#supported-form-fields) using the FormFieldClicked event. - -{% tabs %} -{% highlight c# %} - -//Wire the `FormFieldClicked` event. -pdfViewer.FormFieldClicked += PdfViewer_FormFieldClicked; - -private void PdfViewer_FormFieldClicked(object sender, FormFieldClickedEventArgs args) -{ - if (args.FormField is TextBox) - { - //Typecast the `FormField` property to `System.Windows.Controls.TextBox` - TextBox text = args.FormField as TextBox; - //{Insert your code here} - } - else if (args.FormField is PasswordBox) - { - //Typecast the `FormField` property to `System.Windows.Controls.PasswordBox` - PasswordBox PasstextBox = args.FormField as PasswordBox; - //{Insert your code here} - } - else if (args.FormField is ListBox) - { - //Typecast the `FormField` property to `System.Windows.Controls.ListBox` - ListBox listBox = args.FormField as ListBox; - //{Insert your code here} - } - else if (args.FormField is ComboBox) - { - //Typecast the `FormField` property to `System.Windows.Controls.ComboBox` - ComboBox comboBox = args.FormField as ComboBox; - //{Insert your code here} - } - else if (args.FormField is CheckBox) - { - //Typecast the `FormField` property to `System.Windows.Controls.CheckBox` - CheckBox checkBox = args.FormField as CheckBox; - //{Insert your code here} - } - else if (args.FormField is RadioButton) - { - //Typecast the `FormField` property to `System.Windows.Controls.RadioButton` - RadioButton radiobtn = args.FormField as RadioButton; - //{Insert your code here} - } -} - -{% endhighlight %} -{% endtabs %} - -N> The sample project of PDF form filling using the Syncfusion®; PDF Viewer is available in the [GitHub](https://github.com/syncfusion/wpf-demos/tree/master/pdfviewer). - -## Import and Export Form Data - -In WPF, the PDF viewer allows the users to import and export form data to and from the PDF documents. - -### Import Form Data - -Follow the below steps to import date to PDF document with `AcroForm`. - -1. Click the form data tool button in the left pane, the form data toolbar will appear as a secondary toolbar in the [PdfViewerControl](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.PdfViewerControl.html). -2. Select **Import** option in form data toolbar to import the PDF form data. - -![WPF PDF Viewer Import Form Data](form-filling-images/wpf-pdf-viewer-import-form-data.png) - -The following code shows how to import form data in code behind. - -{% tabs %} -{% highlight c# %} - -private void button1_Click(object sender, RoutedEventArgs e) -{ - //Import PDF form data - pdfviewer.ImportFormData("Import.fdf", Syncfusion.Pdf.Parsing.DataFormat.Fdf); -} - -{% endhighlight %} -{% highlight VB %} - -Private Sub button1_Click(sender As Object, e As RoutedEventArgs) - 'Import PDF form data - pdfviewer.ImportFormData("Import.fdf", Syncfusion.Pdf.Parsing.DataFormat.Fdf) -End Sub - -{% endhighlight %} -{% endtabs %} - -### Export Form Data - -Follow the below steps to export data from PDF document - -1. Select **Export** option in the form data toolbar, to save the completed PDF form data as a file in another file format. -2. In Export Form Data As dialog box, you can select the desired format to save the form data (FDF, XFDF, XML, and JSON). - -N> If the PDF document is loaded as a stream, the [PdfViewerControl](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.PdfViewerControl.html) will request for the form name when exporting. - -The following code shows how to export form data in code behind. - -{% tabs %} -{% highlight c# %} - -private void button1_Click(object sender, RoutedEventArgs e) -{ - //Export PDF form data - pdfviewer.ExportFormData("Export.fdf", Syncfusion.Pdf.Parsing.DataFormat.Fdf, "SourceForm.pdf"); -} - -{% endhighlight %} -{% highlight VB %} - -Private Sub button1_Click(sender As Object, e As RoutedEventArgs) - 'Export PDF form data - pdfviewer.ExportFormData("Export.fdf", Syncfusion.Pdf.Parsing.DataFormat.Fdf, "SourceForm.pdf") -End Sub - -{% endhighlight %} -{% endtabs %} - -## Add Form Fields at Runtime - -The PDF Viewer allows users to programmatically add form fields without user interaction at runtime. - -The following code sample explains how to add the form field textbox at runtime. Similarly, you can implement this for all other form fields. - -{% tabs %} -{% highlight C# %} - -private void AddTextbox_Click(object sender, RoutedEventArgs e) -{ - if (pdfViewer.LoadedDocument.Form != null) - { - PdfLoadedPage page = pdfViewer.LoadedDocument.Pages[0] as PdfLoadedPage; - //Create a textbox field and add the properties. - PdfTextBoxField textBoxField = new PdfTextBoxField(page, "FirstName"); - textBoxField.Bounds = new RectangleF(0, 0, 100, 20); - //Add the form field to the document. - pdfViewer.LoadedDocument.Form.Fields.Add(textBoxField); - } -} - -{% endhighlight %} -{% highlight VB %} - -Private Sub AddTextbox_Click(sender As Object, e As RoutedEventArgs) - If pdfViewer.LoadedDocument.Form IsNot Nothing Then - Dim page As PdfLoadedPage = TryCast(pdfViewer.LoadedDocument.Pages(0), PdfLoadedPage) - `Create a textbox field and add the properties. - Dim textBoxField As PdfTextBoxField = New PdfTextBoxField(page, "FirstName") - textBoxField.Bounds = New RectangleF(0, 0, 100, 20) - `Add the form field to the document. - pdfViewer.LoadedDocument.Form.Fields.Add(textBoxField) - End If -End Sub - -{% endhighlight %} -{% endtabs %} - -## Remove Form Fields at Runtime - -The PDF Viewer allows users to programmatically remove form fields without user interaction at runtime. - -The following code sample explains how to remove the form field during runtime. - -{% tabs %} -{% highlight C# %} - -private void RemoveAt_Click(object sender, RoutedEventArgs e) -{ - if (pdfViewer.LoadedDocument.Form.Fields.Count > 0) - //Remove the field at index 0. - pdfViewer.LoadedDocument.Form.Fields.RemoveAt(0); -} - -{% endhighlight %} -{% highlight VB %} - -Private Sub RemoveAt_Click(sender As Object, e As RoutedEventArgs) - If pdfViewer.LoadedDocument.Form.Fields.Count > 0 Then - `Remove the field at index 0. - pdfViewer.LoadedDocument.Form.Fields.RemoveAt(0) - End If -End Sub - -{% endhighlight %} -{% endtabs %} - -## Modify the Existing Form Field at Runtime - -The PDF Viewer allows users to programmatically modify existing form fields without user interaction at runtime. - -The following code sample explains how to modify properties of the form field textbox during runtime. Similarly, you can implement this for all other form fields. - -{% tabs %} -{% highlight C# %} - -private void ModifyTextbox_Click(object sender, RoutedEventArgs e) -{ - if (pdfViewer.LoadedDocument.Form != null) - { - if (pdfViewer.LoadedDocument.Form.Fields[0] is PdfLoadedTextBoxField) - { - (pdfViewer.LoadedDocument.Form.Fields[0] as PdfLoadedTextBoxField).Text = "Syncfusion"; - } - } -} - -{% endhighlight %} -{% highlight VB %} - -Private Sub ModifyTextbox_Click(sender As Object, e As RoutedEventArgs) -If pdfViewer.LoadedDocument.Form IsNot Nothing Then - If TypeOf pdfViewer.LoadedDocument.Form.Fields(0) Is PdfLoadedTextBoxField Then - Dim textBoxField As PdfLoadedTextBoxField = TryCast(pdfViewer.LoadedDocument.Form.Fields(0), PdfLoadedTextBoxField) - textBoxField.Text = "Syncfusion" - End If -End If -End Sub - -{% endhighlight %} -{% endtabs %} - -## Signature Form Field - -PDF viewer WPF allows the user to add the signature in the PDF document and provides options to remove the included signature in the signature field of the PDF document. - -### Add a signature from signature field - -Clicking the signature box will open the signature pad, requesting the user to draw the signature. clicking on the apply button will add the drawn signature to the signature field. - -![WPF PDF Viewer Delete a Signature from Signature field](form-filling-images/wpf-pdf-viewer-signature-form-field-add.png) - -### Deleting a signature from signature field - -Selecting the delete option from the context menu, which is displayed when right-clicking on the selected signature, would delete the respective signature from the signature field. - -![WPF PDF Viewer Delete a Signature from Signature field](form-filling-images/wpf-pdf-viewer-signature-form-field-delete.png) - -## Keyboard Shortcuts: - -The below keyboard shortcuts are used to navigate through the form fields present in the PDF document. - -* Tab key – Navigates to the next form field present in the PDF document. -* Shift + Tab – Navigates to the previous form field present in the PDF document. -* Ctrl + Z - Performs form field value undo functionality for recently performed operations. -* Ctrl + Y - Performs form field value redo functionality for recently performed operations. - - -N> You can refer to our [WPF PDF Viewer](https://www.syncfusion.com/wpf-controls/pdf-viewer) feature tour page for its groundbreaking feature representations. You can also explore our [WPF PDF Viewer example](https://github.com/syncfusion/wpf-demos) to know how to render and configure the pdfviewer. \ No newline at end of file diff --git a/Document-Processing/PDF/PDF-Viewer/wpf/forms/Images/CheckBoxField.png b/Document-Processing/PDF/PDF-Viewer/wpf/forms/Images/CheckBoxField.png new file mode 100644 index 0000000000..a6eacebf1b Binary files /dev/null and b/Document-Processing/PDF/PDF-Viewer/wpf/forms/Images/CheckBoxField.png differ diff --git a/Document-Processing/PDF/PDF-Viewer/wpf/forms/Images/ComboboxField.png b/Document-Processing/PDF/PDF-Viewer/wpf/forms/Images/ComboboxField.png new file mode 100644 index 0000000000..44f72aedfa Binary files /dev/null and b/Document-Processing/PDF/PDF-Viewer/wpf/forms/Images/ComboboxField.png differ diff --git a/Document-Processing/PDF/PDF-Viewer/wpf/forms/Images/FormFillingUI.gif b/Document-Processing/PDF/PDF-Viewer/wpf/forms/Images/FormFillingUI.gif new file mode 100644 index 0000000000..69115d6598 Binary files /dev/null and b/Document-Processing/PDF/PDF-Viewer/wpf/forms/Images/FormFillingUI.gif differ diff --git a/Document-Processing/PDF/PDF-Viewer/wpf/forms/Images/ListBoxField.gif b/Document-Processing/PDF/PDF-Viewer/wpf/forms/Images/ListBoxField.gif new file mode 100644 index 0000000000..17d260da08 Binary files /dev/null and b/Document-Processing/PDF/PDF-Viewer/wpf/forms/Images/ListBoxField.gif differ diff --git a/Document-Processing/PDF/PDF-Viewer/wpf/forms/Images/Radiobutton.gif b/Document-Processing/PDF/PDF-Viewer/wpf/forms/Images/Radiobutton.gif new file mode 100644 index 0000000000..073e8ac998 Binary files /dev/null and b/Document-Processing/PDF/PDF-Viewer/wpf/forms/Images/Radiobutton.gif differ diff --git a/Document-Processing/PDF/PDF-Viewer/wpf/forms/Images/TextBoxField.png b/Document-Processing/PDF/PDF-Viewer/wpf/forms/Images/TextBoxField.png new file mode 100644 index 0000000000..f17dc0c0cc Binary files /dev/null and b/Document-Processing/PDF/PDF-Viewer/wpf/forms/Images/TextBoxField.png differ diff --git a/Document-Processing/PDF/PDF-Viewer/wpf/forms/Keyboard-shortcuts.md b/Document-Processing/PDF/PDF-Viewer/wpf/forms/Keyboard-shortcuts.md new file mode 100644 index 0000000000..6c07458406 --- /dev/null +++ b/Document-Processing/PDF/PDF-Viewer/wpf/forms/Keyboard-shortcuts.md @@ -0,0 +1,17 @@ +--- +layout: post +title: Keyboard shortcuts for Form Fields in WPF PDF Viewer | Syncfusion +description: Learn essential keyboard shortcuts for navigating and filling PDF form fields in the WPF PDF Viewer to improve speed, accuracy, and workflow efficiency. +platform: document-processing +control: PDF Viewer +documentation: ug +domainurl: ##DomainURL## +--- +# Keyboard Shortcuts in WPF PDF Viewer + +The below keyboard shortcuts are used to navigate through the form fields present in the PDF document. + +* Tab key – Navigates to the next form field present in the PDF document. +* Shift + Tab – Navigates to the previous form field present in the PDF document. +* Ctrl + Z - Performs form field value undo functionality for recently performed operations. +* Ctrl + Y - Performs form field value redo functionality for recently performed operations. \ No newline at end of file diff --git a/Document-Processing/PDF/PDF-Viewer/wpf/forms/form-field-events.md b/Document-Processing/PDF/PDF-Viewer/wpf/forms/form-field-events.md new file mode 100644 index 0000000000..d93c15b664 --- /dev/null +++ b/Document-Processing/PDF/PDF-Viewer/wpf/forms/form-field-events.md @@ -0,0 +1,85 @@ +--- +layout: post +title: Form Field Events in WPF Pdfviewer control | Syncfusion +description: Learn about the different form field events supported in the Syncfusion WPF PDF Viewer and how they help manage user interactions and enhance form workflows. +control: Form Field Events +control: PDF Viewer +documentation: ug +domainurl: ##DomainURL## +--- + +# PDF Viewer Form Field Events in WPF + +The Syncfusion **WPF PDF Viewer** provides a comprehensive set of **form field events** that allow developers to track user interactions, respond to form changes, and implement custom business logic. + +## Retrieve the form field details + +You can retrieve the details of a form field through the [FormFieldClicked](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.PdfViewerControl.html#Syncfusion_Windows_PdfViewer_PdfViewerControl_FormFieldClicked) event of [PdfViewerControl](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.PdfViewerControl.html) by simply clicking on the field. The [FormField](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.FormFieldClickedEventArgs.html#Syncfusion_Windows_PdfViewer_FormFieldClickedEventArgs_FormField) property of the [FormFieldClickedEventArgs](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.FormFieldClickedEventArgs.html) needs to be typecast to the respective control.The following code snippet explains how to retrieve details for all [supported form fields](https://help.syncfusion.com/wpf/pdf-viewer/form-filling-in-pdf#supported-form-fields) using the FormFieldClicked event. + +{% tabs %} +{% highlight c# %} + +//Wire the `FormFieldClicked` event. +pdfViewer.FormFieldClicked += PdfViewer_FormFieldClicked; + +private void PdfViewer_FormFieldClicked(object sender, FormFieldClickedEventArgs args) +{ + if (args.FormField is TextBox) + { + //Typecast the `FormField` property to `System.Windows.Controls.TextBox` + TextBox text = args.FormField as TextBox; + //{Insert your code here} + } + else if (args.FormField is PasswordBox) + { + //Typecast the `FormField` property to `System.Windows.Controls.PasswordBox` + PasswordBox PasstextBox = args.FormField as PasswordBox; + //{Insert your code here} + } + else if (args.FormField is ListBox) + { + //Typecast the `FormField` property to `System.Windows.Controls.ListBox` + ListBox listBox = args.FormField as ListBox; + //{Insert your code here} + } + else if (args.FormField is ComboBox) + { + //Typecast the `FormField` property to `System.Windows.Controls.ComboBox` + ComboBox comboBox = args.FormField as ComboBox; + //{Insert your code here} + } + else if (args.FormField is CheckBox) + { + //Typecast the `FormField` property to `System.Windows.Controls.CheckBox` + CheckBox checkBox = args.FormField as CheckBox; + //{Insert your code here} + } + else if (args.FormField is RadioButton) + { + //Typecast the `FormField` property to `System.Windows.Controls.RadioButton` + RadioButton radiobtn = args.FormField as RadioButton; + //{Insert your code here} + } +} + +{% endhighlight %} +{% endtabs %} + + +**Common Use Cases** + +Form field events can be used to: +- Track user interaction with form fields +- Update UI elements dynamically +- Trigger workflow actions based on field changes +- Enforce business rules during form editing + +## See also + +- [Overviewe](./overview) +- [Import form fields](./import-form-fields) +- [Export form fields](./export-form-fields) +- [Add form fields](./add-form-fields) +- [Modify form fields](./modify-form-fields) +- [Remove form fields](./remove-form-fields) +- [Form fields API](./form-fields-api) \ No newline at end of file diff --git a/Document-Processing/PDF/PDF-Viewer/wpf/forms/form-fields-api.md b/Document-Processing/PDF/PDF-Viewer/wpf/forms/form-fields-api.md new file mode 100644 index 0000000000..e79b1e5c0d --- /dev/null +++ b/Document-Processing/PDF/PDF-Viewer/wpf/forms/form-fields-api.md @@ -0,0 +1,170 @@ +--- +layout: post +title: Form Fields API in WPF PDF Viewer | Syncfusion +description: Learn how to use the Form Fields API in the Syncfusion WPF PDF Viewer to access, modify, and manage form fields effectively in your PDF applications. +platform: document-processing +control: PDF Viewer +documentation: ug +domainurl: ##DomainURL## +--- + +# Form Fields API in WPF PDF Viewer + +The PDF Viewer provides comprehensive APIs to Add, edit, Remove, import,Export and manage form fields programmatically. The following APIs are available: + +| API | Description | +|---|---| +| [ImportFormData](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.PdfViewerControl.html#Syncfusion_Windows_PdfViewer_PdfViewerControl_ImportFormData_System_String_Syncfusion_Pdf_Parsing_DataFormat_) | Import form field data as in different format (Fdf,xfdf,Json,xml).| +| [ExportFormData](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.PdfViewerControl.html#Syncfusion_Windows_PdfViewer_PdfViewerControl_ExportFormData_System_String_Syncfusion_Pdf_Parsing_DataFormat_System_String_) | Export form field data as in different format (Fdf,xfdf,Json,xml)as a downloadable file.| +| LoadedDocument.Form.Fields | By accessing the LoadedDocument form fileds we can perform add, remove and modify the form fileds in code behind.| + +## ImportFormData +The following example imports form field data as FDF. + +{% tabs %} +{% highlight c# %} + +private void button1_Click(object sender, RoutedEventArgs e) +{ + //Import PDF form data + pdfviewer.ImportFormData("Import.fdf", Syncfusion.Pdf.Parsing.DataFormat.Fdf); +} + +{% endhighlight %} +{% highlight VB %} + +Private Sub button1_Click(sender As Object, e As RoutedEventArgs) + 'Import PDF form data + pdfviewer.ImportFormData("Import.fdf", Syncfusion.Pdf.Parsing.DataFormat.Fdf) +End Sub + +{% endhighlight %} +{% endtabs %} + +## ExportFormData +The following example exports form field data as FDF. + +{% tabs %} +{% highlight c# %} + +private void button1_Click(object sender, RoutedEventArgs e) +{ + //Export PDF form data + pdfviewer.ExportFormData("Export.fdf", Syncfusion.Pdf.Parsing.DataFormat.Fdf, "SourceForm.pdf"); +} + +{% endhighlight %} +{% highlight VB %} + +Private Sub button1_Click(sender As Object, e As RoutedEventArgs) + 'Export PDF form data + pdfviewer.ExportFormData("Export.fdf", Syncfusion.Pdf.Parsing.DataFormat.Fdf, "SourceForm.pdf") +End Sub + +{% endhighlight %} +{% endtabs %} + +## LoadedDocument Form field +The below code snippet illustrates how to add a textbox field to a LoadedDocument +{% tabs %} +{% highlight C# %} + +private void AddTextbox_Click(object sender, RoutedEventArgs e) +{ + if (pdfViewer.LoadedDocument.Form != null) + { + PdfLoadedPage page = pdfViewer.LoadedDocument.Pages[0] as PdfLoadedPage; + //Create a textbox field and add the properties. + PdfTextBoxField textBoxField = new PdfTextBoxField(page, "FirstName"); + textBoxField.Bounds = new RectangleF(0, 0, 100, 20); + //Add the form field to the document. + pdfViewer.LoadedDocument.Form.Fields.Add(textBoxField); + } +} + +{% endhighlight %} +{% highlight VB %} + +Private Sub AddTextbox_Click(sender As Object, e As RoutedEventArgs) + If pdfViewer.LoadedDocument.Form IsNot Nothing Then + Dim page As PdfLoadedPage = TryCast(pdfViewer.LoadedDocument.Pages(0), PdfLoadedPage) + `Create a textbox field and add the properties. + Dim textBoxField As PdfTextBoxField = New PdfTextBoxField(page, "FirstName") + textBoxField.Bounds = New RectangleF(0, 0, 100, 20) + `Add the form field to the document. + pdfViewer.LoadedDocument.Form.Fields.Add(textBoxField) + End If +End Sub + +{% endhighlight %} +{% endtabs %} + +The below code snippet illustrates how to modify a textbox field to a LoadedDocument + +{% tabs %} +{% highlight C# %} + +private void Update_Click(object sender, RoutedEventArgs e) +{ + if (pdfViewer.LoadedDocument.Form != null) + { + if (pdfViewer.LoadedDocument.Form.Fields[0] is PdfLoadedTextBoxField) + { + (pdfViewer.LoadedDocument.Form.Fields[0] as PdfLoadedTextBoxField).Text = "Syncfusion"; + } + } +} + +{% endhighlight %} +{% highlight VB %} + +Private Sub Update_Click(sender As Object, e As RoutedEventArgs) + If pdfViewer.LoadedDocument Is Nothing OrElse pdfViewer.LoadedDocument.Form Is Nothing Then + Return + End If + + Dim form = pdfViewer.LoadedDocument.Form + + ' TextBox (Field 0) + Dim textBox = TryCast(form.Fields(0), PdfLoadedTextBoxField) + If textBox IsNot Nothing Then + textBox.Text = "Syncfusion" + End If +End Sub + +{% endhighlight %} +{% endtabs %} + +The below code snippet illustrates how to Remove a Form field to a LoadedDocument +{% tabs %} +{% highlight C# %} + +private void RemoveAt_Click(object sender, RoutedEventArgs e) +{ + if (pdfViewer.LoadedDocument.Form.Fields.Count > 0) + //Remove the field at index 0. + pdfViewer.LoadedDocument.Form.Fields.RemoveAt(0); +} + +{% endhighlight %} +{% highlight VB %} + +Private Sub RemoveAt_Click(sender As Object, e As RoutedEventArgs) + If pdfViewer.LoadedDocument.Form.Fields.Count > 0 Then + `Remove the field at index 0. + pdfViewer.LoadedDocument.Form.Fields.RemoveAt(0) + End If +End Sub + +{% endhighlight %} +{% endtabs %} + +## See also + +- [Overviewe](./overview) +- [Import form fields](./import-form-fields) +- [Export form fields](./export-form-fields) +- [Add form fields](./add-form-fields) +- [Modify form fields](./modify-form-fields) +- [Remove form fields](./remove-form-fields) +- [Form fields events](./form-fields-events) \ No newline at end of file diff --git a/Document-Processing/PDF/PDF-Viewer/wpf/forms/form-filling.md b/Document-Processing/PDF/PDF-Viewer/wpf/forms/form-filling.md new file mode 100644 index 0000000000..5f70c932dd --- /dev/null +++ b/Document-Processing/PDF/PDF-Viewer/wpf/forms/form-filling.md @@ -0,0 +1,215 @@ +--- +layout: post +title: Form filling in WPF PDF Viewer Control | Syncfusion +description: Learn how to view, fill, export, and import PDF form fields using the Syncfusion WPF PDF Viewer to simplify form handling and enhance your PDF workflows. +platform: document-processing +control: PDF Viewer +documentation: ug +--- + +# Filling PDF Forms in WPF PDF Viewer + +The Syncfusion WPF PDF Viewer supports three types of form-filling: + +1. [Filling Form Fields Programmatically](#fill-pdf-forms-programmatically) + + You can fill or update PDF form fields programmatically by acessing the existing Form fields and fill the form fields values. This approach is useful when form data needs to be set dynamically based on application logic. + +2. [Form Filling Through User Interface](#fill-pdf-forms-through-the-user-interface) + + Users can fill in PDF form fields directly through the PDF Viewer user interface by typing text, selecting options, or interacting with supported form elements. + +3. [Importing Form Field Data](#fill-pdf-forms-through-import-data) + + The PDF Viewer allows you to import form field data into an existing PDF document. This enables pre filled forms using external data sources. + +## Fill PDF forms programmatically + + You can fill or update PDF form fields programmatically by acessing the existing Form fields and fill the form fields values. This approach is useful when form data needs to be set dynamically based on application logic. + +The following example demonstrates how to update PDF form field values programmatically: + +{% tabs %} +{% highlight C# %} + +private void UpdateTextbox_Click(object sender, RoutedEventArgs e) +{ + if (pdfViewer.LoadedDocument.Form != null) + { + if (pdfViewer.LoadedDocument.Form.Fields[0] is PdfLoadedTextBoxField) + { + (pdfViewer.LoadedDocument.Form.Fields[0] as PdfLoadedTextBoxField).Text = "Syncfusion"; + } + if(pdfViewer.LoadedDocument.Form.Fields[1] is PdfLoadedCheckBoxField) + { + (pdfViewer.LoadedDocument.Form.Fields[1] as PdfLoadedCheckBoxField).Checked = true; + } + if(pdfViewer.LoadedDocument.Form.Fields[2] is PdfLoadedComboBoxField) + { + (pdfViewer.LoadedDocument.Form.Fields[2] as PdfLoadedComboBoxField).SelectedIndex = 1; + } + if(pdfViewer.LoadedDocument.Form.Fields[3] is PdfLoadedListBoxField) + { + (pdfViewer.LoadedDocument.Form.Fields[3] as PdfLoadedListBoxField).SelectedIndex = new int[2] { 1, 2 }; + } + if (pdfViewer.LoadedDocument.Form.Fields[4] is PdfLoadedSignatureField) + { + PdfLoadedPage page = pdfViewer.LoadedDocument.Pages[0] as PdfLoadedPage; + FileStream certificateStream = new FileStream(@"PDF.pfx", FileMode.Open, FileAccess.Read); + PdfCertificate certificate = new PdfCertificate(certificateStream, "syncfusion"); + + //Load the signature field from field collection and fill this with certificate. + PdfLoadedSignatureField loadedSignatureField = pdfViewer.LoadedDocument.Form.Fields[4] as PdfLoadedSignatureField; + loadedSignatureField.Signature = new PdfSignature(pdfViewer.LoadedDocument, page, certificate, "Signature", loadedSignatureField); + loadedSignatureField.Signature.Certificate = certificate; + loadedSignatureField.Signature.Reason = "Reason"; + FileStream imageStream = new FileStream(System.IO.Path.GetFullPath(@"signature.jpg"), FileMode.Open, FileAccess.Read); + + //Load the image. + PdfBitmap image = new PdfBitmap(imageStream); + + //Draw image in the signature appearance. + loadedSignatureField.Signature.Appearance.Normal.Graphics.DrawImage(image, new PointF(0, 0), new SizeF(loadedSignatureField.Bounds.Width, loadedSignatureField.Bounds.Height)); + //To view the added signature in the output document + pdfViewer.LoadedDocument.Save(System.IO.Path.GetFullPath(@"Output/Output.pdf")); + } + if (pdfViewer.LoadedDocument.Form.Fields[5] is PdfLoadedRadioButtonListField) + { + (pdfViewer.LoadedDocument.Form.Fields[5] as PdfLoadedRadioButtonListField).SelectedIndex = 1; + } + } +} + +{% endhighlight %} +{% highlight VB %} + +Private Sub UpdateTextbox_Click(sender As Object, e As RoutedEventArgs) + If pdfViewer.LoadedDocument Is Nothing OrElse pdfViewer.LoadedDocument.Form Is Nothing Then + Return + End If + + Dim form = pdfViewer.LoadedDocument.Form + + ' TextBox (Field 0) + Dim textBox = TryCast(form.Fields(0), PdfLoadedTextBoxField) + If textBox IsNot Nothing Then + textBox.Text = "Syncfusion" + End If + + ' CheckBox (Field 1) + Dim checkBox = TryCast(form.Fields(1), PdfLoadedCheckBoxField) + If checkBox IsNot Nothing Then + checkBox.Checked = True + End If + + ' ComboBox (Field 2) + Dim combo = TryCast(form.Fields(2), PdfLoadedComboBoxField) + If combo IsNot Nothing Then + combo.SelectedIndex = 1 + End If + + ' ListBox (Field 3) + Dim listBox = TryCast(form.Fields(3), PdfLoadedListBoxField) + If listBox IsNot Nothing Then + listBox.SelectedIndex = New Integer() {1, 2} + End If + + ' Signature Field (Field 4) + Dim sigField = TryCast(form.Fields(4), PdfLoadedSignatureField) + If sigField IsNot Nothing Then + + Dim page = TryCast(pdfViewer.LoadedDocument.Pages(0), PdfLoadedPage) + + ' Load certificate + Using certificateStream As New FileStream("PDF.pfx", FileMode.Open, FileAccess.Read) + + Dim certificate As New PdfCertificate(certificateStream, "syncfusion") + + ' Create signature object + Dim signature As New PdfSignature(pdfViewer.LoadedDocument, page, certificate, "Signature", sigField) + signature.Certificate = certificate + signature.Reason = "Reason" + + ' Load signature appearance image + Using imageStream As New FileStream(Path.GetFullPath("signature.jpg"), FileMode.Open, FileAccess.Read) + Dim image As New PdfBitmap(imageStream) + + signature.Appearance.Normal.Graphics.DrawImage( + image, + New PointF(0, 0), + New SizeF(sigField.Bounds.Width, sigField.Bounds.Height) + ) + End Using + + ' Assign signature to field + sigField.Signature = signature + End Using + + ' To view the added signature in the output document + pdfViewer.LoadedDocument.Save(Path.GetFullPath("Output/Output.pdf")) + End If + + ' RadioButtonList (Field 5) + Dim radioList = TryCast(form.Fields(5), PdfLoadedRadioButtonListField) + If radioList IsNot Nothing Then + radioList.SelectedIndex = 1 + End If + +End Sub + +{% endhighlight %} +{% endtabs %} + +N > For the signature to appear in the document, ensure that the loaded PDF document is saved after modification. + +## Fill PDF forms through the User Interface + +The Syncfusion PDF Viewer allows users to fill PDF form fields directly through the user interface without using code. Users can click on form fields and enter or select values based on the field type. + +![Form Filling](form-filling-images/wpf-pdf-viewer-form-filling.png) + +The PDF Viewer supports common form fields such as text boxes, check boxes, radio buttons, drop-down lists, list boxes, and signature fields. Filled values can be edited at any time, and the entered data is retained during the viewing session. + + +## Fill PDF forms through Import Data + +The Syncfusion WPF PDF Viewer allows you to import form field data into an existing PDF document using the [ImportFormData](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.PdfDocumentView.html#Syncfusion_Windows_PdfViewer_PdfDocumentView_ImportFormData_System_String_Syncfusion_Pdf_Parsing_DataFormat_) API. This feature enables you to pre-fill form fields using data from an external source without requiring manual user input. + +Imported form field data is automatically mapped to the corresponding form fields in the PDF document based on the field names. Once the data is imported, the populated values are displayed in the PDF Viewer and can be edited through the user interface if required. + +{% tabs %} +{% highlight c# %} + +private void button1_Click(object sender, RoutedEventArgs e) +{ + //Import PDF form data + pdfviewer.ImportFormData("Import.fdf", Syncfusion.Pdf.Parsing.DataFormat.Fdf); +} + +{% endhighlight %} +{% highlight VB %} + +Private Sub button1_Click(sender As Object, e As RoutedEventArgs) + 'Import PDF form data + pdfviewer.ImportFormData("Import.fdf", Syncfusion.Pdf.Parsing.DataFormat.Fdf) +End Sub + +{% endhighlight %} +{% endtabs %} + +For more details, see [Import Form Data](./import-export-form-fields/import-form-fields). + +## How to get the filled data and store it to a database + +You can export the filled form field data from the PDF Viewer and store it in a backing system such as a database or file storage. The exported data can later be imported to restore the form state. + +For more details, see [Export Form Data](./import-export-form-fields/export-form-fields). + + +## See also + +- [Overviewe](./overview) +- [Add](./manage-form-fields/create-form-fields) +- [Modify](./manage-form-fields/modify-form-fields) +- [remove](./manage-form-fields/remove-form-fields) +- [Form fields API](./form-fields-api) \ No newline at end of file diff --git a/Document-Processing/PDF/PDF-Viewer/wpf/forms/import-export-form-fields/export-form-fields.md b/Document-Processing/PDF/PDF-Viewer/wpf/forms/import-export-form-fields/export-form-fields.md new file mode 100644 index 0000000000..029fe8d189 --- /dev/null +++ b/Document-Processing/PDF/PDF-Viewer/wpf/forms/import-export-form-fields/export-form-fields.md @@ -0,0 +1,134 @@ +--- +layout: post +title: Export form data in the WPF PDF Viewer component | Syncfusion +description: Learn how to export PDF form field data (FDF, XFDF, JSON, and XML) using the Syncfusion WPF PDF Viewer component. +platform: document-processing +control: PDF Viewer +documentation: ug +--- + +# Export PDF Form Data from WPF PDF Viewer + +The PDF Viewer allows you to export form field data in multiple formats for easy storage or integration. Supported formats: + +- [FDF](#export-as-fdf) +- [XFDF](#export-as-xfdf) +- [JSON](#export-as-json) +- [XML](#export-as-xml) + +Follow the below steps to export data from PDF document in UI + +1. Select **Export** option in the form data toolbar, to save the completed PDF form data as a file in another file format. +2. In Export Form Data As dialog box, you can select the desired format to save the form data (FDF, XFDF, XML, and JSON). + +N> If the PDF document is loaded as a stream, the [PdfViewerControl](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.PdfViewerControl.html) will request for the form name when exporting. + +##How to export Programmatically + +[ExportFormData](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.PdfViewerControl.html#Syncfusion_Windows_PdfViewer_PdfViewerControl_ExportFormData_System_String_Syncfusion_Pdf_Parsing_DataFormat_System_String_) API is used to import the form fields data in code behind. + +### Export as FDF +The following example exports form field data as FDF. + +{% tabs %} +{% highlight c# %} + +private void button1_Click(object sender, RoutedEventArgs e) +{ + //Export PDF form data + pdfviewer.ExportFormData("Export.fdf", Syncfusion.Pdf.Parsing.DataFormat.Fdf, "SourceForm.pdf"); +} + +{% endhighlight %} +{% highlight VB %} + +Private Sub button1_Click(sender As Object, e As RoutedEventArgs) + 'Export PDF form data + pdfviewer.ExportFormData("Export.fdf", Syncfusion.Pdf.Parsing.DataFormat.Fdf, "SourceForm.pdf") +End Sub + +{% endhighlight %} +{% endtabs %} + +### Export as XFDF +The following example exports form field data as XFDF. + +{% tabs %} +{% highlight c# %} + +private void button1_Click(object sender, RoutedEventArgs e) +{ + //Export PDF form data + pdfViewer.ExportFormData("Export.xfdf", Syncfusion.Pdf.Parsing.DataFormat.XFdf, "SourceForm.pdf"); +} + +{% endhighlight %} +{% highlight VB %} + +Private Sub button1_Click(sender As Object, e As RoutedEventArgs) + 'Export PDF form data + pdfViewer.ExportFormData("Export.xfdf", Syncfusion.Pdf.Parsing.DataFormat.XFdf, "SourceForm.pdf") +End Sub + +{% endhighlight %} +{% endtabs %} + +### Export as JSON +The following example exports form field data as JSON. + +{% tabs %} +{% highlight c# %} + +private void button1_Click(object sender, RoutedEventArgs e) +{ + //Export PDF form data + pdfViewer.ExportFormData("Export.json", Syncfusion.Pdf.Parsing.DataFormat.Json, "SourceForm.pdf"); +} + +{% endhighlight %} +{% highlight VB %} + +Private Sub button1_Click(sender As Object, e As RoutedEventArgs) + 'Export PDF form data + pdfViewer.ExportFormData("Export.json", Syncfusion.Pdf.Parsing.DataFormat.Json, "SourceForm.pdf") +End Sub + +{% endhighlight %} +{% endtabs %} + +### Export as XML +The following example exports form field data as XML. + +{% tabs %} +{% highlight c# %} + +private void button1_Click(object sender, RoutedEventArgs e) +{ + //Export PDF form data + pdfViewer.ExportFormData("Export.xml", Syncfusion.Pdf.Parsing.DataFormat.Xml, "SourceForm.pdf"); +} + +{% endhighlight %} +{% highlight VB %} + +Private Sub button1_Click(sender As Object, e As RoutedEventArgs) + 'Export PDF form data + pdfViewer.ExportFormData("Export.xml", Syncfusion.Pdf.Parsing.DataFormat.Xml, "SourceForm.pdf") +End Sub + +{% endhighlight %} +{% endtabs %} + +## Common Use Cases +- Save user-entered data to your server without altering the original PDF. +- Export as JSON for REST API integration. +- Export as FDF/XFDF for compatibility with other PDF tools. + +## See also + +- [Overviewe](./overview) +- [Import form fields](./import-form-fields) +- [Add form fields](./add-form-fields) +- [Modify form fields](./modify-form-fields) +- [Remove form fields](./remove-form-fields) +- [Form fields API](../form-fields-api) \ No newline at end of file diff --git a/Document-Processing/PDF/PDF-Viewer/wpf/forms/import-export-form-fields/import-form-fields.md b/Document-Processing/PDF/PDF-Viewer/wpf/forms/import-export-form-fields/import-form-fields.md new file mode 100644 index 0000000000..7d43bd9eac --- /dev/null +++ b/Document-Processing/PDF/PDF-Viewer/wpf/forms/import-export-form-fields/import-form-fields.md @@ -0,0 +1,135 @@ +--- +layout: post +title: Import form data in the WPF PDF Viewer component | Syncfusion +description: Learn how to import PDF form field data (FDF, XFDF, JSON, and XML) using the Syncfusion WPF PDF Viewer component. +platform: document-processing +control: PDF Viewer +documentation: ug +--- + +# Import PDF Form Data into WPF PDF Viewer + +The **PDF Viewer** lets you import values into interactive form fields in the currently loaded PDF. You can import data from these formats: + +- [FDF](#import-as-fdf) +- [XFDF](#import-xfdf) +- [JSON](#import-json) +- [XML](#import-xml) + +Follow the below steps to import data to PDF document with `AcroForm`. + +1. Click the form data tool button in the left pane, the form data toolbar will appear as a secondary toolbar in the [PdfViewerControl](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.PdfViewerControl.html). +2. Select **Import** option in form data toolbar to import the PDF form data. + +![WPF PDF Viewer Import Form Data](form-filling-images/wpf-pdf-viewer-import-form-data.png) + +## How to Import Programmatically +[ImportFormData](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.PdfViewerControl.html#Syncfusion_Windows_PdfViewer_PdfViewerControl_ImportFormData_System_String_Syncfusion_Pdf_Parsing_DataFormat_) API is used to import the form fields data in code behind. + + +### Import FDF +The following example imports form field data as FDF. + +{% tabs %} +{% highlight c# %} + +private void button1_Click(object sender, RoutedEventArgs e) +{ + //Import PDF form data + pdfviewer.ImportFormData("Import.fdf", Syncfusion.Pdf.Parsing.DataFormat.Fdf); +} + +{% endhighlight %} +{% highlight VB %} + +Private Sub button1_Click(sender As Object, e As RoutedEventArgs) + 'Import PDF form data + pdfviewer.ImportFormData("Import.fdf", Syncfusion.Pdf.Parsing.DataFormat.Fdf) +End Sub + +{% endhighlight %} +{% endtabs %} + +### Import XFDF +The following example imports form field data as XFDF. + +{% tabs %} +{% highlight c# %} + +private void button1_Click(object sender, RoutedEventArgs e) +{ + //Import PDF form data + pdfViewer.ImportFormData("Import.xfdf", Syncfusion.Pdf.Parsing.DataFormat.XFdf); +} + +{% endhighlight %} +{% highlight VB %} + +Private Sub button1_Click(sender As Object, e As RoutedEventArgs) + 'Import PDF form data + pdfViewer.ImportFormData("Import.xfdf", Syncfusion.Pdf.Parsing.DataFormat.XFdf) +End Sub + +{% endhighlight %} +{% endtabs %} + +### Import JSON +The following example imports form field data as JSON. + +{% tabs %} +{% highlight c# %} + +private void button1_Click(object sender, RoutedEventArgs e) +{ + //Import PDF form data + pdfViewer.ImportFormData("Import.json", Syncfusion.Pdf.Parsing.DataFormat.Json); +} + +{% endhighlight %} +{% highlight VB %} + +Private Sub button1_Click(sender As Object, e As RoutedEventArgs) + 'Import PDF form data + pdfViewer.ImportFormData("Import.json", Syncfusion.Pdf.Parsing.DataFormat.Json) +End Sub + +{% endhighlight %} +{% endtabs %} + +## Import XML +The following example imports form field data as XML. + +{% tabs %} +{% highlight c# %} + +private void button1_Click(object sender, RoutedEventArgs e) +{ + //Import PDF form data + pdfViewer.ImportFormData("Import.xml", Syncfusion.Pdf.Parsing.DataFormat.Xml); +} + +{% endhighlight %} +{% highlight VB %} + +Private Sub button1_Click(sender As Object, e As RoutedEventArgs) + 'Import PDF form data + pdfViewer.ImportFormData("Import.xml", Syncfusion.Pdf.Parsing.DataFormat.Xml) +End Sub + +{% endhighlight %} +{% endtabs %} + +## Common Use Cases + +- Pre-fill application forms from a database using JSON. +- Migrate data from other PDF tools using FDF/XFDF. +- Restore user progress saved locally or on the server. + +## See also + +- [Overviewe](./overview) +- [Export form fields](./export-form-fields) +- [Add form fields](./add-form-fields) +- [Modify form fields](./modify-form-fields) +- [Remove form fields](./remove-form-fields) +- [Form fields API](../form-fields-api) \ No newline at end of file diff --git a/Document-Processing/PDF/PDF-Viewer/wpf/forms/manage-form-fields/add-form-fields.md b/Document-Processing/PDF/PDF-Viewer/wpf/forms/manage-form-fields/add-form-fields.md new file mode 100644 index 0000000000..566d2c01a1 --- /dev/null +++ b/Document-Processing/PDF/PDF-Viewer/wpf/forms/manage-form-fields/add-form-fields.md @@ -0,0 +1,351 @@ +--- +layout: post +title: Add form fields in the WPF PDF Viewer | Syncfusion +description: Learn how to add various PDF form fields programmatically using the Syncfusion WPF PDF Viewer API to create interactive form fields and build dynamic PDF forms. +platform: document-processing +control: PDF Viewer +documentation: ug +--- +# Add PDF Form Field in WPF PDF Viewer + +## Add Form Fields Programmatically (API) + +The PDF Viewer allows users to programmatically add form fields without user interaction at runtime. + +### Textbox + +**Add Programmatically (API)** + +[PdfTextBoxField](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Interactive.PdfTextBoxField.html) class is used to create a text box field in PDF forms. + +The below code snippet illustrates how to add a textbox field to a LoadedDocument +{% tabs %} +{% highlight C# %} + +private void AddTextbox_Click(object sender, RoutedEventArgs e) +{ + if (pdfViewer.LoadedDocument.Form != null) + { + PdfLoadedPage page = pdfViewer.LoadedDocument.Pages[0] as PdfLoadedPage; + //Create a textbox field and add the properties. + PdfTextBoxField textBoxField = new PdfTextBoxField(page, "FirstName"); + textBoxField.Bounds = new RectangleF(0, 0, 100, 20); + //Add the form field to the document. + pdfViewer.LoadedDocument.Form.Fields.Add(textBoxField); + } +} + +{% endhighlight %} +{% highlight VB %} + +Private Sub AddTextbox_Click(sender As Object, e As RoutedEventArgs) + If pdfViewer.LoadedDocument.Form IsNot Nothing Then + Dim page As PdfLoadedPage = TryCast(pdfViewer.LoadedDocument.Pages(0), PdfLoadedPage) + `Create a textbox field and add the properties. + Dim textBoxField As PdfTextBoxField = New PdfTextBoxField(page, "FirstName") + textBoxField.Bounds = New RectangleF(0, 0, 100, 20) + `Add the form field to the document. + pdfViewer.LoadedDocument.Form.Fields.Add(textBoxField) + End If +End Sub + +{% endhighlight %} +{% endtabs %} + + +### Password + +**Add Programmatically (API)** + +{% tabs %} +{% highlight C# %} + +private void AddPasswordbox_Click(object sender, RoutedEventArgs e) +{ + if (pdfViewer.LoadedDocument.Form != null) + { + PdfLoadedPage page = pdfViewer.LoadedDocument.Pages[0] as PdfLoadedPage; + PdfTextBoxField passwordField = new PdfTextBoxField(page, "UserPassword"); + passwordField.Bounds = new RectangleF(0, 30, 150, 22); + passwordField.Password = true; + pdfViewer.LoadedDocument.Form.Fields.Add(passwordField); + } +} + +{% endhighlight %} +{% highlight VB %} + +Private Sub AddPasswordbox_Click(sender As Object, e As RoutedEventArgs) + If pdfViewer.LoadedDocument.Form IsNot Nothing Then + Dim page As PdfLoadedPage = TryCast(pdfViewer.LoadedDocument.Pages(0), PdfLoadedPage) + Dim passwordField As New PdfTextBoxField(page, "UserPassword") + passwordField.Bounds = New RectangleF(0, 30, 150, 22) + passwordField.Password = True + ' Add the field to the PDF form + pdfViewer.LoadedDocument.Form.Fields.Add(passwordField) + End If +End Sub + +{% endhighlight %} +{% endtabs %} + +### CheckBox + +**Add Programmatically (API)** +You can create the check box field in PDF forms using [PdfCheckBoxField](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Interactive.PdfCheckBoxField.html) class. + +Please refer the below code snippet for adding the check box field in LoadedDocument. + +{% tabs %} +{% highlight C# %} + +private void AddCheckbox_Click(object sender, RoutedEventArgs e) +{ + if (pdfViewer.LoadedDocument.Form != null) + { + PdfLoadedPage page = pdfViewer.LoadedDocument.Pages[0] as PdfLoadedPage; + //Create Check Box field. + PdfCheckBoxField checkBoxField = new PdfCheckBoxField(page, "CheckBox"); + //Set check box properties. + checkBoxField.ToolTip = "Check Box"; + checkBoxField.Bounds = new RectangleF(0, 20, 10, 10); + //Add the form field to the document. + pdfViewer.LoadedDocument.Form.Fields.Add(checkBoxField); + } +} + +{% endhighlight %} +{% highlight VB %} + +Private Sub AddCheckbox_Click(sender As Object, e As RoutedEventArgs) + If pdfViewer.LoadedDocument.Form IsNot Nothing Then + Dim page As PdfLoadedPage = TryCast(pdfViewer.LoadedDocument.Pages(0), PdfLoadedPage) + 'Create Check Box field. + Dim checkBoxField As New PdfCheckBoxField(page, "CheckBox") + 'Set check box properties. + checkBoxField.ToolTip = "Check Box" + checkBoxField.Bounds = New RectangleF(0, 20, 10, 10) + 'Add the form field to the document. + pdfViewer.LoadedDocument.Form.Fields.Add(checkBoxField) + End If +End Sub + +{% endhighlight %} +{% endtabs %} + +### RadioButton + +**Add Programmatically (API)** + +To create the radio button in the PDF forms, you can use [PdfRadioButtonListField](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Interactive.PdfRadioButtonListField.html) class and you can create the radio button list items by using the [PdfRadioButtonListItem](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Interactive.PdfRadioButtonListItem.html) class. + +Please refer the below code snippet for adding the radio button in LoadedDocument. + +{% tabs %} +{% highlight C# %} + +private void AddRadioButton_Click(object sender, RoutedEventArgs e) +{ + if (pdfViewer.LoadedDocument.Form != null) + { + PdfLoadedPage page = pdfViewer.LoadedDocument.Pages[0] as PdfLoadedPage; + PdfRadioButtonListField employeesRadioList = new PdfRadioButtonListField(page, "employeesRadioList"); + //Create radio button items. + PdfRadioButtonListItem radioButtonItem1 = new PdfRadioButtonListItem("1-9"); + radioButtonItem1.Bounds = new RectangleF(100, 140, 20, 20); + PdfRadioButtonListItem radioButtonItem2 = new PdfRadioButtonListItem("10-49"); + radioButtonItem2.Bounds = new RectangleF(100, 170, 20, 20); + //Add the items to radio button group. + employeesRadioList.Items.Add(radioButtonItem1); + employeesRadioList.Items.Add(radioButtonItem2); + //Add the radio button into form. + pdfViewer.LoadedDocument.Form.Fields.Add(employeesRadioList); + } +} + +{% endhighlight %} +{% highlight VB %} + +Private Sub AddRadioButton_Click(sender As Object, e As RoutedEventArgs) + If pdfViewer.LoadedDocument.Form IsNot Nothing Then + Dim page As PdfLoadedPage = TryCast(pdfViewer.LoadedDocument.Pages(0), PdfLoadedPage) + 'Create radio button list field. + Dim employeesRadioList As New PdfRadioButtonListField(page, "employeesRadioList") + 'Create radio button items. + Dim radioButtonItem1 As New PdfRadioButtonListItem("1-9") + radioButtonItem1.Bounds = New RectangleF(100, 140, 20, 20) + Dim radioButtonItem2 As New PdfRadioButtonListItem("10-49") + radioButtonItem2.Bounds = New RectangleF(100, 170, 20, 20) + 'Add the items to the radio button group. + employeesRadioList.Items.Add(radioButtonItem1) + employeesRadioList.Items.Add(radioButtonItem2) + 'Add the radio button group into the form. + pdfViewer.LoadedDocument.Form.Fields.Add(employeesRadioList) + End If +End Sub + +{% endhighlight %} +{% endtabs %} + +### ListBox + +**Add Programmatically (API)** +You can create the list box field in PDF forms using [PdfListBoxField](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Interactive.PdfListBoxField.html) class. + +Please refer the below code snippet for adding the list box field in LoadedDocument. + +{% tabs %} +{% highlight C# %} + +private void AddListbox_Click(object sender, RoutedEventArgs e) +{ + if (pdfViewer.LoadedDocument.Form != null) + { + PdfLoadedPage page = pdfViewer.LoadedDocument.Pages[0] as PdfLoadedPage; + //Create list box. + PdfListBoxField listBoxField = new PdfListBoxField(page, "list1"); + //Set the properties. + listBoxField.Bounds = new RectangleF(100, 60, 100, 50); + //Add the items to the list box. + listBoxField.Items.Add(new PdfListFieldItem("English", "English")); + listBoxField.Items.Add(new PdfListFieldItem("French", "French")); + listBoxField.Items.Add(new PdfListFieldItem("German", "German")); + //Select the item. + listBoxField.SelectedIndex = 0; + //Set the multi select option. + listBoxField.MultiSelect = true; + //Add the list box into PDF document. + pdfViewer.LoadedDocument.Form.Fields.Add(listBoxField); + } +} + +{% endhighlight %} +{% highlight VB %} + +Private Sub AddListbox_Click(sender As Object, e As RoutedEventArgs) + If pdfViewer.LoadedDocument.Form IsNot Nothing Then + Dim page As PdfLoadedPage = TryCast(pdfViewer.LoadedDocument.Pages(0), PdfLoadedPage) + 'Create list box. + Dim listBoxField As New PdfListBoxField(page, "list1") + 'Set the properties. + listBoxField.Bounds = New RectangleF(100, 60, 100, 50) + 'Add the items to the list box. + listBoxField.Items.Add(New PdfListFieldItem("English", "English")) + listBoxField.Items.Add(New PdfListFieldItem("French", "French")) + listBoxField.Items.Add(New PdfListFieldItem("German", "German")) + 'Select the item. + listBoxField.SelectedIndex = 0 + 'Enable multi-select option. + listBoxField.MultiSelect = True + 'Add the list box into the PDF document. + pdfViewer.LoadedDocument.Form.Fields.Add(listBoxField) + End If +End Sub + +{% endhighlight %} +{% endtabs %} + +### ComboBox + +**Add Programmatically (API)** +[PdfComboBoxField](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Interactive.PdfComboBoxField.html) class is used to create a combo box field in PDF forms. You can add a list of items to the combo box by using the [PdfListFieldItem](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Interactive.PdfListFieldItem.html) class. + +Please refer the below code snippet for adding the combo box in LoadedDocument. + +{% tabs %} +{% highlight C# %} + +private void AddCombobox_Click(object sender, RoutedEventArgs e) +{ + if (pdfViewer.LoadedDocument.Form != null) + { + PdfLoadedPage page = pdfViewer.LoadedDocument.Pages[0] as PdfLoadedPage; + //Create a combo box for the first page. + PdfComboBoxField comboBoxField = new PdfComboBoxField(page, "JobTitle"); + //Set the combo box properties. + comboBoxField.Bounds = new RectangleF(0, 60, 100, 20); + //Set tooltip. + comboBoxField.ToolTip = "Job Title"; + //Add list items. + comboBoxField.Items.Add(new PdfListFieldItem("Development", "accounts")); + comboBoxField.Items.Add(new PdfListFieldItem("Support", "advertise")); + comboBoxField.Items.Add(new PdfListFieldItem("Documentation", "content")); + //Add combo box to the form. + pdfViewer.LoadedDocument.Form.Fields.Add(comboBoxField); + } +} + +{% endhighlight %} +{% highlight VB %} + +Private Sub AddCombobox_Click(sender As Object, e As RoutedEventArgs) + If pdfViewer.LoadedDocument.Form IsNot Nothing Then + Dim page As PdfLoadedPage = TryCast(pdfViewer.LoadedDocument.Pages(0), PdfLoadedPage) + 'Create a combo box for the first page. + Dim comboBoxField As New PdfComboBoxField(page, "JobTitle") + 'Set the combo box properties. + comboBoxField.Bounds = New RectangleF(0, 60, 100, 20) + 'Set tooltip. + comboBoxField.ToolTip = "Job Title" + 'Add list items. + comboBoxField.Items.Add(New PdfListFieldItem("Development", "accounts")) + comboBoxField.Items.Add(New PdfListFieldItem("Support", "advertise")) + comboBoxField.Items.Add(New PdfListFieldItem("Documentation", "content")) + 'Add combo box to the form. + pdfViewer.LoadedDocument.Form.Fields.Add(comboBoxField) + End If +End Sub + +{% endhighlight %} +{% endtabs %} + +### Signature Field + +**Add Programmatically (API)** +You can add the signature field in PDF forms using [PdfSignatureField](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Interactive.PdfSignatureField.html) class. + +Please refer the below code snippet for adding the signature field in LoadedDocument. + +{% tabs %} +{% highlight C# %} + +private void AddSignatureField_Click(object sender, RoutedEventArgs e) +{ + if (pdfViewer.LoadedDocument.Form != null) + { + PdfLoadedPage page = pdfViewer.LoadedDocument.Pages[0] as PdfLoadedPage; + //Create PDF Signature field. + PdfSignatureField signatureField = new PdfSignatureField(page, "Signature"); + //Set properties to the signature field. + signatureField.Bounds = new RectangleF(0, 100, 90, 20); + signatureField.ToolTip = "Signature"; + //Add the form field to the document. + pdfViewer.LoadedDocument.Form.Fields.Add(signatureField); + } +} + +{% endhighlight %} +{% highlight VB %} + +Private Sub AddSignatureField_Click(sender As Object, e As RoutedEventArgs) + If pdfViewer.LoadedDocument.Form IsNot Nothing Then + Dim page As PdfLoadedPage = TryCast(pdfViewer.LoadedDocument.Pages(0), PdfLoadedPage) + Dim signatureField As New PdfSignatureField(page, "Signature") + ' Set properties of the signature field. + signatureField.Bounds = New RectangleF(0F, 100F, 90F, 20F) + signatureField.ToolTip = "Signature" + ' Add the form field to the document. + pdfViewer.LoadedDocument.Form.Fields.Add(signatureField) + End If +End Sub + +{% endhighlight %} +{% endtabs %} + +N > To ensure the signature appears in the document, save the loaded PDF after applying the signature. + +## See Also +- [Overviewe](./overview) +- [Modify form fields](./modify-form-fields) +- [Remove form fields](./remove-form-fields) +- [Form Fields API](../form-fields-api) \ No newline at end of file diff --git a/Document-Processing/PDF/PDF-Viewer/wpf/forms/manage-form-fields/modify-form-fields.md b/Document-Processing/PDF/PDF-Viewer/wpf/forms/manage-form-fields/modify-form-fields.md new file mode 100644 index 0000000000..d0431c0657 --- /dev/null +++ b/Document-Processing/PDF/PDF-Viewer/wpf/forms/manage-form-fields/modify-form-fields.md @@ -0,0 +1,300 @@ +--- +layout: post +title: Modify form fields values in the WPF PDF Viewer | Syncfusion +description: Learn how to modify PDF form fields values using the UI and programmatically with APIs in the Syncfusion WPF PDF Viewer. +platform: document-processing +control: PDF Viewer +documentation: ug +--- + +# Modify PDF Form Field values in WPF + +You can modify form fields values using the **UI** or **API**. + +## Modify PDF Form Field values using the UI +The Syncfusion WPF PDF Viewer allows users to modify PDF form fields values directly through the user interface without using code. Users can click on form fields and enter or select values based on the field type. + +![Modify Form fields](./images/FormFillingUI.gif) + +The WPF PDF Viewer supports common form fields such as text boxes, check boxes, radio buttons,list boxes, and signature fields. Filled values can be edited at any time, and the entered data is retained during the viewing session. + +## Modify PDF Form Field values programmatically +You can Modify PDF form fields values programmatically by acessing the existing Form fields. This approach is useful when form data needs to be set dynamically based on application logic. + +## Modify PDF Form Field values + +### Textbox +Update TextBox Field Through the UI +You can modify text box fields at runtime from UI. +![TextboxField](./images/TextBoxField.png) + +Update TextBox Field Programmatically (Code‑Behind) + +{% tabs %} +{% highlight C# %} + +private void Update_Click(object sender, RoutedEventArgs e) +{ + if (pdfViewer.LoadedDocument.Form != null) + { + if (pdfViewer.LoadedDocument.Form.Fields[0] is PdfLoadedTextBoxField) + { + (pdfViewer.LoadedDocument.Form.Fields[0] as PdfLoadedTextBoxField).Text = "Syncfusion"; + } + } +} + +{% endhighlight %} +{% highlight VB %} + +Private Sub Update_Click(sender As Object, e As RoutedEventArgs) + If pdfViewer.LoadedDocument Is Nothing OrElse pdfViewer.LoadedDocument.Form Is Nothing Then + Return + End If + + Dim form = pdfViewer.LoadedDocument.Form + + ' TextBox (Field 0) + Dim textBox = TryCast(form.Fields(0), PdfLoadedTextBoxField) + If textBox IsNot Nothing Then + textBox.Text = "Syncfusion" + End If +End Sub + +{% endhighlight %} +{% endtabs %} + +### CheckBox +Update CheckBox Field Through the UI +You can set checkbox fields at runtime from UI. +![CheckboxField](./images/CheckBoxField.png) + +Update CheckBox Field Programmatically (Code‑Behind) + +{% tabs %} +{% highlight C# %} + +private void UpdateCheckBox_Click(object sender, RoutedEventArgs e) +{ + if (pdfViewer.LoadedDocument == null || pdfViewer.LoadedDocument.Form == null) return; + + var cb = pdfViewer.LoadedDocument.Form.Fields[2] as PdfLoadedCheckBoxField; // replace index + if (cb != null) + { + cb.Checked = true; // or false + } +} + +{% endhighlight %} +{% highlight VB %} + +Private Sub UpdateCheckBox_Click(sender As Object, e As RoutedEventArgs) + If pdfViewer.LoadedDocument Is Nothing OrElse pdfViewer.LoadedDocument.Form Is Nothing Then Return + + Dim cb = TryCast(pdfViewer.LoadedDocument.Form.Fields(2), PdfLoadedCheckBoxField) + If cb IsNot Nothing Then + cb.Checked = True + End If +End Sub +{% endhighlight %} +{% endtabs %} + +### RadioButton +Update Radio Button Field Through the UI +You can change radio button selections at runtime from UI. +![RadioButtonField](./images/Radiobutton.gif) + +Update Radio Button Field Programmatically (Code‑Behind) + +{% tabs %} +{% highlight C# %} + +private void UpdateRadio_Click(object sender, RoutedEventArgs e) +{ + if (pdfViewer.LoadedDocument == null || pdfViewer.LoadedDocument.Form == null) return; + + var radioList = pdfViewer.LoadedDocument.Form.Fields[3] as PdfLoadedRadioButtonListField; // replace index + if (radioList != null) + { + radioList.SelectedIndex = 1; // 0-based index + } +} + +{% endhighlight %} +{% highlight VB %} + +Private Sub UpdateRadio_Click(sender As Object, e As RoutedEventArgs) + If pdfViewer.LoadedDocument Is Nothing OrElse pdfViewer.LoadedDocument.Form Is Nothing Then Return + + Dim radioList = TryCast(pdfViewer.LoadedDocument.Form.Fields(3), PdfLoadedRadioButtonListField) + If radioList IsNot Nothing Then + radioList.SelectedIndex = 1 + End If +End Sub + +{% endhighlight %} +{% endtabs %} + +### ListBox +Update ListBox Field Through the UI +You can set list box selections at runtime from UI. +![ListBoxField](./images/ListBoxField.gif) + +Update ListBox Field Programmatically (Code‑Behind) + +{% tabs %} +{% highlight C# %} + +private void UpdateListBox_Click(object sender, RoutedEventArgs e) +{ + if (pdfViewer.LoadedDocument == null || pdfViewer.LoadedDocument.Form == null) return; + + var listBox = pdfViewer.LoadedDocument.Form.Fields[4] as PdfLoadedListBoxField; // replace index + if (listBox != null) + { + listBox.SelectedIndex = new int[] { 1, 2 }; // select multiple indices + } +} + +{% endhighlight %} +{% highlight VB %} + +Private Sub UpdateListBox_Click(sender As Object, e As RoutedEventArgs) + If pdfViewer.LoadedDocument Is Nothing OrElse pdfViewer.LoadedDocument.Form Is Nothing Then Return + + Dim listBox = TryCast(pdfViewer.LoadedDocument.Form.Fields(4), PdfLoadedListBoxField) + If listBox IsNot Nothing Then + listBox.SelectedIndex = New Integer() {1, 2} + End If +End Sub + +{% endhighlight %} +{% endtabs %} + +### ComboBox +Update ComboBox Field Through the UI +You can set combo box selections at runtime from UI. +![ComboBoxField](./images/ComboboxField.png) + +Update ComboBox Field Programmatically (Code‑Behind) + +{% tabs %} +{% highlight C# %} + +private void UpdateComboBox_Click(object sender, RoutedEventArgs e) +{ + if (pdfViewer.LoadedDocument == null || pdfViewer.LoadedDocument.Form == null) return; + + var combo = pdfViewer.LoadedDocument.Form.Fields[5] as PdfLoadedComboBoxField; // replace index + if (combo != null) + { + combo.SelectedIndex = 1; + } +} + +{% endhighlight %} +{% highlight VB %} + +Private Sub UpdateComboBox_Click(sender As Object, e As RoutedEventArgs) + If pdfViewer.LoadedDocument Is Nothing OrElse pdfViewer.LoadedDocument.Form Is Nothing Then Return + + Dim combo = TryCast(pdfViewer.LoadedDocument.Form.Fields(5), PdfLoadedComboBoxField) + If combo IsNot Nothing Then + combo.SelectedIndex = 1 + End If +End Sub + +{% endhighlight %} +{% endtabs %} + +### Signature Field +You can apply or update signature fields at runtime from UI. +#### Add a signature from signature field in UI + +Clicking the signature box will open the signature pad, requesting the user to draw the signature. clicking on the apply button will add the drawn signature to the signature field. + +![WPF PDF Viewer Delete a Signature from Signature field](form-filling-images/wpf-pdf-viewer-signature-form-field-add.png) + +#### Deleting a signature from signature field in UI + +Selecting the delete option from the context menu, which is displayed when right-clicking on the selected signature, would delete the respective signature from the signature field. + +![WPF PDF Viewer Delete a Signature from Signature field](form-filling-images/wpf-pdf-viewer-signature-form-field-delete.png) + +Update Signature Field Programmatically (Code‑Behind) + +{% tabs %} +{% highlight C# %} + +private void UpdateSignature_Click(object sender, RoutedEventArgs e) +{ + if (pdfViewer.LoadedDocument == null || pdfViewer.LoadedDocument.Form == null) return; + + var sigField = pdfViewer.LoadedDocument.Form.Fields[6] as PdfLoadedSignatureField; // replace index + if (sigField != null) + { + PdfLoadedPage page = pdfViewer.LoadedDocument.Pages[0] as PdfLoadedPage; + + using (FileStream certificateStream = new FileStream("PDF.pfx", FileMode.Open, FileAccess.Read)) + { + PdfCertificate certificate = new PdfCertificate(certificateStream, "certPassword"); + + PdfSignature signature = new PdfSignature(pdfViewer.LoadedDocument, page, certificate, "Signature", sigField); + signature.Certificate = certificate; + signature.Reason = "Approved"; + sigField.Signature = signature; + + using (FileStream imageStream = new FileStream(Path.GetFullPath("signature.jpg"), FileMode.Open, FileAccess.Read)) + { + PdfBitmap image = new PdfBitmap(imageStream); + signature.Appearance.Normal.Graphics.DrawImage( + image, + new PointF(0, 0), + new SizeF(sigField.Bounds.Width, sigField.Bounds.Height) + ); + } + + pdfViewer.LoadedDocument.Save(Path.GetFullPath("Output/Output.pdf")); + } + } +} + +{% endhighlight %} +{% highlight VB %} + +Private Sub UpdateSignature_Click(sender As Object, e As RoutedEventArgs) + If pdfViewer.LoadedDocument Is Nothing OrElse pdfViewer.LoadedDocument.Form Is Nothing Then Return + + Dim sigField = TryCast(pdfViewer.LoadedDocument.Form.Fields(6), PdfLoadedSignatureField) + If sigField IsNot Nothing Then + Dim page = TryCast(pdfViewer.LoadedDocument.Pages(0), PdfLoadedPage) + + Using certificateStream As New FileStream("PDF.pfx", FileMode.Open, FileAccess.Read) + Dim certificate As New PdfCertificate(certificateStream, "certPassword") + + Dim signature As New PdfSignature(pdfViewer.LoadedDocument, page, certificate, "Signature", sigField) + signature.Certificate = certificate + signature.Reason = "Approved" + sigField.Signature = signature + + Using imageStream As New FileStream(Path.GetFullPath("signature.jpg"), FileMode.Open, FileAccess.Read) + Dim image As New PdfBitmap(imageStream) + signature.Appearance.Normal.Graphics.DrawImage(image, New PointF(0, 0), New SizeF(sigField.Bounds.Width, sigField.Bounds.Height)) + End Using + + pdfViewer.LoadedDocument.Save(Path.GetFullPath("Output/Output.pdf")) + End Using + End If +End Sub + +{% endhighlight %} +{% endtabs %} + +N > To ensure the signature appears in the document, save the loaded PDF after applying the signature. + +## See also + +- [Overviewe](./overview) +- [Add form fields](./add-form-fields) +- [Remove form Fields](./remove-form-fields) +- [Form fields API](../form-fields-api) \ No newline at end of file diff --git a/Document-Processing/PDF/PDF-Viewer/wpf/forms/manage-form-fields/remove-form-fields.md b/Document-Processing/PDF/PDF-Viewer/wpf/forms/manage-form-fields/remove-form-fields.md new file mode 100644 index 0000000000..717253a776 --- /dev/null +++ b/Document-Processing/PDF/PDF-Viewer/wpf/forms/manage-form-fields/remove-form-fields.md @@ -0,0 +1,46 @@ +--- +layout: post +title: Remove form fields in the WPF PDF Viewer component | Syncfusion +description: Learn how to remove PDF form fields programmatically using the Syncfusion WPF PDF Viewer API to simplify form handling and automate PDF form cleanup. +platform: document-processing +control: PDF Viewer +documentation: ug +--- + + +# Remove PDF Form Fields from a PDF in WPF + +## Remove Form Fields Programmatically +The PDF Viewer allows users to programmatically remove form fields without user interaction at runtime. + +The following code sample explains how to remove the form field during runtime. + +{% tabs %} +{% highlight C# %} + +private void RemoveAt_Click(object sender, RoutedEventArgs e) +{ + if (pdfViewer.LoadedDocument.Form.Fields.Count > 0) + //Remove the field at index 0. + pdfViewer.LoadedDocument.Form.Fields.RemoveAt(0); +} + +{% endhighlight %} +{% highlight VB %} + +Private Sub RemoveAt_Click(sender As Object, e As RoutedEventArgs) + If pdfViewer.LoadedDocument.Form.Fields.Count > 0 Then + `Remove the field at index 0. + pdfViewer.LoadedDocument.Form.Fields.RemoveAt(0) + End If +End Sub + +{% endhighlight %} +{% endtabs %} + +## See also + +- [Overviewe](./overview) +- [Add form fields](./add-form-fields) +- [Modify form fields](./modify-form-fields) +- [Form fields API](../form-fields-api) \ No newline at end of file diff --git a/Document-Processing/PDF/PDF-Viewer/wpf/forms/overview-add-forms.md b/Document-Processing/PDF/PDF-Viewer/wpf/forms/overview-add-forms.md new file mode 100644 index 0000000000..7c8c6f9624 --- /dev/null +++ b/Document-Processing/PDF/PDF-Viewer/wpf/forms/overview-add-forms.md @@ -0,0 +1,17 @@ +--- +layout: post +title: Overview of Add form fields in WPF PDF Viewer | Syncfusion +description: Learn how to Add edit each form field using the PDF Viewer UI and how to create them programmatically in the Syncfusion WPF PDF Viewer. +platform: document-processing +control: PDF Viewer +documentation: ug +--- + +# Add, Modify and Remove Form Fields in WPF PDF Viewer + +The [WPF PDF Viewer](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/wpf/overview) provides controlled form‑editing capabilities that enable developers to manage PDF form fields efficiently within their applications. The viewer supports three main operations—adding, modifying, and removing form fields—with modification supported through both the UI and programmatically, while adding and removing form fields are supported only programmatically + +This section explains how to: +- [Add PDF form fields](./manage-form-fields/add-form-fields) +- [Modify form field values](./manage-form-fields/modify-form-fields) +- [Remove form fields from a PDF document](./manage-form-fields/remove-form-fields) diff --git a/Document-Processing/PDF/PDF-Viewer/wpf/forms/overview.md b/Document-Processing/PDF/PDF-Viewer/wpf/forms/overview.md new file mode 100644 index 0000000000..d3e11b175d --- /dev/null +++ b/Document-Processing/PDF/PDF-Viewer/wpf/forms/overview.md @@ -0,0 +1,39 @@ +--- +layout: post +title: Overview of Forms in WPF PDF Viewer Control | Syncfusion +description: Learn about Form Filling in PDF Files support in Syncfusion®; WPF Pdf Viewer control, its elements and more +platform: document-processing +control: PDF Viewer +documentation: ug +--- + +# Overview of Forms in WPF PDF Viewer + +The Syncfusion WPF PDF Viewer delivers a complete, easy-to-use PDF forms experience. You can fill, edit, and delete form fields directly within your PDF documents. These actions are supported through both the intuitive user interface and powerful programmatic APIs. + +The viewer also includes smooth import and export support for form data, making integration effortless. Developers benefit from extensive API control, while end users enjoy a clean and simple interface designed for a seamless and stress-free form-filling experience. + +![WPF PDF Viewer Form Filling](form-filling-images/wpf-pdf-viewer-form-filling.png) + +## Filling PDF Forms + +Experience effortless PDF form filling through a clean, intuitive UI or automated workflows using powerful APIs. Flexible form data import and export support ensures smooth and efficient operations when working with PDF forms. + +See the [Filling PDF Forms](./form-filling) page for full details. + +![FormFilling](./images/FormFillingUI.gif) + +1. [Programmatically Form fill](./form-filling#fill-pdf-forms-programmatically) +2. [Form Fill Using UI](./form-filling#fill-pdf-forms-through-the-user-interface) +3. [Import the Form data](./form-filling#fill-pdf-forms-through-import-data) + + +## Supported form field types + +- [Textbox](../forms/manage-form-fields/add-form-fields#add-textbox) +- [Password](../forms/manage-form-fields/add-form-fields#add-password) +- [CheckBox](../forms/manage-form-fields/add-form-fields#add-checkbox) +- [RadioButton](../forms/manage-form-fields/add-form-fields#add-radiobutton) +- [ListBox](../forms/manage-form-fields/add-form-fields#add-listbox) +- [ComboBox](../forms/manage-form-fields/add-form-fields#add-combobox) +- [Signature field](../forms/manage-form-fields/add-form-fields#add-signature-field)