Lettura dei valori dei campi di un form PDF

' Il seguente snippet può essere utilizzato per leggere i valori dei campi testo e caselle contenuti in un form PDF
' Nell'esempio i valori vengono accodati in un oggetto chiamato "NOTE"
' Per ulteriori info vedere qui: https://help.syncfusion.com/file-formats/pdf/working-with-forms
form.findcontrol("NOTE").value=""

dim path as string=form.GetDocumentPath()

Dim loadedDocument As New Syncfusion.Pdf.Parsing.PdfLoadedDocument(path)

' Load the form from the loaded document
Dim frm As Syncfusion.Pdf.Parsing.PdfLoadedForm = loadedDocument.Form

' Load the form field collections from the form
Dim fieldCollection As Syncfusion.Pdf.Parsing.PdfLoadedFormFieldCollection = TryCast(frm.Fields, Syncfusion.Pdf.Parsing.PdfLoadedFormFieldCollection)

For i As Integer = 0 To fieldCollection.Count - 1

	If TypeOf fieldCollection(i) Is Syncfusion.Pdf.Parsing.PdfLoadedTextBoxField Then
	
		Dim loadedTextBoxField As Syncfusion.Pdf.Parsing.PdfLoadedTextBoxField = TryCast(fieldCollection(i), Syncfusion.Pdf.Parsing.PdfLoadedTextBoxField)
		
		form.findcontrol("NOTE").value+=loadedTextBoxField.name+"="+isnull(loadedTextBoxField.Text,"")+chr(13)
	Else
		if TypeOf fieldCollection(i) Is Syncfusion.Pdf.Parsing.PdfLoadedCheckBoxField
			Dim loadedCheckBoxField As Syncfusion.Pdf.Parsing.PdfLoadedCheckBoxField = TryCast(fieldCollection(i), Syncfusion.Pdf.Parsing.PdfLoadedCheckBoxField)
		
			form.findcontrol("NOTE").value+=loadedCheckBoxField.name+"="+loadedCheckBoxField.Checked.toString()+chr(13)
		Else
			if TypeOf fieldCollection(i) Is Syncfusion.Pdf.Parsing.PdfLoadedComboBoxField
				Dim loadedComboBoxField As Syncfusion.Pdf.Parsing.PdfLoadedComboBoxField = TryCast(fieldCollection(i), Syncfusion.Pdf.Parsing.PdfLoadedComboBoxField)
			
				form.findcontrol("NOTE").value+=loadedComboBoxField.name+"="+isnull(loadedComboBoxField.SelectedValue,"")+chr(13)	
			End If
		End If
	End If

Next i

loadedDocument.Close(True)