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();

lic.SetLicense("Aspose.Pdf.Kit.lic");

        </p><p>Aspose.Pdf.Kit.PdfContentEditor editor = new Aspose.Pdf.Kit.PdfContentEditor();
        editor.BindPdf("c:\temp\test.pdf");
        </p><p>editor.ReplaceText("test", "text");
        </p><p>editor.Save("c:\temp\replace.pdf");
    </p><p>}

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.
Regards,

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

Thanks!

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.
Regards,

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

thanks!

Hi Shawn,

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

Regards,

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

Thanks!

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:

editor.BindPdf(“c:\tempfiles\test.pdf”);

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

editor.BindPdf(@"c:\tempfiles\test.pdf");

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.
Regards,

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