Class PdfLoadedFormFieldCollection
- Namespace
- Syncfusion.Pdf.Parsing
- Assembly
- Syncfusion.Pdf.Portable.dll
Represents field collection of loaded form.
public class PdfLoadedFormFieldCollection : PdfFieldCollection, IEnumerable
- Inheritance
-
PdfLoadedFormFieldCollection
- Implements
- Inherited Members
Examples
//Load an existing document
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// PDF loaded field collection
PdfLoadedFormFieldCollection fieldCollection = doc.Form.Fields;
// Remove the first field
fieldCollection.RemoveAt(0);
doc.Save("Form.pdf");
doc.Close(true);
'Load an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' PDF loaded field collection
Dim fieldCollection As PdfLoadedFormFieldCollection = doc.Form.Fields
' Remove the first field
fieldCollection.RemoveAt(0)
doc.Save("Form.pdf")
doc.Close(True)
Constructors
PdfLoadedFormFieldCollection()
Initialize the new instance of the PdfLoadedFormFieldCollection class.
public PdfLoadedFormFieldCollection()
- See Also
PdfLoadedFormFieldCollection(PdfLoadedForm)
Initializes a new instance of the PdfLoadedFormFieldCollection class with the specific PdfLoadedForm.
public PdfLoadedFormFieldCollection(PdfLoadedForm form)
Parameters
form
PdfLoadedFormThe PDF loaded form.
Examples
//Load an existing document
PdfLoadedDocument doc = new PdfLoadedDocument("Form.pdf");
//Load the existing PDF form.
PdfLoadedForm form = doc.Form;
//Create a new form fields collection instance.
PdfLoadedFormFieldCollection collection = new PdfLoadedFormFieldCollection(form);
//Remove field.
collection.RemoveAt(0);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Load an existing document
Dim doc As New PdfLoadedDocument("Form.pdf")
'Load the existing PDF form.
Dim form As PdfLoadedForm = doc.Form
'Create a new form fields collection instance.
Dim collection As New PdfLoadedFormFieldCollection(form)
'Remove field.
collection.RemoveAt(0)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)
- See Also
Properties
Form
Gets or sets the form.
public PdfLoadedForm Form { get; set; }
Property Value
Examples
// Loads an existing PDF document
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Load the FirstTextBox field
PdfField field = doc.Form.Fields["FirstTextBox"];
field.Flatten = true;
doc.Save("Form.pdf");
doc.Close(true);
// Loads an existing PDF document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Load the FirstTextBox field
Dim field As PdfField = doc.Form.Fields("FirstTextBox")
field.Flatten = True
doc.Save("Form.pdf")
doc.Close(True)
- See Also
this[int]
Gets the PdfField at the specified index.[Read-Only]
public override PdfField this[int index] { get; }
Parameters
index
int
Property Value
Examples
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
//load the form fields
foreach (PdfField field in doc.Form.Fields)
{
// Flatten the form
field.Flatten = true;
}
doc.Save("Form.pdf");
doc.Close(true);
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
'load the form fields
For Each field As PdfField In doc.Form.Fields
' Flatten the form
field.Flatten = True
Next field
doc.Save("Form.pdf")
doc.Close(True)
- See Also
this[string]
Returns field with specified name.[Read-Only]
public PdfField this[string name] { get; }
Parameters
name
stringThe specified field name.
Property Value
Examples
// Loads an existing PDF document
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Load the FirstTextBox field
PdfField field = doc.Form.Fields["FirstTextBox"];
field.Flatten = true;
doc.Save("Form.pdf");
doc.Close(true);
// Loads an existing PDF document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Load the FirstTextBox field
Dim field As PdfField = doc.Form.Fields("FirstTextBox")
field.Flatten = True
doc.Save("Form.pdf")
doc.Close(True)
- See Also
Methods
DoAdd(PdfField)
Adds a field to collection.
protected override int DoAdd(PdfField field)
Parameters
field
PdfFieldThe field.
Returns
- See Also
DoClear()
Clears the collection.
protected override void DoClear()
- See Also
DoInsert(int, PdfField)
Inserts a filed into collection.
protected override void DoInsert(int index, PdfField field)
Parameters
- See Also
DoRemove(PdfField)
Removes the field from collection.
protected override void DoRemove(PdfField field)
Parameters
field
PdfFieldThe field.
- See Also
DoRemoveAt(int)
Removes the field at the specified position.
protected override void DoRemoveAt(int index)
Parameters
index
intThe index.
- See Also
TryGetField(string, out PdfLoadedField)
Gets the form field with the given field name
public bool TryGetField(string fieldName, out PdfLoadedField field)
Parameters
fieldName
stringName of the field
field
PdfLoadedFieldLoaded Form Field
Returns
- bool
True, if form field exists, else False.
Examples
//Load an existing document
PdfLoadedDocument doc = new PdfLoadedDocument("Form.pdf");
//Load the existing PDF form.
PdfLoadedFormFieldCollection fields = doc.Form.Fields;
PdfLoadedField field = null;
//Get the specific field by name.
fields.TryGetField("fn", out field);
//Set text.
(field as PdfLoadedTextBoxField).Text = "Modified";
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Load an existing document
Dim doc As New PdfLoadedDocument("Form.pdf")
'Load the existing PDF form.
Dim fields As PdfLoadedFormFieldCollection = doc.Form.Fields
Dim field As PdfLoadedField = Nothing
'Get the specific field by name.
fields.TryGetField("fn", field)
'Set text.
TryCast(field, PdfLoadedTextBoxField).Text = "Modified"
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)
- See Also
TryGetValue(string, out string)
Gets the filed value from the given field name
public bool TryGetValue(string fieldName, out string fieldValue)
Parameters
Returns
- bool
True, if form field exists with the specific name, else False.
Examples
//Load an existing document
PdfLoadedDocument doc = new PdfLoadedDocument("Form.pdf");
//Load the existing PDF form.
PdfLoadedFormFieldCollection fields = doc.Form.Fields;
string fieldValue = null;
//Get the specific field value by name.
fields.TryGetValue("fn", out fieldValue);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Load an existing document
Dim doc As New PdfLoadedDocument("Form.pdf")
'Load the existing PDF form.
Dim fields As PdfLoadedFormFieldCollection = doc.Form.Fields
Dim fieldValue As String = Nothing
'Get the specific field value by name.
fields.TryGetValue("fn", fieldValue)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)
- See Also
ValidateSignatures(PdfSignatureValidationOptions, out List<PdfSignatureValidationResult>)
Validate all signatures and specifies the signatures's validation result with validation option
public bool ValidateSignatures(PdfSignatureValidationOptions options, out List<PdfSignatureValidationResult> results)
Parameters
options
PdfSignatureValidationOptionsresults
List<PdfSignatureValidationResult>
Returns
Examples
// Loads an existing document
PdfLoadedDocument document = new PdfLoadedDocument(fileName);
// Signature validation options
PdfSignatureValidationOptions options = new PdfSignatureValidationOptions();
// disable revocation status
options.ValidateRevocationStatus = false;
// Validate all signatures and get validation result
List<PdfSignatureValidationResult> results = new List<PdfSignatureValidationResult>();
bool isValid = document.Form.Fields.ValidateSignatures(options, out results);
// Close the document
document.Close(true);
' Loads an existing document
Dim document As PdfLoadedDocument = New PdfLoadedDocument(fileName)
' Signature validation options
Dim options As PdfSignatureValidationOptions = New PdfSignatureValidationOptions()
' disable revocation status
options.ValidateRevocationStatus = False
' Validate all signatures and get validation result
Dim results As New List(Of PdfSignatureValidationResult)()
Dim isValid As Boolean = document.Form.Fields.ValidateSignatures(options, out results)
' Close the document
document.Close(true)
- See Also
ValidateSignatures(out List<PdfSignatureValidationResult>)
Validate all signatures and specifies the signatures's validation result.
public bool ValidateSignatures(out List<PdfSignatureValidationResult> results)
Parameters
results
List<PdfSignatureValidationResult>
Returns
Examples
// Loads an existing document
PdfLoadedDocument document = new PdfLoadedDocument(fileName);
// Validate all signatures and get validation result
List<PdfSignatureValidationResult> results = new List<PdfSignatureValidationResult>();
bool isValid = document.Form.Fields.ValidateSignatures(out results);
// Close the document
document.Close(true);
' Loads an existing document
Dim document As PdfLoadedDocument = New PdfLoadedDocument(fileName)
' Validate all signatures and get validation result
Dim results As New List(Of PdfSignatureValidationResult)()
Dim isValid As Boolean = document.Form.Fields.ValidateSignatures(out results)
' Close the document
document.Close(true)
- See Also
ValidateSignatures(X509Certificate2Collection, PdfSignatureValidationOptions, out List<PdfSignatureValidationResult>)
Validate all signatures and specifies the signatures's validation result with X509Certificate collection with validation option
public bool ValidateSignatures(X509Certificate2Collection rootCertificates, PdfSignatureValidationOptions options, out List<PdfSignatureValidationResult> results)
Parameters
rootCertificates
X509Certificate2Collectionoptions
PdfSignatureValidationOptionsresults
List<PdfSignatureValidationResult>
Returns
Examples
// Loads an existing document
PdfLoadedDocument document = new PdfLoadedDocument(fileName);
// Validate all signatures and get validation result
List<PdfSignatureValidationResult> results = new List<PdfSignatureValidationResult>();
// Collection of X509Certificate
X509CertificateCollection certificates = new X509CertificateCollection();
certificates.Add(X509Certificate.CreateFromCertFile("certificate1.cer"));
certificates.Add(X509Certificate.CreateFromCertFile("certificate2.cer"))
// Signature validation options
PdfSignatureValidationOptions options = new PdfSignatureValidationOptions();
// disable revocation status
options.ValidateRevocationStatus = false;
bool isValid = document.Form.Fields.ValidateSignatures(certificates, options, out results);
// Close the document
document.Close(true);
' Loads an existing document
Dim document As PdfLoadedDocument = New PdfLoadedDocument(fileName)
' Validate all signatures and get validation result
Dim results As New List(Of PdfSignatureValidationResult)()
Dim certificates As X509CertificateCollection = New X509CertificateCollection()
certificates.Add(X509Certificate.CreateFromCertFile("certificate1.cer"))
certificates.Add(X509Certificate.CreateFromCertFile("certificate2.cer"))
' Signature validation options
Dim options As PdfSignatureValidationOptions = New PdfSignatureValidationOptions()
' disable revocation status
options.ValidateRevocationStatus = False
Dim isValid As Boolean = document.Form.Fields.ValidateSignatures(certificates, options, out results)
' Close the document
document.Close(true)
- See Also
ValidateSignatures(X509Certificate2Collection, out List<PdfSignatureValidationResult>)
Validate all signatures and specifies the signatures's validation result with X509Certificate collection.
public bool ValidateSignatures(X509Certificate2Collection rootCertificates, out List<PdfSignatureValidationResult> results)
Parameters
rootCertificates
X509Certificate2Collectionresults
List<PdfSignatureValidationResult>
Returns
Examples
// Loads an existing document
PdfLoadedDocument document = new PdfLoadedDocument(fileName);
// Validate all signatures and get validation result
List<PdfSignatureValidationResult> results = new List<PdfSignatureValidationResult>();
// Collection of X509Certificate
X509CertificateCollection certificates = new X509CertificateCollection();
certificates.Add(X509Certificate.CreateFromCertFile("certificate1.cer"));
certificates.Add(X509Certificate.CreateFromCertFile("certificate2.cer"))
bool isValid = document.Form.Fields.ValidateSignatures(certificates, out results);
// Close the document
document.Close(true);
' Loads an existing document
Dim document As PdfLoadedDocument = New PdfLoadedDocument(fileName)
' Validate all signatures and get validation result
Dim results As New List(Of PdfSignatureValidationResult)()
Dim certificates As X509CertificateCollection = New X509CertificateCollection()
certificates.Add(X509Certificate.CreateFromCertFile("certificate1.cer"))
certificates.Add(X509Certificate.CreateFromCertFile("certificate2.cer"))
Dim isValid As Boolean = document.Form.Fields.ValidateSignatures(certificates, out results)
' Close the document
document.Close(true)
- See Also