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

Free Support Forum - aspose.com

pdfContentEditor.ReplaceText() Index was outside the bounds of the array


I am getting Index was outside the bounds of the array error when I use pdfContentEditor.ReplaceText() function.

can someone guide me on this issue?


I have observed your comments and like to request you to share the source file with us because the issue is likely to be a file specific issue. Also share the narrowed down code snippet reproducing the issue, and environment details on your end so that we may investigate it further to help you out.

Before I give you information that you are asking, why does it say, ‘Index was outside the bounds…’?

Simple that I have

pdfContentEditor.ReplaceText("/s/", 0, destString, textpropertyItalic)


Normally, this error occurs when we try to retrieve array items more than the actual available items. We tried to replicate this error as per the given line of code but no success. Kindly send us your source PDF and the complete code. We will investigate and share our findings with you.

What I found out…

  1. Something to do with Font name that pdf document created with.
  2. Page 2 is not searchable. I have 2 pdf page to search and replace text. Only 1st page works.
  3. Not replacing all searched text. Partial items are replaced…

we are using 10.5 net DLL. Do we need to update new version DLL?


I have observed your comments and like to share with you that support is provided on the basis of latest available version because latest version contains the most bug fixes and improved features. Kindly upgrade to Aspose.Pdf for .NET 17.11 and then share your observations along with the source code and input files so that we may proceed further to help you out.