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

Free Support Forum - aspose.com

ReplaceText returning error: Illegal characters in path

Having problems getting ReplaceText to work using C# .NET and a licensed version of PDF.Kit

I get the following error on the line:

editor.ReplaceText("test", "text");

Here is the sample code:

private void button2_Click(object sender, EventArgs e)


Aspose.Pdf.Kit.License lic = new Aspose.Pdf.Kit.License();


        </p><p>Aspose.Pdf.Kit.PdfContentEditor editor = new Aspose.Pdf.Kit.PdfContentEditor();
        </p><p>editor.ReplaceText("test", "text");

Hi Shawn,

Please share the input PDF file with us as well, so we could make sure that we’re working with your particular scenario. You’ll be updated with the results after investigation.

We’re sorry for the inconvenience.

The PDF is confidential and I cannot share it publicly, can I send it to you directly over email? What is your address.


Hi Shawn,

You may use ‘Contact -> Send shahzad.latif an email’ option at the top of this post to send the PDF file.

I hope this helps.

ok i just sent you the pdf. let me know if you can re-produce the issue.


Hi Shawn,

I have received the sample PDF file. We’ll investigate the issue at our end and update you with the results shortly.


Hi Shahzad any luck re-producing this error on your end? Let me know.


Hi Shawn,

I have tested this issue at my end and noticed that the problem occurs only when I use the following line of code:


However, if I modify this as shown below (adding @ sign at the start of the path), the ReplaceText method works fine:


Please try the above change at your end as well. Also, please make sure that you’re using the latest version of the component at your end.

I hope this helps. If you have any further questions, please do let us know.

Wooo Hooo! That works… Thanks for the help on this.