VintaSoft Imaging .NET SDK 15.1: Documentation for .NET developer
Vintasoft.Imaging.Pdf.Tree.InteractiveForms Namespace / PdfInteractiveFormField Class / Remove() Method
Syntax Example Requirements SeeAlso
In This Topic
Remove() Method (PdfInteractiveFormField)
In This Topic
Deletes the field and all children from interactive form tree, also removes all widget annotations of deleted subtree from annotations of PDF pages.
Syntax
'Declaration

Public Function Remove() As Boolean

public bool Remove()

Return Value

True if interactive form field is removed; otherwise, false.
Example

Here is an example that shows how to remove a signature from PDF document:


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

            ' get all signature fields of PDF document
            Dim signatureFields As Vintasoft.Imaging.Pdf.Tree.InteractiveForms.PdfInteractiveFormSignatureField() = form.GetSignatureFields()

            ' for each signature fields
            For Each field As Vintasoft.Imaging.Pdf.Tree.InteractiveForms.PdfInteractiveFormField In signatureFields
                ' remove signature field
                field.Remove()
            Next

            ' pack PDF document
            document.Pack()
        End If
    End Using
End Sub


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

            // get all signature fields of PDF document
            Vintasoft.Imaging.Pdf.Tree.InteractiveForms.PdfInteractiveFormSignatureField[] signatureFields =
                form.GetSignatureFields();

            // for each signature fields
            foreach (Vintasoft.Imaging.Pdf.Tree.InteractiveForms.PdfInteractiveFormField field in signatureFields)
            {
                // remove signature field
                field.Remove();
            }

            // pack PDF document
            document.Pack();
        }
    }
}

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