I am trying the library Spire.PDF Free in vb.NET.
I am trying to write each fields in the attached PDF. I know it's a XFA Form and that it is mostly not supported any more but I have little choice because it comes from "high instance".
For testing, here is that I try to do : I basically try to write the name of each field in the value of the field if it's a XfaTextField or a "1" if it's a XfaIntField. I also print the name and type of the field in console.
- Code: Select all
Private Shared Sub TestWritePDF(source as String)
Using pdf As New Spire.Pdf.PdfDocument(source)
Dim theForm = DirectCast(pdf.Form, Spire.Pdf.Widget.PdfFormWidget).XFAForm
WriteNameInAllFields(theForm)
pdf.SaveToFile(dest)
pdf.Close()
End Using
End Sub
Private Shared Sub WriteNameInAllFields(theForm As Spire.Pdf.Widget.XFAForm)
For Each name As String In theForm.Fields
Console.WriteLine($"Name: '{name}', type: '{theForm.getField(name).GetType.ToString}'")
If TypeOf theForm.getField(name) Is Widget.XfaTextField Then
DirectCast(theForm.getField(name), Widget.XfaTextField).Value = name
ElseIf TypeOf theForm.getField(name) Is Widget.XfaIntField Then
DirectCast(theForm.getField(name), Widget.XfaIntField).Value = 1
End If
Next
End Sub
But there is nothing written on the second page. I have no idea why? I this a limitation of the free version? Or if not what is the problem?
Thanks.
Best regards.