We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

PDF Stamp

We have started receiving documents uploaded via our web site that will not stamp. We are using Aspose.PDF version 17.3. I have attached the document that does not stamp. Here is the code:

Friend Sub TimeStamp(ByRef sInFile As String, ByVal sOutFile As String)
Dim dFilingDate As Date

dFilingDate = Now
Dim PDFlicense As Aspose.Pdf.License = New Aspose.Pdf.License
Dim pdfDocument As New Aspose.Pdf.Document(sInFile)
Dim textStamp As TextStamp

textStamp = New TextStamp("Filed " & MonthName(dFilingDate.Month, True) & " " & dFilingDate.Date.Day.ToString & “, " & dFilingDate.Date.Year.ToString & " " & dFilingDate.ToShortTimeString & " Office of Administrative Hearings”)
textStamp.Background = True
textStamp.XIndent = 200
textStamp.YIndent = 775
textStamp.TextState.FontSize = 8.0F
textStamp.TextState.FontStyle = FontStyle.CourierBold
textStamp.TextState.ForegroundColor = Aspose.Pdf.Color.Blue
End Sub

Hi Russ,

Thanks for contacting support.

I have tested the scenario by using the code snippet which you have shared and noticed that you were setting TextStamp.Background property as true. Please note that setting this property as true means TextStamp will be added in background of the page and will not be shown.

Furthermore, the problem was also related to setting XIndent and YIndent. The value of YIndent was out of range of the document size. When I modified the value of YIndent, the TextStamp showed up. Please check the following code snippet in which I have highlighted the modified lines to get the correct output.

dFilingDate As System.DateTime =

Dim pdfDocument As New Aspose.Pdf.Document(dataDir + "NoStamp.pdf")

Dim textStamp As New TextStamp("Filed " + dFilingDate.Month.ToString() + " " + dFilingDate.[Date].Day.ToString() + ", " + dFilingDate.[Date].Year.ToString() + " " + dFilingDate.ToShortTimeString() + " Office of Administrative Hearings")

textStamp.Background = False

textStamp.XIndent = 200

textStamp.YIndent = 300

textStamp.TextState.FontSize = 8F

textStamp.TextState.FontStyle = Aspose.Pdf.Text.FontStyles.Bold

textStamp.TextState.ForegroundColor = Aspose.Pdf.Color.Blue


pdfDocument.Save(dataDir + "Stamped.pdf")

I have also attached an output file for your reference. In case if you still face any issue, please feel free to contact us.

Best Regards,