VintaSoft Imaging .NET SDK 15.1: Documentation for .NET developer
Vintasoft.Imaging.Pdf Namespace / PdfDocument Class / InteractiveForm Property
Syntax Exceptions Example Requirements SeeAlso
In This Topic
InteractiveForm Property (PdfDocument)
In This Topic
Gets or sets information about contents and properties of a document interactive form.
Syntax
Exceptions
ExceptionDescription
Thrown if user tries to set NOT null value when property is already set to NOT null value.
Example

Here is an example that shows how to display the information about all form fields of PDF document:


''' <summary>
''' Prints information about interactive form of PDF document.
''' </summary>
''' <param name="pdfFilename">The filename of PDF document.</param>
Public Shared Sub PrintInformationAboutPdfInteractiveForm(pdfFilename As String)
    ' open PDF document
    Using document As New Vintasoft.Imaging.Pdf.PdfDocument(pdfFilename)
        ' if PDF document has interactive form
        If document.InteractiveForm IsNot Nothing Then
            ' get reference to the interactive form
            Dim form As Vintasoft.Imaging.Pdf.Tree.InteractiveForms.PdfDocumentInteractiveForm = document.InteractiveForm

            ' get an array that contains all interactive form fields of PDF document
            Dim formFields As Vintasoft.Imaging.Pdf.Tree.InteractiveForms.PdfInteractiveFormField() = form.GetTerminalFields()

            ' print information abount field count
            System.Console.WriteLine("Interactive Form Field Count: {0}", formFields.Length)

            ' for each interactive field
            For Each field As Vintasoft.Imaging.Pdf.Tree.InteractiveForms.PdfInteractiveFormField In formFields
                ' output information about interactive field
                System.Console.WriteLine(vbTab & "Name={0,-18} TypeName={1,-33} TextQuadding={2,-14} IsReadOnly={3,-5}", field.FullyQualifiedName, field.[GetType]().Name, field.TextQuadding, field.IsReadOnly)
            Next
        End If
    End Using
End Sub

' This code example produces the following output:
  Interactive Form Field Count: 13
      Name=TextField1         TypeName=PdfInteractiveFormTextField       TextQuadding=Centered       IsReadOnly=False
      Name=TextField2         TypeName=PdfInteractiveFormTextField       TextQuadding=LeftJustified  IsReadOnly=False
      Name=TextField3         TypeName=PdfInteractiveFormTextField       TextQuadding=LeftJustified  IsReadOnly=False
      Name=TextField4         TypeName=PdfInteractiveFormTextField       TextQuadding=LeftJustified  IsReadOnly=False
      Name=TextField5         TypeName=PdfInteractiveFormTextField       TextQuadding=LeftJustified  IsReadOnly=False
      Name=TextField6         TypeName=PdfInteractiveFormTextField       TextQuadding=LeftJustified  IsReadOnly=False
      Name=NumericField       TypeName=PdfInteractiveFormTextField       TextQuadding=LeftJustified  IsReadOnly=False
      Name=FileSelect         TypeName=PdfInteractiveFormTextField       TextQuadding=LeftJustified  IsReadOnly=False
      Name=browseButton       TypeName=PdfInteractiveFormPushButtonField TextQuadding=LeftJustified  IsReadOnly=False
      Name=Calculator.Left    TypeName=PdfInteractiveFormTextField       TextQuadding=Centered       IsReadOnly=False
      Name=Calculator.Right   TypeName=PdfInteractiveFormTextField       TextQuadding=Centered       IsReadOnly=False
      Name=Calculator.Result  TypeName=PdfInteractiveFormTextField       TextQuadding=Centered       IsReadOnly=True
      Name=ResetButton        TypeName=PdfInteractiveFormPushButtonField TextQuadding=LeftJustified  IsReadOnly=False
  



/// <summary>
/// Prints information about interactive form of PDF document.
/// </summary>
/// <param name="pdfFilename">The filename of PDF document.</param>
public static void PrintInformationAboutPdfInteractiveForm(string pdfFilename)
{
    // open PDF document
    using (Vintasoft.Imaging.Pdf.PdfDocument document =
        new Vintasoft.Imaging.Pdf.PdfDocument(pdfFilename))
    {
        // if PDF document has interactive form
        if (document.InteractiveForm != null)
        {
            // get reference to the interactive form
            Vintasoft.Imaging.Pdf.Tree.InteractiveForms.PdfDocumentInteractiveForm form = document.InteractiveForm;

            // get an array that contains all interactive form fields of PDF document
            Vintasoft.Imaging.Pdf.Tree.InteractiveForms.PdfInteractiveFormField[] formFields = form.GetTerminalFields();

            // print information abount field count
            System.Console.WriteLine("Interactive Form Field Count: {0}", formFields.Length);

            // for each interactive field
            foreach (Vintasoft.Imaging.Pdf.Tree.InteractiveForms.PdfInteractiveFormField field in formFields)
            {
                // output information about interactive field
                System.Console.WriteLine("\tName={0,-18} TypeName={1,-33} TextQuadding={2,-14} IsReadOnly={3,-5}",
                    field.FullyQualifiedName, field.GetType().Name, field.TextQuadding, field.IsReadOnly);
            }
        }
    }
}

/* This code example produces the following output:
Interactive Form Field Count: 13
    Name=TextField1         TypeName=PdfInteractiveFormTextField       TextQuadding=Centered       IsReadOnly=False
    Name=TextField2         TypeName=PdfInteractiveFormTextField       TextQuadding=LeftJustified  IsReadOnly=False
    Name=TextField3         TypeName=PdfInteractiveFormTextField       TextQuadding=LeftJustified  IsReadOnly=False
    Name=TextField4         TypeName=PdfInteractiveFormTextField       TextQuadding=LeftJustified  IsReadOnly=False
    Name=TextField5         TypeName=PdfInteractiveFormTextField       TextQuadding=LeftJustified  IsReadOnly=False
    Name=TextField6         TypeName=PdfInteractiveFormTextField       TextQuadding=LeftJustified  IsReadOnly=False
    Name=NumericField       TypeName=PdfInteractiveFormTextField       TextQuadding=LeftJustified  IsReadOnly=False
    Name=FileSelect         TypeName=PdfInteractiveFormTextField       TextQuadding=LeftJustified  IsReadOnly=False
    Name=browseButton       TypeName=PdfInteractiveFormPushButtonField TextQuadding=LeftJustified  IsReadOnly=False
    Name=Calculator.Left    TypeName=PdfInteractiveFormTextField       TextQuadding=Centered       IsReadOnly=False
    Name=Calculator.Right   TypeName=PdfInteractiveFormTextField       TextQuadding=Centered       IsReadOnly=False
    Name=Calculator.Result  TypeName=PdfInteractiveFormTextField       TextQuadding=Centered       IsReadOnly=True
    Name=ResetButton        TypeName=PdfInteractiveFormPushButtonField TextQuadding=LeftJustified  IsReadOnly=False
*/

Requirements

Target Platforms: .NET 10; .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

See Also