Add TextStamp inside PDF document using Aspose.PDF for .NET

I found a bug:
Based on 2008 and Pdf.dll v20.7, the dll will output messed result after text added to the pdf.
Please refer to the attachment and fix it. (288.2 KB)


The archive that you have shared is corrupted or damaged. We could not extract files from it. You may please share sample code snippet with your post and attach sample PDF with it so that we can further proceed accordingly.

Imports Aspose.Pdf.Text
Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim Pos = InStrRev(System.Windows.Forms.Application.ExecutablePath, "\")
    Dim AppPath = Microsoft.VisualBasic.Left(System.Windows.Forms.Application.ExecutablePath, Pos - 1)
    Dim Pdf2 As Aspose.Pdf.Document = New Aspose.Pdf.Document()
    Dim TextStamp As Aspose.Pdf.TextStamp = New Aspose.Pdf.TextStamp("客户名称+版式+数量")
    Pdf2.Pages(1).SetPageSize(585, 841)
    TextStamp.Background = False
    TextStamp.TextState.FontSize = 40.0F
    TextStamp.TextState.FontStyle = FontStyles.Bold
    On Error Resume Next
    TextStamp.TextState.Font = FontRepository.FindFont("微软雅黑")
    TextStamp.TextState.ForegroundColor = Aspose.Pdf.Color.Red
    TextStamp.YIndent = Pdf2.PageInfo.Height - 40
    TextStamp.XIndent = (Pdf2.PageInfo.Width - 40 * "客户名称+版式+数量".Length) / 2
    Pdf2.Save(AppPath & "\Array.pdf")
End Sub


We used your code snippet except the line (TextStamp.TextState.Font = FontRepository.FindFont(“微软雅黑”)) and were able to achieve attached output PDF with Aspose.PDF for .NET 20.9. Array.pdf (124.6 KB)

Could you please download the attached PDF and highlight the issues in it for our better understanding. We will further proceed to assist you accordingly.

Your attached Output Pdf is what I expect, that’s ok. What happen on V20.7? Why?
Could you please attach the link url for downloading the V20.9? It’s very very hard to download them.

I try the Pdf.dll v20.10 (trial version) to do it, it still output messed-up pdf,why?
Would you please provide me a copy of licensed pdf.dll for me testing? It has taken me much time to test them and found and report many bugs for you improving the products.

111.png (21.6 KB)


Please make sure to use the API with a valid license.

We are afraid that we cannot provide you licensed version of the API because there is not any. You are supposed to apply license using a license file in the code. You can surely evaluate the API without any restrictions by using a 30-days free temporary license.