Inserimento di un campo (acrofield) in un file PDF

 

' Il seguente frammento di codice mostra come si può inserire un acrofield in un file PDF
' vedere https://help.syncfusion.com/file-formats/pdf/working-with-forms

 'Load the existing PDF document.
 Dim filename As String="<mettere qui il percorso del file da modificare>"

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

'Create the form if the form does not exist in the loaded document
If loadedDocument.Form Is Nothing Then
   loadedDocument.CreateForm()
End If

'Load the page
Dim loadedPage As Syncfusion.Pdf.PdfLoadedPage = TryCast(loadedDocument.Pages(0), Syncfusion.Pdf.PdfLoadedPage)

'Create a text box field and add the properties.
Dim textBoxField As New Syncfusion.Pdf.Interactive.PdfTextBoxField(loadedPage, "Nome")
textBoxField.Bounds = New RectangleF(0, 0, 100, 20) ' I primi due parametri sono le coordinate X e Y all'interno della pagina, che partono dall'angolo in basso a sinistra, il terzo è la larghezza e il quarto è l'altezza
textBoxField.ToolTip = "Cognome e nome"

'Add the form field to the existing PDF document.
loadedDocument.Form.Fields.Add(textBoxField)

'Save the document.
Dim filename2="<mettere qui il percorso del file modificato&gt;"
loadedDocument.Save(filename2)

'close the document
loadedDocument.Close(True)