VintaSoft Imaging .NET SDK 14.0: Документация для .NET разработчика
Vintasoft.Imaging.Pdf Namespace / PdfDocument Class / InteractiveForm Property
Синтаксис Exceptions Example Требования Смотрите также
В этом разделе
    InteractiveForm Свойство (PdfDocument)
    В этом разделе
    Возвращает или задает информацию о содержимом и свойствах интерактивной формы документа.
    Синтаксис
    Исключения
    ИсключениеОписание
    Выбрасывается, если пользователь пытается установить значение NOT null, когда для свойства уже установлено значение NOT null.
    Пример

    Вот пример, показывающий, как отобразить информацию обо всех полях PDF формы документа:

    
    ''' <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
    */
    
    

    Требования

    Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    Смотрите также