VintaSoft Imaging .NET SDK 15.1: Документация для .NET разработчика
В этом разделе
PDF: Извлечение значений полей из интерактивной PDF формы
В этом разделе
Вот C#/VB.NET код, который демонстрирует, как извлечь значения полей из интерактивной PDF формы:
/// <summary>
/// Prints information about interactive form of PDF document.
/// </summary>
/// <param name="pdfFilename">The filename of PDF document.</param>
public static void ExtractFieldValuesFromPdfInteractiveForm(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();

            // for each PDF interactive field
            foreach (Vintasoft.Imaging.Pdf.Tree.InteractiveForms.PdfInteractiveFormField field in formFields)
            {
                // output field name and field value
                System.Console.WriteLine("Name={0}, Value={1}", field.FullyQualifiedName, field.FieldValue);
            }
        }
    }
}
''' <summary>
''' Prints information about interactive form of PDF document.
''' </summary>
''' <param name="pdfFilename">The filename of PDF document.</param>
Public Shared Sub ExtractFieldValuesFromPdfInteractiveForm(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()

            ' for each PDF interactive field
            For Each field As Vintasoft.Imaging.Pdf.Tree.InteractiveForms.PdfInteractiveFormField In formFields
                ' output field name and field value
                System.Console.WriteLine("Name={0}, Value={1}", field.FullyQualifiedName, field.FieldValue)
            Next
        End If
    End Using
End Sub