VintaSoft Imaging .NET SDK 15.1: Documentation for .NET developer
Vintasoft.Imaging.Pdf.Tree.InteractiveForms Namespace / PdfDocumentInteractiveForm Class / RemoveField Methods / RemoveField(String) Method
Syntax Example Requirements SeeAlso
In This Topic
RemoveField(String) Method (PdfDocumentInteractiveForm)
In This Topic
Removes the field and all it subfields from interactive form, also removes all widget annotations of removed subtree from annotations of PDF pages.
Syntax
'Declaration

Public Overloads Function RemoveField( _
ByVal fullyQualifiedFieldName
The fully qualified field name.
As System.String _
) As Boolean
public bool RemoveField(
System.String fullyQualifiedFieldName
)

Parameters

fullyQualifiedFieldName
The fully qualified field name.

Return Value

True if field was found and deleted; otherwise, false.
Example

Here is an example that shows how to remove a field from the PDF interactive form:


''' <summary>
''' Removes an interactive field from interactive form of PDF document.
''' </summary>
''' <param name="pdfFilename">The filename of PDF document.</param>
''' <param name="fullyQualifiedFieldName">The name of field.</param>
Public Shared Sub RemoveFieldFromPdfInteractiveForm(pdfFilename As String, fullyQualifiedFieldName 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

            ' remove field from interactive form
            form.RemoveField(fullyQualifiedFieldName)

            ' save changes to a file
            document.SaveChanges()
        End If
    End Using
End Sub


/// <summary>
/// Removes an interactive field from interactive form of PDF document.
/// </summary>
/// <param name="pdfFilename">The filename of PDF document.</param>
/// <param name="fullyQualifiedFieldName">The name of field.</param>
public static void RemoveFieldFromPdfInteractiveForm(string pdfFilename, string fullyQualifiedFieldName)
{
    // 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;

            // remove field from interactive form
            form.RemoveField(fullyQualifiedFieldName);

            // save changes to a file
            document.SaveChanges();
        }
    }
}

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