We use PDF.Kit to stamp PDF documents uploaded to our site. Attempting to stamp the attached file throws a "Specified cast is not valid." exception. The Code is as follows:
Public Sub AppendTimeStamp(ByVal sOutPutFile As String, ByVal sDateFiled As String)
Dim license As Aspose.Pdf.Kit.License = New Aspose.Pdf.Kit.License
license.SetLicense("Aspose.Pdf.Kit.Lic")
Dim sOutFile As String = System.IO.Path.Combine(ConfigurationSettings.AppSettings("TempFiles"), sOutPutFile & "_Stamped.pdf")
Dim sInFile As String = System.IO.Path.Combine(ConfigurationSettings.AppSettings("TempFiles"), sOutPutFile & "_PreStamped.pdf")
Dim Stamper As PdfFileStamp, FileStamp As Stamp = New Stamp
Dim sFiledText As FormattedText
sFiledText = New FormattedText("Filed " & sDateFiled & " ET Office of the Judges of Compensation Claims.", _New FontColor(0, 0, 200), FontStyle.HelveticaBoldOblique, EncodingType.Winansi, True, 10)
Stamper = New PdfFileStamp(sInFile, sOutFile)
FileStamp.BindLogo(sFiledText)
FileStamp.IsBackground = False
FileStamp.Pages = New Integer() {1}
FileStamp.SetOrigin(75, 10)
Stamper.AddStamp(FileStamp)
Stamper.Close()
End Sub
Where sOutPutFile = 0999999_07003432_354_10292008_10321868_e
and sDateFiled = 10/29/2008 at 10:32:18 AM.
The error occurs on the line Stamper.Close()
Thanks in Advance
Russ