Replacing text gives weird results


I was trying out aspose.Pdf to advice my company to buy a license or not. However I ran into some problems with replacing text. The replaced version ends up with weird characters (question marks) in the file. I used the code given in the examples to replace ##Title## and ##Name##

Could anyone help me with this problem?
FYI: I’m using the 30 day trial

Hi Stijn,

Thanks for your interest in Aspose.

Please accept my apology for the delayed response. I’m afraid I’m unable to notice the reported issue, while testing the scenario with Aspose.Pdf for .NET 8.1.0. Can you please share your sample source code and document here? So we will test the scenario at our end and will provide you more information accordingly.

Best Regards,


The code I was using is:

public void RunTests(string path)
Document pdfDocument = new Document(path);
Replace("##Name##", “John Doe”, pdfDocument);
Replace("##Title##", "Test Title ", pdfDocument);

private void Replace(string find, string replaceWith, Document doc)
TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber(find);
TextFragmentCollection textFragmentCollection = textFragmentAbsorber.TextFragments;
foreach (TextFragment textFragment in textFragmentCollection)
textFragment.Text = replaceWith;

I’ve added the pdf in attachment

Hi Stijn,

Thanks for sharing the resource file.

I have tested the scenario using Aspose.Pdf for .NET 8.1.0 and as per my observations, the problem occurs when using product in trial mode. However when I have used the same code snippet in licensed mode, the resultant PDF is properly being generated. For your reference, I have also attached the resultant PDF which is generated over my end. We are sorry for this inconvenience.

PS, you may request a 30 days temporary license and test the product without any limitations. For further information, please visit Get a temporary license.