Xamarin.iOS

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PdfFormAction

    Show / Hide Table of Contents

    Class PdfFormAction

    Represents the action on form fields.

    Inheritance
    System.Object
    PdfAction
    PdfFormAction
    PdfResetAction
    PdfSubmitAction
    Inherited Members
    PdfAction.Initialize()
    PdfAction.Next
    Namespace: Syncfusion.Pdf.Interactive
    Assembly: Syncfusion.Pdf.Portable.dll
    Syntax
    public class PdfFormAction : PdfAction, IPdfWrapper
    Examples
    //Create a new PDF document.
    PdfDocument document = new PdfDocument();
    //Create a new page
    PdfPage page = document.Pages.Add();
    //Create font and font style.
    PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold);
    //Create a new PdfButtonField.
    PdfButtonField submitButton = new PdfButtonField(page, "submitButton");
    //Set the bounds
    submitButton.Bounds = new RectangleF(25, 160, 100, 20);
    //Set the submitButton Font.
    submitButton.Font = font;
    //Set the submit button text
    submitButton.Text = "Apply";
    //Set the submit button back color
    submitButton.BackColor = new PdfColor(181, 191, 203);
    //Create a new PdfFormAction.
    PdfFormAction formAction = new PdfFormAction();
    formAction.Include = true;
    //Set the submit button action.
    submitButton.Actions.GotFocus = formAction;
    //Add the submit button to the new document.
    document.Form.Fields.Add(submitButton);
    //Save and close the document
    document.Save("FormAction.pdf");
    document.Close(true);
    'Create a new PDF document.
    Dim document As New PdfDocument()
    'Create a new page
    Dim page As PdfPage = document.Pages.Add()
    'Create font and font style.
    Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12F, PdfFontStyle.Bold)
    'Create a new PdfButtonField.
    Dim submitButton As New PdfButtonField(page, "submitButton")
    'Set the bounds
    submitButton.Bounds = New RectangleF(25, 160, 100, 20)
    'Set the submitButton Font.
    submitButton.Font = font
    'Set the submit button text
    submitButton.Text = "Apply"
    'Set the submit button back color
    submitButton.BackColor = New PdfColor(181, 191, 203)
    'Create a new PdfFormAction.
    Dim formAction As New PdfFormAction()
    formAction.Include = True
    'Set the submit button action.
    submitButton.Actions.GotFocus = formAction
    'Add the submit button to the new document.
    document.Form.Fields.Add(submitButton)
    'Save and close the document
    document.Save("FormAction.pdf")
    document.Close(True)

    Constructors

    PdfFormAction()

    Initializes a new instance of the PdfFormAction class.

    Declaration
    public PdfFormAction()
    Examples
    //Create a new PDF document.
    PdfDocument document = new PdfDocument();
    //Create a new page
    PdfPage page = document.Pages.Add();
    //Create font and font style.
    PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold);
    //Create a new PdfButtonField.
    PdfButtonField submitButton = new PdfButtonField(page, "submitButton");
    //Set the bounds
    submitButton.Bounds = new RectangleF(25, 160, 100, 20);
    //Set the submitButton Font.
    submitButton.Font = font;
    //Set the submit button text
    submitButton.Text = "Apply";
    //Set the submit button back color
    submitButton.BackColor = new PdfColor(181, 191, 203);
    //Create a new PdfFormAction.
    PdfFormAction formAction = new PdfFormAction();
    formAction.Include = true;
    //Set the submit button action.
    submitButton.Actions.GotFocus = formAction;
    //Add the submit button to the new document.
    document.Form.Fields.Add(submitButton);
    //Save and close the document
    document.Save("FormAction.pdf");
    document.Close(true);
    'Create a new PDF document.
    Dim document As New PdfDocument()
    'Create a new page
    Dim page As PdfPage = document.Pages.Add()
    'Create font and font style.
    Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12F, PdfFontStyle.Bold)
    'Create a new PdfButtonField.
    Dim submitButton As New PdfButtonField(page, "submitButton")
    'Set the bounds
    submitButton.Bounds = New RectangleF(25, 160, 100, 20)
    'Set the submitButton Font.
    submitButton.Font = font
    'Set the submit button text
    submitButton.Text = "Apply"
    'Set the submit button back color
    submitButton.BackColor = New PdfColor(181, 191, 203)
    'Create a new PdfFormAction.
    Dim formAction As New PdfFormAction()
    formAction.Include = True
    'Set the submit button action.
    submitButton.Actions.GotFocus = formAction
    'Add the submit button to the new document.
    document.Form.Fields.Add(submitButton)
    'Save and close the document
    document.Save("FormAction.pdf")
    document.Close(True)

    Properties

    Fields

    Gets the fields.

    Declaration
    public PdfFieldCollection Fields { get; }
    Property Value
    Type Description
    PdfFieldCollection

    The fields.

    Examples
    //Create a new PDF document.
    PdfDocument document = new PdfDocument();
    //Creates a new page
    PdfPage page = document.Pages.Add();
    //Create a new PdfButtonField.
    PdfButtonField submitButton = new PdfButtonField(page, "submitButton");
    //Set the submitButton Bounds.
    submitButton.Bounds = new RectangleF(25, 160, 100, 20);
    //Create a new PdfFormAction.
    PdfFormAction formAction = new PdfFormAction();
    //Gets the FieldCollection from formAction
    PdfFieldCollection fields = formAction.Fields;
    //Set actions to submit button
    submitButton.Actions.GotFocus = formAction;
    //Add the submit button to the new document.
    document.Form.Fields.Add(submitButton);
    //Add the submit button to the new document.
    document.Form.Fields.Add(submitButton);
    //Save document
    document.Save("FormAction.pdf");
    document.Close(true);
    'Create a new PDF document.
    Dim document As New PdfDocument()
    'Creates a new page 
    Dim page As PdfPage = document.Pages.Add()
    'Create a new PdfButtonField.
    Dim submitButton As New PdfButtonField(page, "submitButton")
    'Set the submitButton Bounds.
    submitButton.Bounds = New RectangleF(25, 160, 100, 20)
    'Create a new PdfFormAction.
    Dim formAction As New PdfFormAction()
    'Gets the FieldCollection from formAction
    Dim fields As PdfFieldCollection = formAction.Fields
    'Set actions to submit button 
    submitButton.Actions.GotFocus = formAction
    'Add the submit button to the new document.
    document.Form.Fields.Add(submitButton)
    'Add the submit button to the new document.
    document.Form.Fields.Add(submitButton)
    'Save document 
    document.Save("FormAction.pdf")
    document.Close(True)

    Include

    Gets or sets a value indicating whether fields contained in Fields collection will be included for resetting or submitting.

    Declaration
    public virtual bool Include { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if include; otherwise, false.

    Remarks

    If Include property is true, only the fields in this collection will be reset or submitted. If Include property is false, the fields in this collection are not reset or submitted and only the remaining form fields are reset or submitted. If the collection is null or empty, then all the form fields are reset and the Include property is ignored.

    Examples
    //Create a new PDF document.
    PdfDocument document = new PdfDocument();
    //Create a new page
    PdfPage page = document.Pages.Add();
    //Create font and font style.
    PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold);
    //Create a new PdfButtonField.
    PdfButtonField submitButton = new PdfButtonField(page, "submitButton");
    //Set the bounds
    submitButton.Bounds = new RectangleF(25, 160, 100, 20);
    //Set the submitButton Font.
    submitButton.Font = font;
    //Set the submit button text
    submitButton.Text = "Apply";
    //Set the submit button back color
    submitButton.BackColor = new PdfColor(181, 191, 203);
    //Create a new PdfFormAction.
    PdfFormAction formAction = new PdfFormAction();
    formAction.Include = true;
    //Set the submit button action.
    submitButton.Actions.GotFocus = formAction;
    //Add the submit button to the new document.
    document.Form.Fields.Add(submitButton);
    //Save and close the document
    document.Save("FormAction.pdf");
    document.Close(true);
    'Create a new PDF document.
    Dim document As New PdfDocument()
    'Create a new page
    Dim page As PdfPage = document.Pages.Add()
    'Create font and font style.
    Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12F, PdfFontStyle.Bold)
    'Create a new PdfButtonField.
    Dim submitButton As New PdfButtonField(page, "submitButton")
    'Set the bounds
    submitButton.Bounds = New RectangleF(25, 160, 100, 20)
    'Set the submitButton Font.
    submitButton.Font = font
    'Set the submit button text
    submitButton.Text = "Apply"
    'Set the submit button back color
    submitButton.BackColor = New PdfColor(181, 191, 203)
    'Create a new PdfFormAction.
    Dim formAction As New PdfFormAction()
    formAction.Include = True
    'Set the submit button action.
    submitButton.Actions.GotFocus = formAction
    'Add the submit button to the new document.
    document.Form.Fields.Add(submitButton)
    'Save and close the document
    document.Save("FormAction.pdf")
    document.Close(True)

    See Also

    PdfAction
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved