Free Support Forum - aspose.com

Fields disappearing on form fill

I recently downloaded version 3.1.0.0 (I was previously using version 3.0.0.0) however I have been experiencing a most peculiar problem, some field on the output file are missing after the form fill. The field that is mising appears random as different field are missing at different time with the same data input. The code I am using is the same the only change was the upgrade to version 3.1.0.0. I have subsequently downgraded back to 3.0.0.0 and the issue as not occurred since.

I am attaching the output file as well as the original file for you perusal.

Regards, Ralph

Dear Ralph,

Thanks for considering Aspose.Pdf.Kit.

I am sorry that we cannot reproduce the problem occured in your attachment. Please upload your code generating the output file.

Thanks & Best regards.

Below is the code that I’m using. The main method is the GeneratePDF method which call FillFields as part of the process.

Protected Sub FillFields(ByVal pdfform As Aspose.Pdf.Kit.Form)
pdfform.FillField(“CompanyName”, Me.DataSource.CompanyName.ToUpper)
pdfform.FillField(“CompanyNumber”, Me.DataSource.CompanyNumber)
pdfform.FillField(“SignatorName”, Me.DataSource.Signator)
pdfform.FillField(“SignatorTitle”, Me.DataSource.SignatorTitle)
pdfform.FillField(“PrintDate”, Me.DataSource.PrintDate.ToString(“MMMM d, yyyy”))
If Me.DataSource.IssuedNoShares Then
pdfform.FillField(“NoShares”, “Yes”)
Else
pdfform.FillField(“NoShares”, “No”)
End If
If Me.DataSource.NoPropertyNoLiabiities Then
pdfform.FillField(“NoPropertyOrLiabilities”, “Yes”)
Else
pdfform.FillField(“NoPropertyOrLiabilities”, “No”)
End If
If Me.DataSource.VoluntaryDissolution Then
pdfform.FillField(“VoluntarilyDissolving”, “Yes”)
Else
pdfform.FillField(“VoluntarilyDissolving”, “No”)
End If
pdfform.FillField(“RecordsKeeperName”, Me.DataSource.RecordsKeeperName)
pdfform.FillField(“RecordsKeeperAddress”, Me.DataSource.RecordsKeeperAddress.ToString)
pdfform.FillField(“RecordsKeeperOccupation”, Me.DataSource.RecordsKeeperOccupation)
End Sub

Public Function GeneratePDF() As IO.MemoryStream
Dim outputstream As IO.MemoryStream = Nothing
Try
outputstream = New IO.MemoryStream
'Need to determine install directory
Dim installdir As String = DCBO.General.GetInstallDirectory()
Dim newpdffile As Aspose.Pdf.Kit.Form = New Aspose.Pdf.Kit.Form(installdir & Me.GetPDFFile, outputstream)

Log.Write(LogMode.Verbose, LogEntryLevel.Notification, LogEntryType.Notification, Me.GetLogDescription)
Me.FillFields(newpdffile)
newpdffile.FlattenAllFields()
newpdffile.Save()

newpdffile = Nothing
Catch ex As Exception
ICASS.ECS.Server.ExceptionHandler.HandleException(ex)
Finally
GeneratePDF = outputstream
End Try
End Function

Hope this helps.

Regards, Ralph

Dear Ralph,

Thanks for your uploading. Your output file must be generated by two steps: one is form filling, and the other maybe a PDF merging operation (because the output is a 2-page document, while the input file contained only one page). I tested the first step with your code, everything is ok except for the flattening. That would be fixed soon. But no field was missed.

Please help us reproduce the problem by providing more detail information, especially the merging process.

Thanks again.