Free Support Forum -

Using Stamp.BindText function with Thai text does not bind the value


We have purchased the PDF Kit for .Net and we wanted to use Thai text to be embeded on the PDF using the Stamp.BindText method.

The Methods executes successfully but the Thai text is not printed, instead its just blank.

I have already investigated teh Language support for PDF kit and it says teh UNICODE characters are supported.

Also for the EncodingType enum, I ave tried using all the types available, but except for Winansi all other types give me error.

Hoping for some help on this.

Hi Thitisak,

First off, please try to use the latest version of the merged component. We have merged Aspose.Pdf.Kit for .NET into Aspose.Pdf for .NET. You can use Aspose.Pdf.Facades namespace to execute your existing code. Please see more details in this blog post.

Secondly, if you find the same issue with the latest version as well then please share the input PDF file along with the code snippet and the text you’re trying to add. Moreover, please share which .NET Framework version you’re using at your end. We’ll investigate the issue and guide you accordingly.

We’re sorry for the inconvenience.

Hello Shahzad,

Thank you for our reply. I will try your suggestions first. For your information we are using .Net 3.0 for development.

Hello Shahzad,

I have tried the new Aspose.PDF.dll and the namespace you suggested. But now I can see some garbled text but not the desired Thai text.

I have tried to use all possible combinatino of teh TextFormat class but none worked. Please find below a sample of our code that we use, to Stamp text on PDF.

if (FileUpload1.HasFile)
string fileName = FileUpload1.PostedFile.FileName;

fStmp = new PdfFileStamp(fileName, fileName.Substring(0, fileName.LastIndexOf(".")) + "_output.pdf");
stmp = new Stamp();
stmp.PageNumber = 1;
stmp.Pages = new int[] { 1 };
stmp.SetOrigin(200, 300);
Color textColor = Color.Red;
text = new FormattedText("hello1 โรงแรมติดอันดับแย่ที่เชียงใหม่", textColor, Aspose.Pdf.Facades.FontStyle.TimesRoman, EncodingType.Cp1257, true, 9);


When I open the Output file, then I get an error "Illegal operation 'q' inside a text object".

Let me know if you need any more information.

Also I would like to ask that we have purchased a License fro Aspose.PDF.kit .Net and your suggestion is to use Aspose PDF for .Net des this mean that we can use the same license to register PDF for .net rather than PDF.Kit for .Net.

Thank you for your reply in advance

Hi Thitisak,

Thanks for using our products.

In order to display Thai text inside the PDF document, you must use the font name which supports Unicode characters. Arial Unicode MS is the font which supports Unicode characters and has the capability to render Thai text properly. I have tested the scenario where I have tried placing the Thai text that you have shared as a watermark inside PDF document while using new DOM API approach while using TextStamp class and the text is properly being displayed inside the PDF. Please take a look over the attached PDF document that I have generated using Aspose.Pdf for .NET 6.3.0. For more information, please visit the following link
Adding Text Stamp in the PDF File


//open document
Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(“d:/pdftest/WatermarkExample.pdf”);
//create text stamp
TextStamp textStamp = new TextStamp(“hello1 โรงแรมติดอันดับแย่ที่เชียงใหม่”);
//set whether stamp is background
textStamp.Background = true;
//set origin
textStamp.XIndent = 100;
textStamp.YIndent = 300;
//set text properties
textStamp.TextState.Font = FontRepository.FindFont(“Arial Unicode MS”);
textStamp.TextState.FontSize = 14.0F;
textStamp.TextState.ForegroundColor = System.Drawing.Color.Red;
//add stamp to particular page

In case you encounter any issue, please feel free contact. We apologize for your inconvenience. Now adding more to Shahzad's comments, the new Aspose.Pdf for .NET supports the licenses that were previous purchased for Aspose.Pdf.Kit for .NET.