RemoveField(String) Метод (PdfDocumentInteractiveForm)
В этом разделе
Удаляет поле и все его подполя из интерактивной формы, а также удаляет все аннотации виджетов удаленного поддерева из аннотаций PDF страниц.
Синтаксис
'Declaration
Public Overloads Function RemoveField( _
ByVal As System.String _
) As Boolean
public bool RemoveField(
System.String
)
public: bool RemoveField(
System.String
)
public:
bool RemoveField(
System.String
)
Parameters
- fullyQualifiedFieldName
- Полное имя поля.
Return Value
True, если поле было найдено и удалено; в противном случае, false.
Пример
Вот пример, показывающий, как удалить поле из интерактивной PDF формы:
''' <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();
}
}
}
Требования
Целевые платформы: .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5
Смотрите также